Compare commits
No commits in common. "3240f363baf412617c0118292abd98df91a0cbb1" and "651b6bb11e07eeeae43f1050c87ab6ca9241bca3" have entirely different histories.
3240f363ba
...
651b6bb11e
@ -215,13 +215,9 @@ architecture eth of top_hwitl is
|
|||||||
signal arp_in : arp_in_t;
|
signal arp_in : arp_in_t;
|
||||||
begin
|
begin
|
||||||
trashernet_arp_inst : entity trashernet.trashernet_arp
|
trashernet_arp_inst : entity trashernet.trashernet_arp
|
||||||
generic map(
|
|
||||||
TIMEOUT_TICK_FREQ => F_CLK
|
|
||||||
)
|
|
||||||
port map(
|
port map(
|
||||||
clk => clk,
|
clk => clk,
|
||||||
rst => rst,
|
rst => rst,
|
||||||
timeout_tick => '1',
|
|
||||||
mac_config => ETH_CONFIG,
|
mac_config => ETH_CONFIG,
|
||||||
ip_config => IP_CONFIG,
|
ip_config => IP_CONFIG,
|
||||||
arp_out => arp_out,
|
arp_out => arp_out,
|
||||||
|
@ -16,14 +16,10 @@ use ieee.numeric_std.all;
|
|||||||
use work.trashernet_pkg.all;
|
use work.trashernet_pkg.all;
|
||||||
|
|
||||||
entity trashernet_arp is
|
entity trashernet_arp is
|
||||||
generic(
|
|
||||||
TIMEOUT_TICK_FREQ : integer
|
|
||||||
);
|
|
||||||
port(
|
port(
|
||||||
-- Global
|
-- Global
|
||||||
clk : in std_logic; -- Global clock
|
clk : in std_logic; -- Global clock
|
||||||
rst : in std_logic; -- Asynchronous reset
|
rst : in std_logic; -- Asynchronous reset
|
||||||
timeout_tick : in std_logic; -- Global timeout tick strobe
|
|
||||||
|
|
||||||
-- Configuration
|
-- Configuration
|
||||||
mac_config : in configuration_t; -- Trashernet MAC configuration
|
mac_config : in configuration_t; -- Trashernet MAC configuration
|
||||||
@ -47,8 +43,6 @@ architecture rtl of trashernet_arp is
|
|||||||
constant OPER_REQUEST : byte_vector := (x"00", x"01");
|
constant OPER_REQUEST : byte_vector := (x"00", x"01");
|
||||||
constant OPER_REPLY : byte_vector := (x"00", x"02");
|
constant OPER_REPLY : byte_vector := (x"00", x"02");
|
||||||
|
|
||||||
constant ARP_TIMEOUT : time := 1 sec;
|
|
||||||
|
|
||||||
signal arp_tx_reply_rq : std_logic; -- Request to transmit an ARP reply
|
signal arp_tx_reply_rq : std_logic; -- Request to transmit an ARP reply
|
||||||
signal arp_tx_reply_tha : mac_addr_t; -- Target MAC to use in reply (SHA in received packet)
|
signal arp_tx_reply_tha : mac_addr_t; -- Target MAC to use in reply (SHA in received packet)
|
||||||
signal arp_tx_reply_tpa : ip_addr_t; -- Target IP to use in reply (SPA in received packet)
|
signal arp_tx_reply_tpa : ip_addr_t; -- Target IP to use in reply (SPA in received packet)
|
||||||
@ -61,7 +55,6 @@ architecture rtl of trashernet_arp is
|
|||||||
signal arp_rx_reply_stb : std_logic; -- An ARP reply was received (strobe)
|
signal arp_rx_reply_stb : std_logic; -- An ARP reply was received (strobe)
|
||||||
signal arp_rx_sha : mac_addr_t; -- The MAC address of the reply sender, valid with arp_rx_reply
|
signal arp_rx_sha : mac_addr_t; -- The MAC address of the reply sender, valid with arp_rx_reply
|
||||||
signal arp_rx_spa : ip_addr_t; -- The IP address of the reply sender, valid with arp_rx_reply
|
signal arp_rx_spa : ip_addr_t; -- The IP address of the reply sender, valid with arp_rx_reply
|
||||||
|
|
||||||
begin
|
begin
|
||||||
resolver : block
|
resolver : block
|
||||||
type resolver_state_t is (IDLE, QUERY_MAC);
|
type resolver_state_t is (IDLE, QUERY_MAC);
|
||||||
@ -118,25 +111,8 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
end process arp_resolver_main;
|
end process arp_resolver_main;
|
||||||
query_mac_found <= '1' when (arp_tx_request_tpa = replied_ip) else '0';
|
query_mac_found <= '1' when (arp_tx_request_tpa = replied_ip) else '0';
|
||||||
|
|
||||||
arp_out.arp_mac <= replied_mac;
|
arp_out.arp_mac <= replied_mac;
|
||||||
arp_tx_request_tpa <= arp_in.arp_ip;
|
arp_tx_request_tpa <= arp_in.arp_ip;
|
||||||
|
|
||||||
timeout_timer_inst : entity work.timer
|
|
||||||
generic map(
|
|
||||||
F_TICK => TIMEOUT_TICK_FREQ,
|
|
||||||
DURATION => ARP_TIMEOUT,
|
|
||||||
AUTOSTART => false
|
|
||||||
)
|
|
||||||
port map(
|
|
||||||
clk => clk,
|
|
||||||
rst => rst,
|
|
||||||
tick => timeout_tick,
|
|
||||||
start => arp_tx_request_rq,
|
|
||||||
expired => query_timeout,
|
|
||||||
expired_stb => open
|
|
||||||
);
|
|
||||||
|
|
||||||
end block resolver;
|
end block resolver;
|
||||||
|
|
||||||
rx : block
|
rx : block
|
||||||
|
Loading…
Reference in New Issue
Block a user