From 077cf5cbfa4d8cf1e9073a075531396ba2f298b9 Mon Sep 17 00:00:00 2001 From: Simon Southwell Date: Tue, 22 Dec 2020 08:52:54 +0000 Subject: [PATCH] ELGIP-129 Adding configuration to tests to filter on destination IP addr, protocol ID and TCP port. Found and fixed various bugs in the RX packet split block. --- .../xgbe_oe/0/src/rx_packet_filter_0.vhd | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/generic_ip/xgbe_oe/0/src/rx_packet_filter_0.vhd b/generic_ip/xgbe_oe/0/src/rx_packet_filter_0.vhd index e8e96a1..04c8625 100644 --- a/generic_ip/xgbe_oe/0/src/rx_packet_filter_0.vhd +++ b/generic_ip/xgbe_oe/0/src/rx_packet_filter_0.vhd @@ -51,8 +51,10 @@ architecture rtl of rx_packet_filter_0 is ----------------------------------------------------------------------------- signal cfg_filt_wr, cfg_mask_wr : std_logic; - signal check_completed, last_address : std_logic; - signal checksum_ok, completed_flag : std_logic; + signal last_address : std_logic; + signal check_completed : std_logic; + signal checksum_ok : std_logic; + signal completed_flag : std_logic; signal rx_data_valid_d : std_logic; signal filt_addr : std_logic_vector( 3 downto 0); signal rx_data_i, rx_data_masked : std_logic_vector(63 downto 0); @@ -95,7 +97,7 @@ begin begin if(clk = '1' and clk'event) then rx_data_valid_d <= rx_data_valid; - check_completed <= (end_of_packet or last_address) and not completed_flag; + check_completed <= last_address and not completed_flag and not end_of_packet; if(init = '1' or end_of_packet = '1') then filt_addr <= (others => '0'); elsif(rx_data_valid = '1' and (completed_flag = '0')) then @@ -106,14 +108,18 @@ begin elsif(check_completed = '1') then completed_flag <= '1'; end if; - if(check_completed = '1') then + + if(check_completed = '1' or (end_of_packet = '1' and completed_flag = '0')) then completed <= '1'; else completed <= '0'; end if; - if(init = '1' or start_of_packet = '1') then + + if unsigned(filt_len) = 0 then + filter_match <= '1'; + elsif(init = '1' or start_of_packet = '1') then filter_match <= '0'; - elsif(check_completed = '1') then + elsif(check_completed = '1' or end_of_packet = '1') then filter_match <= checksum_ok; end if; if(init = '1' or start_of_packet = '1') then @@ -129,6 +135,6 @@ begin rx_data_masked <= rx_data_i and mask_out; - last_address <= '1' when unsigned(filt_addr) = unsigned(filt_len) or unsigned(filt_addr) = 31 else '0'; + last_address <= '1' when (unsigned(filt_addr) = unsigned(filt_len) and unsigned(filt_len) /= 0) or unsigned(filt_addr) = 31 else '0'; end architecture rtl;