Line 98... |
Line 98... |
signal order_buy_sell_o: std_logic_vector(2 downto 0); -- 111 buy, 000 sell
|
signal order_buy_sell_o: std_logic_vector(2 downto 0); -- 111 buy, 000 sell
|
signal order_px_o: std_logic_vector(15 downto 0); -- price
|
signal order_px_o: std_logic_vector(15 downto 0); -- price
|
signal order_qty_o: std_logic_vector(15 downto 0); -- quantity
|
signal order_qty_o: std_logic_vector(15 downto 0); -- quantity
|
signal order_sec_o: std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
signal order_sec_o: std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
signal order_id_o: std_logic_vector(15 downto 0); -- unique/identifier/counter
|
signal order_id_o: std_logic_vector(15 downto 0); -- unique/identifier/counter
|
|
-- control
|
|
signal order_px_valid_o: std_logic;
|
begin
|
begin
|
search_control_0: search_control
|
search_control_0: search_control
|
generic map ( searchitems => 3 )
|
generic map ( searchitems => 3 )
|
port map (
|
port map (
|
RX_CLK => RX_CLK,
|
RX_CLK => RX_CLK,
|
Line 118... |
Line 120... |
order_px_type_o => order_px_type_o,
|
order_px_type_o => order_px_type_o,
|
order_buy_sell_o => order_buy_sell_o,
|
order_buy_sell_o => order_buy_sell_o,
|
order_px_o => order_px_o,
|
order_px_o => order_px_o,
|
order_qty_o => order_qty_o,
|
order_qty_o => order_qty_o,
|
order_sec_o => order_sec_o,
|
order_sec_o => order_sec_o,
|
order_id_o => order_id_o
|
order_id_o => order_id_o,
|
|
-- control
|
|
order_px_valid_o => order_px_valid_o
|
);
|
);
|
process
|
process
|
variable l : line;
|
variable l : line;
|
|
variable res : integer;
|
|
|
type input_pattern_type is record
|
type input_pattern_type is record
|
-- control flag(s) on the incoming bus
|
-- control flag(s) on the incoming bus
|
search_px_valid_i: std_logic;
|
search_px_valid_i: std_logic;
|
-- pxdata: in price_packet
|
-- pxdata: in price_packet
|
Line 180... |
Line 185... |
( (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), -- 0 reset
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 1 nothing
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 1 nothing
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, std_logic_vector'(X"0001")), -- 2 sec/set
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, std_logic_vector'(X"0001")), -- 2 sec/set
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, std_logic_vector'(X"0002")), -- 3 sec/set
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, std_logic_vector'(X"0002")), -- 3 sec/set
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, std_logic_vector'(X"0003")), -- 4 sec/set
|
(std_logic_vector'("01010"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, std_logic_vector'(X"0003")), -- 4 sec/set
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 5 bad sec/set (too many)
|
(std_logic_vector'("11111"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 5 bad sec/set (too many)
|
(std_logic_vector'("11100"), std_logic_vector'("000"), test_px, test_qty, test_sec1, test_id), -- 6 incoming px
|
(std_logic_vector'("11100"), std_logic_vector'("000"), test_px, test_qty, test_sec1, test_id), -- 6 incoming px
|
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 7 incoming px (wrong security)
|
(std_logic_vector'("11110"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 7 incoming px (wrong security)
|
(std_logic_vector'("11101"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 8 incoming px (too low sale price)
|
(std_logic_vector'("11101"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- 8 incoming px (too low sale price)
|
(std_logic_vector'("11100"), std_logic_vector'("000"), test_px, remain_qty, test_sec1, test_id) ); -- 9 incoming px (part qty)
|
(std_logic_vector'("11100"), std_logic_vector'("000"), test_px, remain_qty, test_sec1, test_id) ); -- 9 incoming px (part qty)
|
|
|
begin
|
begin
|
write (l, String'("Exercising search_control"));
|
write (l, String'("Exercising search_control"));
|
writeline (output, l);
|
writeline (output, l);
|
RX_CLK <= '0';
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
Line 206... |
Line 210... |
--search_id_i <= input_patterns(i).search_id_i;
|
--search_id_i <= input_patterns(i).search_id_i;
|
-- Clock once for the results.
|
-- Clock once for the results.
|
RX_CLK <= '1';
|
RX_CLK <= '1';
|
wait for 1 ns;
|
wait for 1 ns;
|
-- Check the outputs.
|
-- Check the outputs.
|
|
res := 0;
|
|
for r in 0 to 4 loop
|
|
if order_px_valid_o = '1' then
|
write(l, i);
|
write(l, i);
|
writeline (output, l);
|
writeline (output, l);
|
assert order_px_type_o = output_patterns(i).order_px_type_o report "search_item_wrapper: bad px type" severity error;
|
assert order_px_type_o = output_patterns(i).order_px_type_o report "search_control_wrapper: bad px type" severity error;
|
assert order_buy_sell_o = output_patterns(i).order_buy_sell_o report "search_item_wrapper: bad buy_sell" severity error;
|
assert order_buy_sell_o = output_patterns(i).order_buy_sell_o report "search_control_wrapper: bad buy_sell" severity error;
|
assert order_px_o = output_patterns(i).order_px_o report "search_item_wrapper: bad px" severity error;
|
assert order_px_o = output_patterns(i).order_px_o report "search_control_wrapper: bad px" severity error;
|
assert order_qty_o = output_patterns(i).order_qty_o report "search_item_wrapper: bad qty" severity error;
|
assert order_qty_o = output_patterns(i).order_qty_o report "search_control_wrapper: bad qty" severity error;
|
assert order_sec_o = output_patterns(i).order_sec_o report "search_item_wrapper: bad sec" severity error;
|
assert order_sec_o = output_patterns(i).order_sec_o report "search_control_wrapper: bad sec" severity error;
|
assert order_id_o = output_patterns(i).order_id_o report "search_item_wrapper: bad id" severity error;
|
assert order_id_o = output_patterns(i).order_id_o report "search_control_wrapper: bad id" severity error;
|
|
res := res + 1;
|
|
end if;
|
-- Clock down.
|
-- Clock down.
|
RX_CLK <= '0';
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
search_px_valid_i <= '0';
|
search_px_valid_i <= '0';
|
RX_CLK <= '1';
|
RX_CLK <= '1';
|
wait for 1 ns;
|
wait for 1 ns;
|
|
end loop;
|
|
assert res = 1 report "search_control_wrapper: wrong number of results from input pattern message" severity error;
|
|
|
RX_CLK <= '0';
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
end loop;
|
end loop;
|
-- assert false report "end of test" severity note;
|
-- assert false report "end of test" severity note;
|
|
|