Line 59... |
Line 59... |
-- 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
|
mac_data_out_ready : in std_logic; -- indicates system ready to consume data
|
mac_data_out_ready : in std_logic; -- indicates system ready to consume data
|
mac_data_out_valid : out std_logic; -- indicates data out is valid
|
mac_data_out_valid : out std_logic; -- indicates data out is valid
|
|
mac_data_out_first : out std_logic; -- with data out valid indicates the first byte of a frame
|
mac_data_out_last : out std_logic; -- with data out valid indicates the last byte of a frame
|
mac_data_out_last : out std_logic; -- with data out valid indicates the last byte of a frame
|
mac_data_out : out std_logic_vector (7 downto 0) -- ethernet frame (from dst mac addr through to last byte of frame)
|
mac_data_out : out std_logic_vector (7 downto 0) -- ethernet frame (from dst mac addr through to last byte of frame)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
Line 82... |
Line 83... |
signal ip_tx_result : std_logic_vector (1 downto 0); -- tx status (changes during transmission)
|
signal ip_tx_result : std_logic_vector (1 downto 0); -- tx status (changes during transmission)
|
signal ip_tx_data_out_ready : std_logic; -- indicates IP TX is ready to take data
|
signal ip_tx_data_out_ready : std_logic; -- indicates IP TX is ready to take data
|
signal mac_tx_req : std_logic;
|
signal mac_tx_req : std_logic;
|
signal mac_data_out_valid : std_logic;
|
signal mac_data_out_valid : std_logic;
|
signal mac_data_out_last : std_logic;
|
signal mac_data_out_last : std_logic;
|
|
signal mac_data_out_first : std_logic;
|
signal mac_data_out : std_logic_vector(7 downto 0);
|
signal mac_data_out : std_logic_vector(7 downto 0);
|
signal arp_req_req : arp_req_req_type;
|
signal arp_req_req : arp_req_req_type;
|
|
|
-- Clock period definitions
|
-- Clock period definitions
|
constant clk_period : time := 8 ns;
|
constant clk_period : time := 8 ns;
|
Line 106... |
Line 108... |
arp_req_rslt => arp_req_rslt,
|
arp_req_rslt => arp_req_rslt,
|
mac_tx_req => mac_tx_req,
|
mac_tx_req => mac_tx_req,
|
mac_tx_granted => mac_tx_granted,
|
mac_tx_granted => mac_tx_granted,
|
mac_data_out_ready => mac_data_out_ready,
|
mac_data_out_ready => mac_data_out_ready,
|
mac_data_out_valid => mac_data_out_valid,
|
mac_data_out_valid => mac_data_out_valid,
|
|
mac_data_out_first => mac_data_out_first,
|
mac_data_out_last => mac_data_out_last,
|
mac_data_out_last => mac_data_out_last,
|
mac_data_out => mac_data_out
|
mac_data_out => mac_data_out
|
);
|
);
|
|
|
-- Clock process definitions
|
-- Clock process definitions
|
Line 123... |
Line 126... |
|
|
|
|
-- Stimulus process
|
-- Stimulus process
|
stim_proc: process
|
stim_proc: process
|
begin
|
begin
|
-- hold reset state 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
|
our_mac_address <= x"002320212223";
|
our_mac_address <= x"002320212223";
|
ip_tx_start <= '0';
|
ip_tx_start <= '0';
|
mac_tx_granted <= '0';
|
mac_tx_granted <= '0';
|
mac_data_out_ready <= '0';
|
mac_data_out_ready <= '0';
|
ip_tx.data.data_out_valid <= '0';
|
ip_tx.data.data_out_valid <= '0';
|
ip_tx.data.data_out_last <= '0';
|
ip_tx.data.data_out_last <= '0';
|
|
arp_req_rslt.got_mac <= '0';
|
|
arp_req_rslt.got_err <= '0';
|
|
arp_req_rslt.mac <= (others => '0');
|
|
|
reset <= '1';
|
reset <= '1';
|
wait for clk_period*10;
|
wait for clk_period*10;
|
reset <= '0';
|
reset <= '0';
|
wait for clk_period*5;
|
wait for clk_period*5;
|
Line 162... |
Line 165... |
ip_tx.hdr.dst_ip_addr <= x"c0123478";
|
ip_tx.hdr.dst_ip_addr <= x"c0123478";
|
ip_tx_start <= '1';
|
ip_tx_start <= '1';
|
wait for clk_period;
|
wait for clk_period;
|
ip_tx_start <= '0'; wait for clk_period;
|
ip_tx_start <= '0'; wait for clk_period;
|
arp_req_rslt.got_mac <= '0';
|
arp_req_rslt.got_mac <= '0';
|
|
arp_req_rslt.got_err <= '0';
|
|
|
assert arp_req_req.lookup_req = '1' report "T1: lookup_req not set on tx start";
|
assert arp_req_req.lookup_req = '1' report "T1: lookup_req not set on tx start";
|
assert ip_tx_result = IPTX_RESULT_SENDING report "T1: result should be IPTX_RESULT_SENDING";
|
assert ip_tx_result = IPTX_RESULT_SENDING report "T1: result should be IPTX_RESULT_SENDING";
|
|
|
wait for clk_period*10; -- simulate arp lookup time
|
wait for clk_period*10; -- simulate arp lookup time
|