Line 90... |
Line 90... |
signal store_sec: std_logic_vector(55 downto 0) := (others => 'Z'); -- 7x 8bits securities identifier
|
signal store_sec: std_logic_vector(55 downto 0) := (others => 'Z'); -- 7x 8bits securities identifier
|
begin
|
begin
|
match: process (RX_CLK) is
|
match: process (RX_CLK) is
|
-- variable l : line;
|
-- variable l : line;
|
begin
|
begin
|
if rising_edge(RX_CLK) then
|
if falling_edge(RX_CLK) then
|
-- if falling_edge(RX_CLK) then
|
|
if b1_px_valid = '1' then
|
|
|
|
-- write (l, String'(" Item Rising Edge "));
|
-- diagnostic (uncomment)
|
-- for j in b1_id'range loop
|
-- write (l, String'(" Item Falling Edge"));
|
-- write(l, std_logic'image(b1_id(j)) );
|
-- write (l, String'(" b1_px_type: "));
|
-- end loop;
|
|
-- write (l, String'(" instruction: "));
|
|
-- for j in b1_px_type'range loop
|
-- for j in b1_px_type'range loop
|
-- write(l, std_logic'image(b1_px_type(j)) );
|
-- write(l, std_logic'image(b1_px_type(j)) );
|
-- end loop;
|
-- end loop;
|
|
-- write (l, String'(" item_id: "));
|
|
-- for j in item_id'range loop
|
|
-- write(l, std_logic'image(item_id(j)) );
|
|
-- end loop;
|
|
-- write (l, String'(" b1_id: "));
|
|
-- for j in b1_id'range loop
|
|
-- write(l, std_logic'image(b1_id(j)) );
|
|
-- end loop;
|
|
-- write (l, String'(" b1_px_valid: "));
|
|
-- write (l, std_logic'image(b1_px_valid) );
|
-- writeline ( output, l);
|
-- writeline ( output, l);
|
|
|
|
if b1_px_valid = '1' then
|
if b1_px_type = std_logic_vector'("00000") then
|
if b1_px_type = std_logic_vector'("00000") then
|
-- do reset store and outputs
|
-- do reset store and outputs
|
store_px_type <= (others => '0');
|
store_px_type <= (others => '0');
|
store_buy_sell <= (others => '0'); -- 111 buy, 000 sell
|
store_buy_sell <= (others => '0'); -- 111 buy, 000 sell
|
store_px <= (others => '0'); -- price
|
store_px <= (others => '0'); -- price
|
Line 121... |
Line 127... |
b2_qty <= (others => 'Z'); -- quantity
|
b2_qty <= (others => 'Z'); -- quantity
|
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
--
|
--
|
requires_reset <= '0';
|
requires_reset <= '0';
|
|
|
elsif b1_px_type = std_logic_vector'("00110") then
|
elsif b1_px_type = std_logic_vector'("00110") then
|
if store_buy_sell = b1_buy_sell and
|
if store_buy_sell = b1_buy_sell and
|
store_sec = b1_sec then
|
store_sec = b1_sec then
|
-- do set store from incoming price
|
-- do set store from incoming price
|
store_px_type <= b1_px_type;
|
store_px_type <= b1_px_type;
|
Line 136... |
Line 141... |
b2_px_type <= std_logic_vector'(std_logic_vector'("00110"));
|
b2_px_type <= std_logic_vector'(std_logic_vector'("00110"));
|
b2_buy_sell <= (others => 'Z');
|
b2_buy_sell <= (others => 'Z');
|
b2_px <= (others => 'Z');
|
b2_px <= (others => 'Z');
|
b2_qty <= (others => 'Z');
|
b2_qty <= (others => 'Z');
|
b2_sec <= (others => 'Z');
|
b2_sec <= (others => 'Z');
|
b2_id <= (others => 'Z');
|
b2_id <= item_id;
|
requires_reset <= '1';
|
requires_reset <= '1';
|
else
|
else
|
if requires_reset = '1' then
|
if requires_reset = '1' then
|
b2_px_type <= (others => 'Z');
|
b2_px_type <= (others => 'Z');
|
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
|
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
|
Line 149... |
Line 154... |
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
requires_reset <= '0';
|
requires_reset <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
elsif b1_px_type = std_logic_vector'("01010") then
|
elsif b1_px_type = std_logic_vector'("01010") then
|
if item_id = b1_id then
|
if item_id = b1_id then
|
-- do set store and security from incoming price
|
-- do set store and security from incoming price
|
store_px_type <= b1_px_type;
|
store_px_type <= b1_px_type;
|
store_buy_sell <= b1_buy_sell;
|
store_buy_sell <= b1_buy_sell;
|
Line 177... |
Line 181... |
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
requires_reset <= '0';
|
requires_reset <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
elsif b1_px_type = std_logic_vector'("11100") then
|
elsif b1_px_type = std_logic_vector'("11100") then
|
-- incoming price, register it and start the state machine
|
-- incoming price, register it and start the state machine
|
if (store_sec /= b1_sec or store_buy_sell = b1_buy_sell ) then
|
if (store_sec /= b1_sec or store_buy_sell = b1_buy_sell ) then
|
if requires_reset = '1' then
|
if requires_reset = '1' then
|
b2_px_type <= (others => 'Z');
|
b2_px_type <= (others => 'Z');
|
Line 223... |
Line 226... |
store_qty <= (others => '0');
|
store_qty <= (others => '0');
|
end if;
|
end if;
|
b2_px_type <= std_logic_vector'(std_logic_vector'("11100"));
|
b2_px_type <= std_logic_vector'(std_logic_vector'("11100"));
|
requires_reset <= '1';
|
requires_reset <= '1';
|
end if;
|
end if;
|
|
|
else
|
else
|
-- no action
|
-- no action
|
if requires_reset = '1' then
|
if requires_reset = '1' then
|
b2_px_type <= (others => 'Z');
|
b2_px_type <= (others => 'Z');
|
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
|
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
|
Line 236... |
Line 238... |
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
requires_reset <= '0';
|
requires_reset <= '0';
|
end if;
|
end if;
|
end if; -- b1_px_type
|
end if; -- b1_px_type
|
|
|
else -- b1_px_valid
|
else -- b1_px_valid
|
if requires_reset = '1' then
|
if requires_reset = '1' then
|
b2_px_type <= (others => 'Z');
|
b2_px_type <= (others => 'Z');
|
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
|
b2_buy_sell <= (others => 'Z'); -- 111 buy, 000 sell
|
b2_px <= (others => 'Z'); -- price
|
b2_px <= (others => 'Z'); -- price
|
Line 248... |
Line 249... |
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_sec <= (others => 'Z'); -- 7x 8bits securities identifier
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
b2_id <= (others => 'Z'); -- unique/identifier/counter
|
requires_reset <= '0';
|
requires_reset <= '0';
|
end if;
|
end if;
|
end if; -- b1_px_valid
|
end if; -- b1_px_valid
|
|
|
-- b2_id <= std_logic_vector'(X"0000"); -- testing
|
|
|
|
end if;
|
end if;
|
end process match;
|
end process match;
|
|
|
end search_item_implementation;
|
end search_item_implementation;
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|