Line 57... |
Line 57... |
entity search_item_wrapper is
|
entity search_item_wrapper is
|
end search_item_wrapper;
|
end search_item_wrapper;
|
|
|
architecture behaviour of search_item_wrapper is
|
architecture behaviour of search_item_wrapper is
|
component search_item
|
component search_item
|
|
generic ( item_id: std_logic_vector(15 downto 0) );
|
port (
|
port (
|
RX_CLK: in std_logic;
|
RX_CLK: in std_logic;
|
-- control flag(s) on the incoming bus
|
-- control flag(s) on the incoming bus
|
b1_px_valid: in std_logic;
|
b1_px_valid: in std_logic;
|
-- pxdata: in price_packet
|
-- pxdata: in price_packet
|
Line 96... |
Line 97... |
signal b2_px: std_logic_vector(15 downto 0); -- price
|
signal b2_px: std_logic_vector(15 downto 0); -- price
|
signal b2_qty: std_logic_vector(15 downto 0); -- quantity
|
signal b2_qty: std_logic_vector(15 downto 0); -- quantity
|
signal b2_sec: std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
signal b2_sec: std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
signal b2_id: std_logic_vector(15 downto 0); -- unique/identifier/counter
|
signal b2_id: std_logic_vector(15 downto 0); -- unique/identifier/counter
|
begin
|
begin
|
search_item_0: search_item port map (
|
search_item_0: search_item
|
|
generic map ( item_id => std_logic_vector'("0110011001100110") )
|
|
port map (
|
RX_CLK => RX_CLK,
|
RX_CLK => RX_CLK,
|
-- control flag(s) on the incoming bus
|
-- control flag(s) on the incoming bus
|
b1_px_valid => b1_px_valid,
|
b1_px_valid => b1_px_valid,
|
-- pxdata: in price_packet
|
-- pxdata: in price_packet
|
b1_px_type => b1_px_type,
|
b1_px_type => b1_px_type,
|
Line 150... |
Line 153... |
constant test_px: std_logic_vector(15 downto 0) := std_logic_vector'("0000000011100000");
|
constant test_px: std_logic_vector(15 downto 0) := std_logic_vector'("0000000011100000");
|
constant test_qty: std_logic_vector(15 downto 0) := std_logic_vector'("0000000000001100");
|
constant test_qty: std_logic_vector(15 downto 0) := std_logic_vector'("0000000000001100");
|
constant remain_qty: std_logic_vector(15 downto 0) := std_logic_vector'("0000000000000100");
|
constant remain_qty: std_logic_vector(15 downto 0) := std_logic_vector'("0000000000000100");
|
constant test_sec: std_logic_vector(55 downto 0) := std_logic_vector'(X"ABA543332178DC");
|
constant test_sec: std_logic_vector(55 downto 0) := std_logic_vector'(X"ABA543332178DC");
|
constant test_id: std_logic_vector(15 downto 0) := std_logic_vector'("0110011001100110");
|
constant test_id: std_logic_vector(15 downto 0) := std_logic_vector'("0110011001100110");
|
constant other_px: std_logic_vector(15 downto 0) := std_logic_vector'("0000000110000000");
|
constant other_id: std_logic_vector(15 downto 0) := std_logic_vector'("0000010001100010");
|
|
constant other_px: std_logic_vector(15 downto 0) := std_logic_vector'("0000000000001110");
|
constant other_sec: std_logic_vector(55 downto 0) := std_logic_vector'(X"CDC423354634AA");
|
constant other_sec: std_logic_vector(55 downto 0) := std_logic_vector'(X"CDC423354634AA");
|
type input_pattern_array is array (natural range <>) of input_pattern_type;
|
type input_pattern_array is array (natural range <>) of input_pattern_type;
|
constant input_patterns : input_pattern_array :=
|
constant input_patterns : input_pattern_array :=
|
( ('1', std_logic_vector'("00000"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- reset
|
( ('1', std_logic_vector'("00000"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 0 reset
|
('0', std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- nothing
|
('0', std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 1 nothing
|
('1', std_logic_vector'("00110"), std_logic_vector'("000"), test_px, set_qty, test_sec, zz_id), -- sec/set
|
('1', std_logic_vector'("01010"), std_logic_vector'("000"), test_px, set_qty, test_sec, other_id), -- 2 bad sec/set
|
('1', std_logic_vector'("00101"), std_logic_vector'("111"), test_px, test_qty, test_sec, zz_id), -- incoming px
|
('1', std_logic_vector'("01010"), std_logic_vector'("000"), test_px, set_qty, test_sec, test_id), -- 3 sec/set
|
('1', std_logic_vector'("00101"), std_logic_vector'("111"), test_px, zz_qty, other_sec, zz_id), -- incoming px (wrong security)
|
('1', std_logic_vector'("11100"), std_logic_vector'("111"), test_px, test_qty, test_sec, zz_id), -- 4 incoming px
|
('1', std_logic_vector'("00101"), std_logic_vector'("111"), other_px, test_qty, test_sec, zz_id), -- incoming px (hight price)
|
('1', std_logic_vector'("11100"), std_logic_vector'("111"), test_px, zz_qty, other_sec, zz_id), -- 5 incoming px (wrong security)
|
('0', std_logic_vector'("00101"), std_logic_vector'("111"), test_px, test_qty, test_sec, zz_id) ); -- incoming px (part qty)
|
('1', std_logic_vector'("11100"), std_logic_vector'("111"), other_px, test_qty, test_sec, zz_id), -- 6 incoming px (too low sale price)
|
|
('1', std_logic_vector'("11100"), std_logic_vector'("111"), test_px, test_qty, test_sec, zz_id) ); -- 7 incoming px (part qty)
|
type output_pattern_array is array (natural range <>) of output_pattern_type;
|
type output_pattern_array is array (natural range <>) of output_pattern_type;
|
constant output_patterns : output_pattern_array :=
|
constant output_patterns : output_pattern_array :=
|
( (std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- reset
|
( (std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 0 reset
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- nothing
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 1 nothing
|
(std_logic_vector'("00110"), std_logic_vector'("000"), test_px, set_qty, test_sec, test_id), -- sec/set
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 2 nothing (bad sec/set)
|
(std_logic_vector'("00101"), std_logic_vector'("000"), test_px, test_qty, test_sec, test_id), -- incoming px
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, test_id), -- 3 sec/set
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- incoming px (wrong security)
|
(std_logic_vector'("11100"), std_logic_vector'("000"), test_px, test_qty, test_sec, test_id), -- 4 incoming px
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- incoming px (high price)
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 5 incoming px (wrong security)
|
(std_logic_vector'("00101"), std_logic_vector'("000"), test_px, remain_qty, test_sec, test_id) ); -- incoming px (part qty)
|
(std_logic_vector'("11101"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 6 incoming px (too low sale price)
|
|
(std_logic_vector'("11100"), std_logic_vector'("000"), test_px, remain_qty, test_sec, test_id) ); -- 7 incoming px (part qty)
|
|
|
begin
|
begin
|
write (l, String'("Exercising search_item"));
|
write (l, String'("Exercising search_item"));
|
writeline (output, l);
|
writeline (output, l);
|
RX_CLK <= '0';
|
RX_CLK <= '0';
|
Line 202... |
Line 208... |
assert b2_sec = output_patterns(i).b2_sec report "search_item_wrapper: bad sec" severity error;
|
assert b2_sec = output_patterns(i).b2_sec report "search_item_wrapper: bad sec" severity error;
|
assert b2_id = output_patterns(i).b2_id report "search_item_wrapper: bad id" severity error;
|
assert b2_id = output_patterns(i).b2_id report "search_item_wrapper: bad id" severity error;
|
-- Clock down.
|
-- Clock down.
|
RX_CLK <= '0';
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
|
b1_px_valid <= '0';
|
|
RX_CLK <= '1';
|
|
wait for 1 ns;
|
|
RX_CLK <= '0';
|
|
wait for 1 ns;
|
end loop;
|
end loop;
|
-- assert false report "end of test" severity note;
|
-- assert false report "end of test" severity note;
|
|
|
write (l, String'("Done search_item"));
|
write (l, String'("Done search_item"));
|
writeline (output, l);
|
writeline (output, l);
|