Line 89... |
Line 89... |
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 falling_edge(RX_CLK) then
|
if rising_edge(RX_CLK) then
|
|
|
-- diagnostic (uncomment)
|
-- diagnostic (uncomment)
|
-- write (l, String'(" Item Falling Edge"));
|
-- write (l, String'(" Item Rising Edge"));
|
-- write (l, String'(" b1_px_type: "));
|
-- write (l, String'(" b1_px_type: "));
|
-- 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: "));
|
-- write (l, String'(" item_id: "));
|
Line 105... |
Line 105... |
-- end loop;
|
-- end loop;
|
-- write (l, String'(" b1_id: "));
|
-- write (l, String'(" b1_id: "));
|
-- for j in b1_id'range loop
|
-- for j in b1_id'range loop
|
-- write(l, std_logic'image(b1_id(j)) );
|
-- write(l, std_logic'image(b1_id(j)) );
|
-- end loop;
|
-- end loop;
|
|
-- write (l, String'(" store_qty: "));
|
|
-- for j in store_qty'range loop
|
|
-- write(l, std_logic'image(store_qty(j)) );
|
|
-- end loop;
|
-- write (l, String'(" b1_px_valid: "));
|
-- write (l, String'(" b1_px_valid: "));
|
-- write (l, std_logic'image(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_valid = '1' then
|
Line 209... |
Line 213... |
-- send a return order
|
-- send a return order
|
b2_buy_sell <= store_buy_sell; -- 111 buy, 000 sell
|
b2_buy_sell <= store_buy_sell; -- 111 buy, 000 sell
|
b2_sec <= store_sec; -- 7x 8bits securities identifier
|
b2_sec <= store_sec; -- 7x 8bits securities identifier
|
b2_id <= item_id; -- unique/identifier/counter
|
b2_id <= item_id; -- unique/identifier/counter
|
b2_px <= b1_px; -- price
|
b2_px <= b1_px; -- price
|
-- b2_qty <=
|
-- update the store qty and adjust the return value
|
if b1_qty < store_qty then
|
if ( to_integer(unsigned(b1_qty)) < to_integer(unsigned(store_qty)) ) then
|
b2_qty <= b1_qty;
|
b2_qty <= b1_qty;
|
else
|
|
b2_qty <= store_qty;
|
|
end if; -- quantity
|
|
-- update the store
|
|
-- store_qty
|
|
if (b1_qty < store_qty) then
|
|
store_qty <= std_logic_vector(to_unsigned( to_integer(unsigned(store_qty)) - to_integer(unsigned(b1_qty)) ,16 ));
|
store_qty <= std_logic_vector(to_unsigned( to_integer(unsigned(store_qty)) - to_integer(unsigned(b1_qty)) ,16 ));
|
else
|
else
|
|
b2_qty <= store_qty;
|
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;
|