parent
9f0f8c2775
commit
f62a464e7e
@ -194,6 +194,12 @@ begin
|
|||||||
if ipv4_in.tx_en then
|
if ipv4_in.tx_en then
|
||||||
arp_in.arp_query_stb <= '1';
|
arp_in.arp_query_stb <= '1';
|
||||||
state <= ARP;
|
state <= ARP;
|
||||||
|
|
||||||
|
if or((to_std_logic_vector(ipv4_config.gateway) xor to_std_logic_vector(arp_in.arp_ip)) and to_std_logic_vector(ipv4_config.subnet_mask)) then
|
||||||
|
arp_in.arp_ip <= ipv4_config.gateway;
|
||||||
|
else
|
||||||
|
arp_in.arp_ip <= ipv4_in.tx_ip_address;
|
||||||
|
end if;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
when ARP =>
|
when ARP =>
|
||||||
@ -244,9 +250,6 @@ begin
|
|||||||
|
|
||||||
ethernet_ii_in.tx_data <= sr(sr'low);
|
ethernet_ii_in.tx_data <= sr(sr'low);
|
||||||
ethernet_ii_in.tx_en <= '1' when (state = HEADER) or (state = PAYLOAD) else '0';
|
ethernet_ii_in.tx_en <= '1' when (state = HEADER) or (state = PAYLOAD) else '0';
|
||||||
|
|
||||||
arp_in.arp_ip <= ipv4_in.tx_ip_address;
|
|
||||||
|
|
||||||
end block tx;
|
end block tx;
|
||||||
|
|
||||||
end architecture rtl;
|
end architecture rtl;
|
||||||
|
@ -32,6 +32,7 @@ package trashernet_pkg is
|
|||||||
-- IP specific types
|
-- IP specific types
|
||||||
subtype ip_addr_t is byte_vector(0 to 3);
|
subtype ip_addr_t is byte_vector(0 to 3);
|
||||||
function ip_to_string(constant ip_address : in ip_addr_t) return string;
|
function ip_to_string(constant ip_address : in ip_addr_t) return string;
|
||||||
|
function to_std_logic_vector(ip_address : ip_addr_t) return std_logic_vector;
|
||||||
|
|
||||||
-- Configuration interface
|
-- Configuration interface
|
||||||
type configuration_t is record
|
type configuration_t is record
|
||||||
@ -262,6 +263,11 @@ package body trashernet_pkg is
|
|||||||
;
|
;
|
||||||
end function ip_to_string;
|
end function ip_to_string;
|
||||||
|
|
||||||
|
function to_std_logic_vector(ip_address : ip_addr_t) return std_logic_vector is
|
||||||
|
begin
|
||||||
|
return ip_address(0) & ip_address(1) & ip_address(2) & ip_address(3);
|
||||||
|
end function to_std_logic_vector;
|
||||||
|
|
||||||
function to_std_logic(constant bool : boolean) return std_logic is
|
function to_std_logic(constant bool : boolean) return std_logic is
|
||||||
variable ret : std_logic;
|
variable ret : std_logic;
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user