Line 24... |
Line 24... |
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
-- that these types always be used for the top-level I/O of a design in order
|
-- that these types always be used for the top-level I/O of a design in order
|
-- to guarantee that the testbench will bind correctly to the post-implementation
|
-- to guarantee that the testbench will bind correctly to the post-implementation
|
-- simulation model.
|
-- simulation model.
|
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
LIBRARY ieee;
|
library ieee;
|
USE ieee.std_logic_1164.ALL;
|
use ieee.std_logic_1164.all;
|
USE ieee.numeric_std.ALL;
|
use ieee.numeric_std.all;
|
use work.arp_types.all;
|
use work.arp_types.all;
|
|
|
ENTITY arpv2_tb IS
|
entity arpv2_tb is
|
END arpv2_tb;
|
end arpv2_tb;
|
|
|
ARCHITECTURE behavior OF arpv2_tb IS
|
architecture behavior of arpv2_tb is
|
|
|
-- Component Declaration for the Unit Under Test (UUT)
|
-- Component Declaration for the Unit Under Test (UUT)
|
|
|
COMPONENT arpv2
|
component arpv2
|
generic (
|
generic (
|
|
no_default_gateway : boolean := true;
|
CLOCK_FREQ : integer := 125000000; -- freq of data_in_clk -- needed to timout cntr
|
CLOCK_FREQ : integer := 125000000; -- freq of data_in_clk -- needed to timout cntr
|
ARP_TIMEOUT : integer := 60; -- ARP response timeout (s)
|
ARP_TIMEOUT : integer := 60; -- ARP response timeout (s)
|
MAX_ARP_ENTRIES : integer := 255 -- max entries in the arp store
|
MAX_ARP_ENTRIES : integer := 255 -- max entries in the arp store
|
);
|
);
|
Port (
|
port (
|
-- lookup request signals
|
-- lookup request signals
|
arp_req_req : in arp_req_req_type;
|
arp_req_req : in arp_req_req_type;
|
arp_req_rslt : out arp_req_rslt_type;
|
arp_req_rslt : out arp_req_rslt_type;
|
-- MAC layer RX signals
|
-- MAC layer RX signals
|
data_in_clk : in STD_LOGIC;
|
data_in_clk : in std_logic;
|
reset : in STD_LOGIC;
|
reset : in std_logic;
|
data_in : in STD_LOGIC_VECTOR (7 downto 0); -- ethernet frame (from dst mac addr through to last byte of frame)
|
data_in : in std_logic_vector (7 downto 0); -- ethernet frame (from dst mac addr through to last byte of frame)
|
data_in_valid : in STD_LOGIC; -- indicates data_in valid on clock
|
data_in_valid : in std_logic; -- indicates data_in valid on clock
|
data_in_last : in STD_LOGIC; -- indicates last data in frame
|
data_in_last : in std_logic; -- indicates last data in frame
|
-- MAC layer TX signals
|
-- MAC layer TX signals
|
mac_tx_req : out std_logic; -- indicates that ip wants access to channel (stays up for as long as tx)
|
mac_tx_req : out std_logic; -- indicates that ip wants access to channel (stays up for as long as tx)
|
mac_tx_granted : in std_logic; -- indicates that access to channel has been granted
|
mac_tx_granted : in std_logic; -- indicates that access to channel has been granted
|
data_out_clk : in std_logic;
|
data_out_clk : in std_logic;
|
data_out_ready : in std_logic; -- indicates system ready to consume data
|
data_out_ready : in std_logic; -- indicates system ready to consume data
|
data_out_valid : out std_logic; -- indicates data out is valid
|
data_out_valid : out std_logic; -- indicates data out is valid
|
data_out_first : out std_logic; -- with data out valid indicates the first byte of a frame
|
data_out_first : out std_logic; -- with data out valid indicates the first byte of a frame
|
data_out_last : out std_logic; -- with data out valid indicates the last byte of a frame
|
data_out_last : out std_logic; -- with data out valid indicates the last byte of a frame
|
data_out : out std_logic_vector (7 downto 0); -- ethernet frame (from dst mac addr through to last byte of frame)
|
data_out : out std_logic_vector (7 downto 0); -- ethernet frame (from dst mac addr through to last byte of frame)
|
-- system signals
|
-- system signals
|
our_mac_address : in STD_LOGIC_VECTOR (47 downto 0);
|
our_mac_address : in std_logic_vector (47 downto 0);
|
our_ip_address : in STD_LOGIC_VECTOR (31 downto 0);
|
our_ip_address : in std_logic_vector (31 downto 0);
|
|
nwk_gateway : in std_logic_vector (31 downto 0); -- IP address of default gateway
|
|
nwk_mask : in std_logic_vector (31 downto 0); -- Net mask
|
control : in arp_control_type;
|
control : in arp_control_type;
|
req_count : out STD_LOGIC_VECTOR(7 downto 0) -- count of arp pkts received
|
req_count : out std_logic_vector(7 downto 0) -- count of arp pkts received
|
);
|
);
|
END COMPONENT;
|
end component;
|
|
|
|
|
--Inputs
|
--Inputs
|
signal clk : std_logic := '0';
|
signal clk : std_logic := '0';
|
signal reset : std_logic := '0';
|
signal reset : std_logic := '0';
|
signal data_in : std_logic_vector(7 downto 0) := (others => '0');
|
signal data_in : std_logic_vector(7 downto 0) := (others => '0');
|
signal data_in_valid : std_logic := '0';
|
signal data_in_valid : std_logic := '0';
|
signal data_in_last : std_logic := '0';
|
signal data_in_last : std_logic := '0';
|
signal our_mac_address : std_logic_vector(47 downto 0) := (others => '0');
|
signal our_mac_address : std_logic_vector(47 downto 0) := (others => '0');
|
signal our_ip_address : std_logic_vector(31 downto 0) := (others => '0');
|
signal our_ip_address : std_logic_vector(31 downto 0) := (others => '0');
|
|
signal nwk_gateway : std_logic_vector(31 downto 0) := (others => '0');
|
|
signal nwk_mask : std_logic_vector(31 downto 0) := (others => '0');
|
signal data_out_ready : std_logic;
|
signal data_out_ready : std_logic;
|
signal data_out_valid : std_logic;
|
signal data_out_valid : std_logic;
|
signal data_out_first : std_logic;
|
signal data_out_first : std_logic;
|
signal data_out_last : std_logic;
|
signal data_out_last : std_logic;
|
signal data_out : std_logic_vector (7 downto 0);
|
signal data_out : std_logic_vector (7 downto 0);
|
signal req_count : STD_LOGIC_VECTOR(7 downto 0);
|
signal req_count : std_logic_vector(7 downto 0);
|
signal arp_req_req : arp_req_req_type;
|
signal arp_req_req : arp_req_req_type;
|
signal arp_req_rslt : arp_req_rslt_type;
|
signal arp_req_rslt : arp_req_rslt_type;
|
signal mac_tx_req : std_logic;
|
signal mac_tx_req : std_logic;
|
signal mac_tx_granted : std_logic;
|
signal mac_tx_granted : std_logic;
|
signal control : arp_control_type;
|
signal control : arp_control_type;
|
|
|
|
constant no_default_gateway : boolean := false;
|
|
|
-- Clock period definitions
|
-- Clock period definitions
|
constant clk_period : time := 8 ns;
|
constant clk_period : time := 8 ns;
|
|
|
BEGIN
|
begin
|
|
|
-- Instantiate the Unit Under Test (UUT)
|
-- Instantiate the Unit Under Test (UUT)
|
uut: arpv2
|
uut: arpv2
|
generic map (
|
generic map (
|
|
no_default_gateway => no_default_gateway,
|
CLOCK_FREQ => 10, -- artificially low count to enable pragmatic testing
|
CLOCK_FREQ => 10, -- artificially low count to enable pragmatic testing
|
ARP_TIMEOUT => 20
|
ARP_TIMEOUT => 20
|
)
|
)
|
PORT MAP (
|
port map (
|
-- lookup request mappings
|
-- lookup request mappings
|
arp_req_req => arp_req_req,
|
arp_req_req => arp_req_req,
|
arp_req_rslt => arp_req_rslt,
|
arp_req_rslt => arp_req_rslt,
|
-- rx mappings
|
-- rx mappings
|
data_in_clk => clk,
|
data_in_clk => clk,
|
Line 124... |
Line 131... |
data_out_last => data_out_last,
|
data_out_last => data_out_last,
|
data_out => data_out,
|
data_out => data_out,
|
-- system mappings
|
-- system mappings
|
our_mac_address => our_mac_address,
|
our_mac_address => our_mac_address,
|
our_ip_address => our_ip_address,
|
our_ip_address => our_ip_address,
|
|
nwk_gateway => nwk_gateway,
|
|
nwk_mask => nwk_mask,
|
control => control,
|
control => control,
|
req_count => req_count
|
req_count => req_count
|
);
|
);
|
|
|
-- Clock process definitions
|
-- Clock process definitions
|
Line 145... |
Line 154... |
begin
|
begin
|
-- hold reset state for 100 ns.
|
-- hold reset state for 100 ns.
|
wait for 100 ns;
|
wait for 100 ns;
|
|
|
our_ip_address <= x"c0a80509"; -- 192.168.5.9
|
our_ip_address <= x"c0a80509"; -- 192.168.5.9
|
|
nwk_mask <= x"FFFFFF00";
|
|
nwk_gateway <= x"c0a80501"; -- 192.168.5.9
|
our_mac_address <= x"002320212223";
|
our_mac_address <= x"002320212223";
|
mac_tx_granted <= '1'; -- FIXME 0
|
mac_tx_granted <= '1'; -- FIXME 0
|
control.clear_cache <= '0';
|
control.clear_cache <= '0';
|
|
|
reset <= '1';
|
reset <= '1';
|
Line 156... |
Line 167... |
reset <= '0';
|
reset <= '0';
|
wait for clk_period*5;
|
wait for clk_period*5;
|
|
|
assert mac_tx_req = '0' report "mac_tx_req asserted on reset";
|
assert mac_tx_req = '0' report "mac_tx_req asserted on reset";
|
|
|
|
wait until clk = '1';
|
|
|
-- insert stimulus here
|
-- insert stimulus here
|
arp_req_req.lookup_req <= '0';
|
arp_req_req.lookup_req <= '0';
|
arp_req_req.ip <= (others => '0');
|
arp_req_req.ip <= (others => '0');
|
data_out_ready <= '1';
|
data_out_ready <= '1';
|
|
|
Line 428... |
Line 441... |
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"09" report "T5: incorrect our IP.3";
|
assert data_out = x"09" report "T5: incorrect our IP.3";
|
|
|
-- expect empty target mac
|
-- expect empty target mac
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T5: incorrect target mac.0";
|
assert data_out = x"ff" report "T5: incorrect target mac.0";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T5: incorrect target mac.1";
|
assert data_out = x"ff" report "T5: incorrect target mac.1";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T5: incorrect target mac.2";
|
assert data_out = x"ff" report "T5: incorrect target mac.2";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T5: incorrect target mac.3";
|
assert data_out = x"ff" report "T5: incorrect target mac.3";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T5: incorrect target mac.4";
|
assert data_out = x"ff" report "T5: incorrect target mac.4";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T5: incorrect target mac.5";
|
assert data_out = x"ff" report "T5: incorrect target mac.5";
|
-- expect target IP c0 a8 05 01
|
-- expect target IP c0 a8 05 01
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"c0" report "T5: incorrect target IP.0";
|
assert data_out = x"c0" report "T5: incorrect target IP.0";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"a8" report "T5: incorrect target IP.1";
|
assert data_out = x"a8" report "T5: incorrect target IP.1";
|
Line 588... |
Line 601... |
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"09" report "T7: incorrect our IP.3";
|
assert data_out = x"09" report "T7: incorrect our IP.3";
|
|
|
-- expect empty target mac
|
-- expect empty target mac
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T7: incorrect target mac.0";
|
assert data_out = x"ff" report "T7: incorrect target mac.0";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T7: incorrect target mac.1";
|
assert data_out = x"ff" report "T7: incorrect target mac.1";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T7: incorrect target mac.2";
|
assert data_out = x"ff" report "T7: incorrect target mac.2";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T7: incorrect target mac.3";
|
assert data_out = x"ff" report "T7: incorrect target mac.3";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T7: incorrect target mac.4";
|
assert data_out = x"ff" report "T7: incorrect target mac.4";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"00" report "T7: incorrect target mac.5";
|
assert data_out = x"ff" report "T7: incorrect target mac.5";
|
-- expect target IP c0 a8 05 0e
|
-- expect target IP c0 a8 05 0e
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"c0" report "T7: incorrect target IP.0";
|
assert data_out = x"c0" report "T7: incorrect target IP.0";
|
wait for clk_period;
|
wait for clk_period;
|
assert data_out = x"a8" report "T7: incorrect target IP.1";
|
assert data_out = x"a8" report "T7: incorrect target IP.1";
|
Line 616... |
Line 629... |
wait for clk_period*10;
|
wait for clk_period*10;
|
|
|
-- Send the reply
|
-- Send the reply
|
data_out_ready <= '1';
|
data_out_ready <= '1';
|
|
|
report "T7.2: Send an arbitrary unwanted ARP reply: 192.168.7.3 has mac 57:12:34:19:23:9a";
|
report "T7.2: Send an arbitrary unwanted ARP reply: 192.168.5.143 has mac 57:12:34:19:23:9a";
|
data_in_valid <= '1';
|
data_in_valid <= '1';
|
-- dst MAC (bc)
|
-- dst MAC (bc)
|
data_in <= x"ff"; wait for clk_period;
|
data_in <= x"ff"; wait for clk_period;
|
data_in <= x"ff"; wait for clk_period;
|
data_in <= x"ff"; wait for clk_period;
|
data_in <= x"ff"; wait for clk_period;
|
data_in <= x"ff"; wait for clk_period;
|
Line 658... |
Line 671... |
data_in <= x"23"; wait for clk_period;
|
data_in <= x"23"; wait for clk_period;
|
data_in <= x"9a"; wait for clk_period;
|
data_in <= x"9a"; wait for clk_period;
|
-- Sender IP
|
-- Sender IP
|
data_in <= x"c0"; wait for clk_period;
|
data_in <= x"c0"; wait for clk_period;
|
data_in <= x"a8"; wait for clk_period;
|
data_in <= x"a8"; wait for clk_period;
|
data_in <= x"07"; wait for clk_period;
|
data_in <= x"25"; wait for clk_period;
|
data_in <= x"03"; wait for clk_period;
|
data_in <= x"93"; wait for clk_period;
|
-- Target MAC
|
-- Target MAC
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"23"; wait for clk_period;
|
data_in <= x"23"; wait for clk_period;
|
data_in <= x"20"; wait for clk_period;
|
data_in <= x"20"; wait for clk_period;
|
data_in <= x"21"; wait for clk_period;
|
data_in <= x"21"; wait for clk_period;
|
Line 674... |
Line 687... |
data_in <= x"a8"; wait for clk_period;
|
data_in <= x"a8"; wait for clk_period;
|
data_in <= x"05"; wait for clk_period;
|
data_in <= x"05"; wait for clk_period;
|
data_in <= x"09"; wait for clk_period;
|
data_in <= x"09"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
assert arp_req_rslt.got_mac = '0' report "T7.2: expected got mac = 0";
|
|
assert arp_req_rslt.got_err = '0' report "T7.2: expected got err = 0";
|
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
data_in_last <= '1';
|
data_in_last <= '1';
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
|
assert arp_req_rslt.got_mac = '0' report "T7.2: expected got mac = 0";
|
|
assert arp_req_rslt.got_err = '0' report "T7.2: expected got err = 0";
|
data_in_last <= '0';
|
data_in_last <= '0';
|
data_in_valid <= '0';
|
data_in_valid <= '0';
|
wait for clk_period*4;
|
wait for clk_period*4;
|
|
|
-- Send the reply
|
-- Send the reply
|
Line 858... |
Line 871... |
assert arp_req_rslt.got_err = '0' report "T10: should not have got err";
|
assert arp_req_rslt.got_err = '0' report "T10: should not have got err";
|
|
|
arp_req_req.lookup_req <= '0';
|
arp_req_req.lookup_req <= '0';
|
wait for clk_period*20;
|
wait for clk_period*20;
|
|
|
report "T11: Clear the cache, Request 192.168.5.7 again an expect a 'who has' to be sent";
|
--
|
|
wait until clk = '1';
|
|
report "T11 - Send a request for the IP that is not on the local network";
|
|
arp_req_req.ip <= x"0a000003"; --c0a80501
|
|
arp_req_req.lookup_req <= '1';
|
|
wait until clk = '1'; --for clk_period
|
|
arp_req_req.lookup_req <= '0';
|
|
report "T11: wait for reply from store";
|
|
wait until arp_req_rslt.got_mac = '1' or arp_req_rslt.got_err = '1';
|
|
assert arp_req_rslt.got_mac = '1' report "T11: expected got mac";
|
|
assert arp_req_rslt.got_err = '0' report "T11: expected got err = 0";
|
|
assert arp_req_rslt.mac = x"00231829267c" report "T11: wrong mac value";-- severity failure;
|
|
wait for clk_period*2;
|
|
--
|
|
|
|
report "T12: Clear the cache, Request 192.168.5.7 again an expect a 'who has' to be sent";
|
control.clear_cache <= '1';
|
control.clear_cache <= '1';
|
wait for clk_period;
|
wait for clk_period;
|
control.clear_cache <= '0';
|
control.clear_cache <= '0';
|
wait for clk_period;
|
wait for clk_period;
|
|
|
arp_req_req.ip <= x"c0a80507";
|
arp_req_req.ip <= x"c0a80507";
|
arp_req_req.lookup_req <= '1';
|
arp_req_req.lookup_req <= '1';
|
wait for clk_period;
|
wait for clk_period;
|
assert arp_req_rslt.got_mac = '0' report "T11: should not yet have mac";
|
assert arp_req_rslt.got_mac = '0' report "T12: should not yet have mac";
|
assert arp_req_rslt.got_err = '0' report "T11: should not have got err";
|
assert arp_req_rslt.got_err = '0' report "T12: should not have got err";
|
|
|
arp_req_req.lookup_req <= '0';
|
arp_req_req.lookup_req <= '0';
|
wait for clk_period*20;
|
wait for clk_period*20;
|
|
|
|
|
assert mac_tx_req = '1' report "T11: should be requesting TX channel";
|
assert mac_tx_req = '1' report "T12: should be requesting TX channel";
|
wait for clk_period*50;
|
wait for clk_period*50;
|
-- Send the reply
|
-- Send the reply
|
data_out_ready <= '1';
|
data_out_ready <= '1';
|
|
|
data_in_valid <= '1';
|
data_in_valid <= '1';
|
Line 942... |
Line 970... |
data_in_last <= '1';
|
data_in_last <= '1';
|
data_in <= x"00"; wait for clk_period;
|
data_in <= x"00"; wait for clk_period;
|
data_in_last <= '0';
|
data_in_last <= '0';
|
data_in_valid <= '0';
|
data_in_valid <= '0';
|
wait for clk_period;
|
wait for clk_period;
|
assert arp_req_rslt.got_mac = '1' report "T11: should have got mac";
|
assert arp_req_rslt.got_mac = '1' report "T12: should have got mac";
|
assert arp_req_rslt.mac = x"021503235554" report "T11: incorrect mac";
|
assert arp_req_rslt.mac = x"021503235554" report "T12: incorrect mac";
|
assert arp_req_rslt.got_err = '0' report "T11: should not have got err";
|
assert arp_req_rslt.got_err = '0' report "T12: should not have got err";
|
|
wait for clk_period*10;
|
|
|
|
--
|
|
report "T13 - Send a request for the IP that is not on the local network";
|
|
arp_req_req.ip <= x"0a000003";
|
|
arp_req_req.lookup_req <= '1';
|
|
wait for clk_period;
|
|
arp_req_req.lookup_req <= '0';
|
|
report "T13: waiting for data_out_valid";
|
|
wait until data_out_valid = '1';
|
|
report "T13: got data_out_valid";
|
|
wait for clk_period*10;
|
|
data_out_ready <= '0';
|
|
wait for clk_period*2;
|
|
data_out_ready <= '1';
|
|
wait for clk_period*12;
|
|
assert data_out = x"01" report "T13: expected opcode = 01 for request 'who has'";
|
|
-- expect our mac 00 23 20 21 22 23
|
|
wait for clk_period;
|
|
assert data_out = x"00" report "T13: incorrect our mac.0";
|
|
wait for clk_period;
|
|
assert data_out = x"23" report "T13: incorrect our mac.1";
|
|
wait for clk_period;
|
|
assert data_out = x"20" report "T13: incorrect our mac.2";
|
|
wait for clk_period;
|
|
assert data_out = x"21" report "T13: incorrect our mac.3";
|
|
wait for clk_period;
|
|
assert data_out = x"22" report "T13: incorrect our mac.4";
|
|
wait for clk_period;
|
|
assert data_out = x"23" report "T13: incorrect our mac.5";
|
|
-- expect our IP c0 a8 05 05
|
|
wait for clk_period;
|
|
assert data_out = x"c0" report "T13: incorrect our IP.0";
|
|
wait for clk_period;
|
|
assert data_out = x"a8" report "T13: incorrect our IP.1";
|
|
wait for clk_period;
|
|
assert data_out = x"05" report "T13: incorrect our IP.2";
|
|
wait for clk_period;
|
|
assert data_out = x"09" report "T13: incorrect our IP.3";
|
|
|
|
-- expect empty target mac
|
|
wait for clk_period;
|
|
assert data_out = x"ff" report "T13: incorrect target mac.0";
|
|
wait for clk_period;
|
|
assert data_out = x"ff" report "T13: incorrect target mac.1";
|
|
wait for clk_period;
|
|
assert data_out = x"ff" report "T13: incorrect target mac.2";
|
|
wait for clk_period;
|
|
assert data_out = x"ff" report "T13: incorrect target mac.3";
|
|
wait for clk_period;
|
|
assert data_out = x"ff" report "T13: incorrect target mac.4";
|
|
wait for clk_period;
|
|
assert data_out = x"ff" report "T13: incorrect target mac.5";
|
|
-- expect target IP c0 a8 05 01
|
|
wait for clk_period;
|
|
assert data_out = x"c0" report "T13: incorrect target IP.0";
|
|
wait for clk_period;
|
|
assert data_out = x"a8" report "T13: incorrect target IP.1";
|
|
wait for clk_period;
|
|
assert data_out = x"05" report "T13: incorrect target IP.2";
|
|
assert data_out_last = '0' report "T13: data out last incorrectly set on target IP.2 byte";
|
|
wait for clk_period;
|
|
assert data_out = x"01" report "T13: incorrect target IP.3";
|
|
assert data_out_last = '1' report "T13: data out last should be set";
|
|
|
wait for clk_period*10;
|
wait for clk_period*10;
|
|
|
|
-- Send the reply
|
|
data_out_ready <= '1';
|
|
|
|
report "T13.2: Send an ARP reply: 192.168.5.1 has mac 02:12:03:23:04:54";
|
|
data_in_valid <= '1';
|
|
-- dst MAC (bc)
|
|
data_in <= x"ff"; wait for clk_period;
|
|
data_in <= x"ff"; wait for clk_period;
|
|
data_in <= x"ff"; wait for clk_period;
|
|
data_in <= x"ff"; wait for clk_period;
|
|
data_in <= x"ff"; wait for clk_period;
|
|
data_in <= x"ff"; wait for clk_period;
|
|
-- src MAC
|
|
data_in <= x"02"; wait for clk_period;
|
|
data_in <= x"12"; wait for clk_period;
|
|
data_in <= x"03"; wait for clk_period;
|
|
data_in <= x"23"; wait for clk_period;
|
|
data_in <= x"04"; wait for clk_period;
|
|
data_in <= x"54"; wait for clk_period;
|
|
-- type
|
|
data_in <= x"08"; wait for clk_period;
|
|
data_in <= x"06"; wait for clk_period;
|
|
-- HW type
|
|
data_in <= x"00"; wait for clk_period;
|
|
data_in <= x"01"; wait for clk_period;
|
|
-- Protocol type
|
|
data_in <= x"08"; wait for clk_period;
|
|
data_in <= x"00"; wait for clk_period;
|
|
-- HW size
|
|
data_in <= x"06"; wait for clk_period;
|
|
-- protocol size
|
|
data_in <= x"04"; wait for clk_period;
|
|
-- Opcode
|
|
data_in <= x"00"; wait for clk_period;
|
|
data_in <= x"02"; wait for clk_period;
|
|
-- Sender MAC
|
|
data_in <= x"02"; wait for clk_period;
|
|
data_in <= x"12"; wait for clk_period;
|
|
data_in <= x"03"; wait for clk_period;
|
|
data_in <= x"23"; wait for clk_period;
|
|
data_in <= x"04"; wait for clk_period;
|
|
data_in <= x"54"; wait for clk_period;
|
|
-- Sender IP
|
|
data_in <= x"c0"; wait for clk_period;
|
|
data_in <= x"a8"; wait for clk_period;
|
|
data_in <= x"05"; wait for clk_period;
|
|
data_in <= x"01"; wait for clk_period;
|
|
-- Target MAC
|
|
data_in <= x"00"; wait for clk_period;
|
|
data_in <= x"23"; wait for clk_period;
|
|
data_in <= x"20"; wait for clk_period;
|
|
data_in <= x"21"; wait for clk_period;
|
|
data_in <= x"22"; wait for clk_period;
|
|
data_in <= x"23"; wait for clk_period;
|
|
-- Target IP
|
|
data_in <= x"c0"; wait for clk_period;
|
|
data_in <= x"a8"; wait for clk_period;
|
|
data_in <= x"05"; wait for clk_period;
|
|
data_in <= x"09"; wait for clk_period;
|
|
data_in <= x"00"; wait for clk_period;
|
|
data_in <= x"00"; wait for clk_period;
|
|
assert arp_req_rslt.got_mac = '1' report "T13.2: expected got mac";
|
|
assert arp_req_rslt.got_err = '0' report "T13.2: expected got err = 0";
|
|
assert arp_req_rslt.mac = x"021203230454" report "T13.2: wrong mac value";
|
|
data_in <= x"00"; wait for clk_period;
|
|
data_in_last <= '1';
|
|
data_in <= x"00"; wait for clk_period;
|
|
data_in_last <= '0';
|
|
data_in_valid <= '0';
|
|
wait for clk_period*4;
|
|
|
|
report "T14 - Send a request for an other IP that is not on the local network";
|
|
arp_req_req.ip <= x"0a000204";
|
|
arp_req_req.lookup_req <= '1';
|
|
wait for clk_period;
|
|
arp_req_req.lookup_req <= '0';
|
|
report "T14: reply should be from cache";
|
|
-- wait until arp_req_rslt.got_mac = '1' or arp_req_rslt.got_err = '1';
|
|
assert arp_req_rslt.got_mac = '1' report "T14: expected got mac";
|
|
assert arp_req_rslt.got_err = '0' report "T14: expected got err = 0";
|
|
assert arp_req_rslt.mac = x"021203230454" report "T14: wrong mac value";
|
|
wait for clk_period*2;
|
|
--
|
|
|
|
|
report "--- end of tests ---";
|
report "--- end of tests ---";
|
wait;
|
wait;
|
end process;
|
end process;
|
|
|
END;
|
end;
|
|
|
No newline at end of file
|
No newline at end of file
|