Line 17... |
Line 17... |
-- Revision 0.01 - File Created - refactored this arp_tx module from the complete arp v0.02 module
|
-- Revision 0.01 - File Created - refactored this arp_tx module from the complete arp v0.02 module
|
-- Additional Comments:
|
-- Additional Comments:
|
--
|
--
|
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
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 arp_tx is
|
entity arp_tx is
|
Port (
|
port (
|
-- control signals
|
-- control signals
|
send_I_have : in std_logic; -- pulse will be latched
|
send_I_have : in std_logic; -- pulse will be latched
|
arp_entry : in arp_entry_t; -- arp target for I_have req (will be latched)
|
arp_entry : in arp_entry_t; -- arp target for I_have req (will be latched)
|
send_who_has : in std_logic; -- pulse will be latched
|
send_who_has : in std_logic; -- pulse will be latched
|
ip_entry : in STD_LOGIC_VECTOR (31 downto 0); -- IP target for who_has req (will be latched)
|
ip_entry : in std_logic_vector (31 downto 0); -- IP target for who_has req (will be latched)
|
-- 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_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);
|
tx_clk : in std_logic;
|
tx_clk : in std_logic;
|
reset : in std_logic
|
reset : in std_logic
|
);
|
);
|
end arp_tx;
|
end arp_tx;
|
|
|
Line 106... |
Line 106... |
if data_out_ready = '1' and kill_data_out_valid = '0' then
|
if data_out_ready = '1' and kill_data_out_valid = '0' then
|
data_out_valid <= '1';
|
data_out_valid <= '1';
|
else
|
else
|
data_out_valid <= '0';
|
data_out_valid <= '0';
|
end if;
|
end if;
|
when OTHERS => data_out_valid <= '0';
|
when others => data_out_valid <= '0';
|
end case;
|
end case;
|
|
|
-- set bus defaults
|
-- set bus defaults
|
next_tx_state <= IDLE;
|
next_tx_state <= IDLE;
|
tx_mode_val <= REPLY;
|
tx_mode_val <= REPLY;
|
target_val.ip <= (others => '0');
|
target_val.ip <= (others => '0');
|
target_val.mac <= (others => '0');
|
target_val.mac <= (others => '1');
|
|
|
-- set signal defaults
|
-- set signal defaults
|
set_tx_state <= '0';
|
set_tx_state <= '0';
|
tx_count_mode <= HOLD;
|
tx_count_mode <= HOLD;
|
data_out <= x"00";
|
data_out <= x"00";
|
Line 153... |
Line 153... |
elsif send_who_has_reg = '1' then
|
elsif send_who_has_reg = '1' then
|
set_chn_reqd <= SET;
|
set_chn_reqd <= SET;
|
tx_mode_val <= REQUEST;
|
tx_mode_val <= REQUEST;
|
set_tx_mode <= '1';
|
set_tx_mode <= '1';
|
target_val.ip <= who_has_target;
|
target_val.ip <= who_has_target;
|
target_val.mac <= (others => '0');
|
target_val.mac <= (others => '1');
|
set_target <= '1';
|
set_target <= '1';
|
set_send_who_has <= CLR;
|
set_send_who_has <= CLR;
|
next_tx_state <= WAIT_MAC;
|
next_tx_state <= WAIT_MAC;
|
set_tx_state <= '1';
|
set_tx_state <= '1';
|
else
|
else
|
Line 175... |
Line 175... |
when SEND =>
|
when SEND =>
|
if data_out_ready = '1' then
|
if data_out_ready = '1' then
|
tx_count_mode <= INCR;
|
tx_count_mode <= INCR;
|
end if;
|
end if;
|
case tx_count is
|
case tx_count is
|
when x"00" =>
|
when x"00" => data_out_first <= data_out_ready;
|
data_out_first <= data_out_ready;
|
data_out <= target.mac (47 downto 40); -- target mac--data_out <= x"ff"; -- dst = broadcast
|
data_out <= x"ff"; -- dst = broadcast
|
when x"01" => data_out <= target.mac (39 downto 32); --data_out <= x"ff";
|
|
when x"02" => data_out <= target.mac (31 downto 24); --data_out <= x"ff";
|
when x"01" => data_out <= x"ff";
|
when x"03" => data_out <= target.mac (23 downto 16); --data_out <= x"ff";
|
when x"02" => data_out <= x"ff";
|
when x"04" => data_out <= target.mac (15 downto 8); --data_out <= x"ff";
|
when x"03" => data_out <= x"ff";
|
when x"05" => data_out <= target.mac (7 downto 0); --data_out <= x"ff";
|
when x"04" => data_out <= x"ff";
|
|
when x"05" => data_out <= x"ff";
|
|
when x"06" => data_out <= our_mac_address (47 downto 40); -- src = our mac
|
when x"06" => data_out <= our_mac_address (47 downto 40); -- src = our mac
|
when x"07" => data_out <= our_mac_address (39 downto 32);
|
when x"07" => data_out <= our_mac_address (39 downto 32);
|
when x"08" => data_out <= our_mac_address (31 downto 24);
|
when x"08" => data_out <= our_mac_address (31 downto 24);
|
when x"09" => data_out <= our_mac_address (23 downto 16);
|
when x"09" => data_out <= our_mac_address (23 downto 16);
|
when x"0a" => data_out <= our_mac_address (15 downto 8);
|
when x"0a" => data_out <= our_mac_address (15 downto 8);
|
Line 257... |
Line 255... |
send_who_has_reg <= '0';
|
send_who_has_reg <= '0';
|
who_has_target <= (others => '0');
|
who_has_target <= (others => '0');
|
I_have_target.ip <= (others => '0');
|
I_have_target.ip <= (others => '0');
|
I_have_target.mac <= (others => '0');
|
I_have_target.mac <= (others => '0');
|
target.ip <= (others => '0');
|
target.ip <= (others => '0');
|
target.mac <= (others => '0');
|
target.mac <= (others => '1');
|
|
|
else
|
else
|
-- normal (non reset) processing
|
-- normal (non reset) processing
|
|
|
-- Next tx_state processing
|
-- Next tx_state processing
|