Line 58... |
Line 58... |
end parse_price_wrapper;
|
end parse_price_wrapper;
|
|
|
architecture behaviour of parse_price_wrapper is
|
architecture behaviour of parse_price_wrapper is
|
component parse_price
|
component parse_price
|
port (
|
port (
|
|
RX_CLK: in std_logic;
|
in_byte: in std_logic_vector(7 downto 0);
|
in_byte: in std_logic_vector(7 downto 0);
|
byte_reset: in std_logic;
|
byte_reset: in std_logic;
|
byte_ready: in std_logic;
|
byte_ready: in std_logic;
|
price_ready: out std_logic;
|
price_ready: out std_logic;
|
-- pxdata: out price_packet
|
-- pxdata: out price_packet
|
Line 72... |
Line 73... |
sec: out std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
sec: out std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
id: out std_logic_vector(15 downto 0) -- unique/identifier/counter
|
id: out std_logic_vector(15 downto 0) -- unique/identifier/counter
|
);
|
);
|
end component;
|
end component;
|
for parse_price_0: parse_price use entity work.parse_price;
|
for parse_price_0: parse_price use entity work.parse_price;
|
|
signal RX_CLK: std_logic;
|
signal in_byte: std_logic_vector(7 downto 0);
|
signal in_byte: std_logic_vector(7 downto 0);
|
signal byte_reset: std_logic;
|
signal byte_reset: std_logic;
|
signal byte_ready: std_logic;
|
signal byte_ready: std_logic;
|
signal price_ready: std_logic;
|
signal price_ready: std_logic;
|
-- pxdata: price_packet
|
-- pxdata: price_packet
|
Line 85... |
Line 87... |
signal qty: std_logic_vector(15 downto 0); -- quantity
|
signal qty: std_logic_vector(15 downto 0); -- quantity
|
signal sec: std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
signal sec: std_logic_vector(55 downto 0); -- 7x 8bits securities identifier
|
signal id: std_logic_vector(15 downto 0); -- unique/identifier/counter
|
signal id: std_logic_vector(15 downto 0); -- unique/identifier/counter
|
begin
|
begin
|
parse_price_0: parse_price port map (
|
parse_price_0: parse_price port map (
|
|
RX_CLK => RX_CLK,
|
in_byte => in_byte,
|
in_byte => in_byte,
|
byte_reset => byte_reset,
|
byte_reset => byte_reset,
|
byte_ready => byte_ready,
|
byte_ready => byte_ready,
|
price_ready => price_ready,
|
price_ready => price_ready,
|
-- price_packet
|
-- price_packet
|
Line 100... |
Line 103... |
id => id
|
id => id
|
);
|
);
|
process
|
process
|
variable l : line;
|
variable l : line;
|
-- WWHHAATTSSEECC
|
-- WWHHAATTSSEECC
|
constant pkt : std_logic_vector(103 downto 0) := X"081234567857484154534543C0";
|
constant pkt : std_logic_vector(111 downto 0) := X"081234567857484154534543C078";
|
variable pos : integer;
|
variable pos : integer;
|
variable offset : integer;
|
variable offset : integer;
|
variable eoffset : integer;
|
variable eoffset : integer;
|
begin
|
begin
|
write (l, String'("Exercising parse_price"));
|
write (l, String'("Exercising parse_price"));
|
writeline (output, l);
|
writeline (output, l);
|
|
|
|
byte_reset <= '1';
|
byte_ready <= '0';
|
byte_ready <= '0';
|
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
byte_reset <= '1';
|
RX_CLK <= '1';
|
byte_ready <= '1';
|
|
wait for 1 ns;
|
wait for 1 ns;
|
byte_ready <= '0';
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
byte_reset <= '0';
|
|
|
|
for pos in 12 downto 0 loop
|
for pos in 13 downto 0 loop
|
in_byte <= pkt(8*pos+7 downto 8*pos);
|
in_byte <= pkt(8*pos+7 downto 8*pos);
|
byte_ready <= '1';
|
byte_ready <= '1';
|
|
byte_reset <= '0';
|
|
RX_CLK <= '1';
|
wait for 1 ns;
|
wait for 1 ns;
|
|
|
for i in in_byte'range loop
|
for i in in_byte'range loop
|
write(l, std_logic'image(in_byte(i)) );
|
write(l, std_logic'image(in_byte(i)) );
|
end loop;
|
end loop;
|
Line 158... |
Line 163... |
write(l, std_logic'image(id(i)) );
|
write(l, std_logic'image(id(i)) );
|
end loop;
|
end loop;
|
|
|
writeline(output, l);
|
writeline(output, l);
|
|
|
byte_ready <= '0';
|
RX_CLK <= '0';
|
wait for 1 ns;
|
wait for 1 ns;
|
end loop;
|
end loop;
|
|
|
|
|
write (l, String'("Done parse_price"));
|
write (l, String'("Done parse_price"));
|
writeline (output, l);
|
writeline (output, l);
|
|
-- 081234 5678 574841545345 43C0
|
if (px_type = B"01000") and (buy_sell = B"000") and (px = B"00000000_00001000")
|
if (px_type = B"00001") and (buy_sell = B"000") and (px = B"00010010_00110100") -- 081234
|
and (qty = B"00110100_00110100")
|
and (qty = B"01010110_01111000") -- 5678
|
and (sec = B"01001000_01000001_01000001_01010100_01010100_01010011_01010011")
|
and (sec = B"01010111_01001000_01000001_01010100_01010011_01000101_01000011") -- 57484154534543
|
and (id = B"01000011_01000011")
|
and (id = B"11000000_01111000") -- C078
|
then
|
then
|
write (l, String'("... and Price is OK."));
|
write (l, String'("... and Price is OK."));
|
writeline (output, l);
|
writeline (output, l);
|
|
else
|
|
write (l, String'("... and price check failed."));
|
|
writeline (output, l);
|
end if;
|
end if;
|
|
|
wait;
|
wait;
|
end process;
|
end process;
|
end behaviour;
|
end behaviour;
|