ipv4: Only forward rx_ok/error strobes when addressed

This commit is contained in:
Markus Koch 2025-09-30 16:12:52 +02:00
parent f13e9bf907
commit 6e616c5f35

View File

@ -59,6 +59,7 @@ begin
alias sr_destination_ip is sr(16 to 19); alias sr_destination_ip is sr(16 to 19);
signal header_ok : std_logic; signal header_ok : std_logic;
signal selected : std_logic;
signal bytecount : integer range 0 to 65535; signal bytecount : integer range 0 to 65535;
signal block_done : std_logic; signal block_done : std_logic;
@ -82,16 +83,13 @@ begin
ipv4_out.rx_error_stb <= '0'; ipv4_out.rx_error_stb <= '0';
ipv4_out.rx_header_rcv <= '0'; ipv4_out.rx_header_rcv <= '0';
bytecount <= BYTECOUNT_HEADER; bytecount <= BYTECOUNT_HEADER;
selected <= '0';
elsif rising_edge(clk) then elsif rising_edge(clk) then
ipv4_out.rx_ok_stb <= '0'; ipv4_out.rx_ok_stb <= '0';
ipv4_out.rx_error_stb <= '0'; ipv4_out.rx_error_stb <= '0';
ipv4_out.rx_header_rcv <= '0'; ipv4_out.rx_header_rcv <= '0';
if (ethernet_ii_out.rx_crc_ok or ethernet_ii_out.rx_crc_error) then
ipv4_out.rx_error_stb <= ethernet_ii_out.rx_crc_error or to_std_logic(state = PAYLOAD);
ipv4_out.rx_ok_stb <= ethernet_ii_out.rx_crc_ok and to_std_logic(state = DONE);
end if;
if (ethernet_ii_out.rx_data_valid = '1') and (bytecount > 0) then if (ethernet_ii_out.rx_data_valid = '1') and (bytecount > 0) then
if state = HEADER then if state = HEADER then
sr <= sr(sr'low + 1 to sr'high) & ethernet_ii_out.rx_data; sr <= sr(sr'low + 1 to sr'high) & ethernet_ii_out.rx_data;
@ -105,6 +103,7 @@ begin
bytecount <= to_integer(unsigned(sr_ihl) - 5) * 4; -- five 32-bit words is the header itself bytecount <= to_integer(unsigned(sr_ihl) - 5) * 4; -- five 32-bit words is the header itself
if header_ok then if header_ok then
state <= OPT; state <= OPT;
selected <= '1';
ipv4_out.rx_header_rcv <= '1'; ipv4_out.rx_header_rcv <= '1';
else else
state <= DONE; state <= DONE;
@ -125,9 +124,14 @@ begin
when DONE => -- @suppress "Dead state 'DONE'": Outgoing state transition is outside of case statement when DONE => -- @suppress "Dead state 'DONE'": Outgoing state transition is outside of case statement
null; -- We just wait here until the MAC gives us a CRC OK/error null; -- We just wait here until the MAC gives us a CRC OK/error
end case; end case;
if selected and (ethernet_ii_out.rx_crc_ok or ethernet_ii_out.rx_crc_error) then
ipv4_out.rx_error_stb <= ethernet_ii_out.rx_crc_error or to_std_logic(state = PAYLOAD);
ipv4_out.rx_ok_stb <= ethernet_ii_out.rx_crc_ok and to_std_logic(state = DONE);
end if;
if (ethernet_ii_out.rx_header_rcv) then if (ethernet_ii_out.rx_header_rcv) then
state <= HEADER; state <= HEADER;
bytecount <= BYTECOUNT_HEADER; bytecount <= BYTECOUNT_HEADER;
selected <= '0';
end if; end if;
end if; end if;
end process rx_fsm; end process rx_fsm;