OpenCores
URL https://opencores.org/ocsvn/open_hitter/open_hitter/trunk

Subversion Repositories open_hitter

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /open_hitter
    from Rev 12 to Rev 13
    Reverse comparison

Rev 12 → Rev 13

/trunk/bench/vhdl/search_item_wrapper.vhd
142,40 → 142,70
end record;
 
-- The patterns to apply.
constant px1: std_logic_vector(15 downto 0) := (others => 'Z');
constant qty1: std_logic_vector(15 downto 0) := (others => 'Z');
constant sec1: std_logic_vector(55 downto 0) := (others => 'Z');
constant id1: std_logic_vector(15 downto 0) := (others => 'Z');
constant zz_px: std_logic_vector(15 downto 0) := (others => 'Z');
constant zz_qty: std_logic_vector(15 downto 0) := (others => 'Z');
constant zz_sec: std_logic_vector(55 downto 0) := (others => 'Z');
constant zz_id: std_logic_vector(15 downto 0) := (others => 'Z');
constant set_qty: std_logic_vector(15 downto 0) := std_logic_vector'("0000000000010000");
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 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_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_sec: std_logic_vector(55 downto 0) := std_logic_vector'(X"CDC423354634AA");
type input_pattern_array is array (natural range <>) of input_pattern_type;
-- constant input_patterns : input_pattern_array :=
-- ( ('0', std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), px1, qty1, sec1, id1),
-- ('0', std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), px1, qty1, sec1, id1) );
constant input_patterns : input_pattern_array :=
( ('1', std_logic_vector'("00000"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- reset
('0', std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- nothing
('1', std_logic_vector'("00110"), std_logic_vector'("000"), test_px, set_qty, test_sec, zz_id), -- 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'("00101"), std_logic_vector'("111"), test_px, zz_qty, other_sec, zz_id), -- incoming px (wrong security)
('1', std_logic_vector'("00101"), std_logic_vector'("111"), other_px, test_qty, test_sec, zz_id), -- incoming px (hight price)
('0', std_logic_vector'("00101"), std_logic_vector'("111"), test_px, test_qty, test_sec, zz_id) ); -- incoming px (part qty)
type output_pattern_array is array (natural range <>) of output_pattern_type;
-- constant output_patterns : output_pattern_array :=
-- ( (std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), (others => 'Z'), (others => 'Z'), (others => 'Z'), (others => 'Z')),
-- (std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), (others => 'Z'), (others => 'Z'), (others => 'Z'), (others => 'Z')) );
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), -- nothing
(std_logic_vector'("00110"), std_logic_vector'("000"), test_px, set_qty, test_sec, test_id), -- sec/set
(std_logic_vector'("00101"), std_logic_vector'("000"), test_px, test_qty, test_sec, test_id), -- incoming px
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- incoming px (wrong security)
(std_logic_vector'("ZZZZZ"), std_logic_vector'("ZZZ"), zz_px, zz_qty, zz_sec, zz_id), -- incoming px (high price)
(std_logic_vector'("00101"), std_logic_vector'("000"), test_px, remain_qty, test_sec, test_id) ); -- incoming px (part qty)
 
begin
write (l, String'("Exercising search_item"));
writeline (output, l);
RX_CLK <= '0';
wait for 1 ns;
 
-- Check each pattern.
-- for i in patterns'range loop
for i in input_patterns'range loop
-- Set the inputs.
-- i0 <= patterns(i).i0;
-- i1 <= patterns(i).i1;
-- ci <= patterns(i).ci;
-- Wait for the results.
-- wait for 1 ns;
b1_px_valid <= input_patterns(i).b1_px_valid;
b1_px_type <= input_patterns(i).b1_px_type;
b1_buy_sell<= input_patterns(i).b1_buy_sell;
b1_px <= input_patterns(i).b1_px;
b1_qty <= input_patterns(i).b1_qty;
b1_sec <= input_patterns(i).b1_sec;
b1_id <= input_patterns(i).b1_id;
-- Clock once for the results.
RX_CLK <= '1';
wait for 1 ns;
-- Check the outputs.
-- assert s = patterns(i).s
-- report "bad sum value" severity error;
-- assert co = patterns(i).co
-- report "bad carray out value" severity error;
-- end loop;
write(l, i);
writeline (output, l);
assert b2_px_type = output_patterns(i).b2_px_type report "search_item_wrapper: bad px type" severity error;
assert b2_buy_sell = output_patterns(i).b2_buy_sell report "search_item_wrapper: bad buy_sell" severity error;
assert b2_px = output_patterns(i).b2_px report "search_item_wrapper: bad px" severity error;
assert b2_qty = output_patterns(i).b2_qty report "search_item_wrapper: bad qty" 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;
-- Clock down.
RX_CLK <= '0';
wait for 1 ns;
end loop;
-- assert false report "end of test" severity note;
-- Wait forever; this will finish the simulation.
-- wait;
write (l, String'("Done search_item"));
writeline (output, l);
/trunk/bench/vhdl/build.sh
24,4 → 24,4
#ghdl -r hitter_wrapper
 
ghdl -e search_item_wrapper
#ghdl -r search_item_wrapper
ghdl -r search_item_wrapper
/trunk/rtl/vhdl/search_item.vhd
90,9 → 90,9
match: process (RX_CLK) is
begin
if rising_edge(RX_CLK) then
if b1_px_valid = '0' then
if b1_px_valid = '1' then
 
if b1_px_type = std_logic_vector'("0000") then
if b1_px_type = std_logic_vector'("00000") then
-- do reset store and outputs
store_px_type <= (others => '0');
store_buy_sell <= (others => '0'); -- 111 buy, 000 sell
99,7 → 99,7
store_px <= (others => '0'); -- price
store_qty <= (others => '0'); -- quantity
store_sec <= (others => '0'); -- 7x 8bits securities identifier
store_id <= (others => '0'); -- unique/identifier/counter
-- not reset / generic store_id <= (others => '0'); -- unique/identifier/counter
--
b2_px_type <= (others => 'Z');
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
108,10 → 108,10
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
b2_id <= (others => 'Z'); -- unique/identifier/counter
--
b2_px_type <= std_logic_vector'(std_logic_vector'("0000"));
b2_px_type <= std_logic_vector'(std_logic_vector'("00000"));
state <= 8;
 
elsif b1_px_type = std_logic_vector'("0110") then
elsif b1_px_type = std_logic_vector'("00110") then
-- do set store from incoming price
store_px_type <= b1_px_type;
store_buy_sell <= b1_buy_sell;
120,7 → 120,7
store_sec <= b1_sec;
store_id <= b1_id;
--
b2_px_type <= std_logic_vector'(std_logic_vector'("0000"));
b2_px_type <= std_logic_vector'(std_logic_vector'("00000"));
state <= 8;
 
elsif b1_px_type = std_logic_vector'("0101") then
132,7 → 132,7
(store_buy_sell = std_logic_vector'("111") and store_px < b1_px) or
(store_buy_sell = std_logic_vector'("000") and store_px > b1_px) ) then
-- no deal: this is the correct store_item but there's no match
b2_px_type <= std_logic_vector'(std_logic_vector'("0000"));
b2_px_type <= std_logic_vector'(std_logic_vector'("00000"));
state <= 8;
else
-- send a return order
177,7 → 177,7
 
when 8 =>
-- correct store_item but there was no match
b2_px_type <= std_logic_vector'("ZZZZ");
b2_px_type <= std_logic_vector'("ZZZZZ");
state <= 16;
 
when others => null;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.