From 9418b142ad77e492a677d0be305f335c54efdd81 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 10 Aug 2016 12:52:19 +0200 Subject: [PATCH] killer ping added --- gbe_trb/base/gbe_logic_wrapper.vhd | 5 + gbe_trb/base/gbe_wrapper.vhd | 164 ++++++++++++++++++ gbe_trb/base/trb_net16_gbe_ipu_interface.vhd | 2 +- gbe_trb/base/trb_net16_gbe_main_control.vhd | 6 +- .../base/trb_net16_gbe_protocol_selector.vhd | 7 +- gbe_trb/base/trb_net_gbe_protocols.vhd | 50 ++++++ gbe_trb/testbenches/aa_full_wrapper_tb.vhd | 3 +- 7 files changed, 233 insertions(+), 4 deletions(-) diff --git a/gbe_trb/base/gbe_logic_wrapper.vhd b/gbe_trb/base/gbe_logic_wrapper.vhd index 8740881..54acc54 100644 --- a/gbe_trb/base/gbe_logic_wrapper.vhd +++ b/gbe_trb/base/gbe_logic_wrapper.vhd @@ -40,6 +40,8 @@ entity gbe_logic_wrapper is GSR_N : in std_logic; MY_MAC_IN : in std_logic_vector(47 downto 0); DHCP_DONE_OUT : out std_logic; + MY_TRBNET_ADDRESS_IN : in std_logic_vector(15 downto 0); + ISSUE_REBOOT_OUT : out std_logic; -- connection to MAC MAC_READY_CONF_IN : in std_logic; @@ -287,6 +289,8 @@ begin MC_IDLE_TOO_LONG_OUT => open, MC_DHCP_DONE_OUT => dhcp_done, MC_MY_MAC_IN => MY_MAC_IN, + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => ISSUE_REBOOT_OUT, -- signals to/from receive controller RC_FRAME_WAITING_IN => rc_frame_ready, @@ -426,6 +430,7 @@ begin MC_IDLE_TOO_LONG_OUT => open, MC_DHCP_DONE_OUT => dhcp_done, MC_MY_MAC_IN => MY_MAC_IN, + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, -- signals to/from receive controller RC_FRAME_WAITING_IN => rc_frame_ready, diff --git a/gbe_trb/base/gbe_wrapper.vhd b/gbe_trb/base/gbe_wrapper.vhd index b240ff8..453b3dd 100644 --- a/gbe_trb/base/gbe_wrapper.vhd +++ b/gbe_trb/base/gbe_wrapper.vhd @@ -63,6 +63,8 @@ entity gbe_wrapper is FEE_STATUS_BITS_IN : in std_logic_vector(31 downto 0); FEE_BUSY_IN : in std_logic; -- SlowControl + MY_TRBNET_ADDRESS_IN : in std_logic_vector(15 downto 0); + ISSUE_REBOOT_OUT : out std_logic; MC_UNIQUE_ID_IN : in std_logic_vector(63 downto 0); GSC_CLK_IN : in std_logic; GSC_INIT_DATAREADY_OUT : out std_logic; @@ -190,6 +192,8 @@ architecture RTL of gbe_wrapper is signal cfg_autothrottle : std_logic; signal cfg_throttle_pause : std_logic_vector(15 downto 0); + + signal issue_reboot : std_logic_vector(3 downto 0); begin mac_impl_gen : if DO_SIMULATION = 0 generate @@ -209,6 +213,8 @@ begin all_links_ready <= '1' when dhcp_done = x"f" else '0'; MAKE_RESET_OUT <= '1' when make_reset3 = '1' or make_reset2 = '1' or make_reset1 = '1' or make_reset0 = '1' else '0'; + + ISSUE_REBOOT_OUT <= '0' when issue_reboot = "0000" else '1'; physical_impl_gen : if DO_SIMULATION = 0 generate physical : entity work.gbe_med_interface @@ -283,6 +289,8 @@ begin GSR_N => GSR_N, MY_MAC_IN => mac_3, DHCP_DONE_OUT => dhcp_done(3), + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => issue_reboot(3), MAC_READY_CONF_IN => mac_ready_conf(3), MAC_RECONF_OUT => mac_reconf(3), MAC_AN_READY_IN => mac_an_ready(3), @@ -404,6 +412,8 @@ begin GSR_N => GSR_N, MY_MAC_IN => mac_2, DHCP_DONE_OUT => dhcp_done(2), + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => issue_reboot(2), MAC_READY_CONF_IN => mac_ready_conf(2), MAC_RECONF_OUT => mac_reconf(2), MAC_AN_READY_IN => mac_an_ready(2), @@ -525,6 +535,8 @@ begin GSR_N => GSR_N, MY_MAC_IN => mac_1, DHCP_DONE_OUT => dhcp_done(1), + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => issue_reboot(1), MAC_READY_CONF_IN => mac_ready_conf(1), MAC_RECONF_OUT => mac_reconf(1), MAC_AN_READY_IN => mac_an_ready(1), @@ -646,6 +658,8 @@ begin GSR_N => GSR_N, MY_MAC_IN => mac_0, DHCP_DONE_OUT => dhcp_done(0), + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => issue_reboot(0), MAC_READY_CONF_IN => mac_ready_conf(0), MAC_RECONF_OUT => mac_reconf(0), MAC_AN_READY_IN => mac_an_ready(0), @@ -1423,6 +1437,156 @@ begin wait for 1 us; --trigger <= '1'; + + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_write(0) <= '1'; + -- dest mac + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + -- src mac + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"aa"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"bb"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"cc"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"dd"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ee"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + -- frame type + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"08"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + -- ip headers + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"45"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"10"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"5a"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"49"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"ff"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"cc"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"cc"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"c0"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"a8"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"c0"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"a8"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"02"; + -- ping headers + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"08"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"47"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"d3"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"0d"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"3c"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + -- ping data + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"8c"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"da"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"e7"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"4d"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"36"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"c4"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"0d"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"00"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"02"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"03"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"04"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"05"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"06"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"07"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"08"; + + -- ping data + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"e0"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"e0"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"e0"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"e0"; + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"01"; + + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_eof(0) <= '1'; + mac_rx_data(1 * 8 - 1 downto 0 * 8) <= x"aa"; + + wait until rising_edge(clk_125_rx_from_pcs(0)); + mac_rx_write(0) <='0'; + mac_rx_eof(0) <= '0'; wait; diff --git a/gbe_trb/base/trb_net16_gbe_ipu_interface.vhd b/gbe_trb/base/trb_net16_gbe_ipu_interface.vhd index 8cd09ef..7a3fdae 100644 --- a/gbe_trb/base/trb_net16_gbe_ipu_interface.vhd +++ b/gbe_trb/base/trb_net16_gbe_ipu_interface.vhd @@ -159,7 +159,7 @@ begin end if; when PRE_SAVE_DATA => - rec_state <= x"e"; + rec_state <= x"d"; if (size_check_ctr = 5) then save_next_state <= SAVE_PRE_DATA; else diff --git a/gbe_trb/base/trb_net16_gbe_main_control.vhd b/gbe_trb/base/trb_net16_gbe_main_control.vhd index e921303..279fab8 100644 --- a/gbe_trb/base/trb_net16_gbe_main_control.vhd +++ b/gbe_trb/base/trb_net16_gbe_main_control.vhd @@ -42,7 +42,8 @@ entity trb_net16_gbe_main_control is MC_IDLE_TOO_LONG_OUT : out std_logic; MC_DHCP_DONE_OUT : out std_logic; MC_MY_MAC_IN : in std_logic_vector(47 downto 0); - + MY_TRBNET_ADDRESS_IN : in std_logic_vector(15 downto 0); + ISSUE_REBOOT_OUT : out std_logic; -- signals to/from receive controller RC_FRAME_WAITING_IN : in std_logic; RC_LOADING_DONE_OUT : out std_logic; @@ -320,6 +321,9 @@ begin GSC_BUSY_IN => GSC_BUSY_IN, MAKE_RESET_OUT => MAKE_RESET_OUT, + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => ISSUE_REBOOT_OUT, + -- CTS interface CTS_NUMBER_IN => CTS_NUMBER_IN, CTS_CODE_IN => CTS_CODE_IN, diff --git a/gbe_trb/base/trb_net16_gbe_protocol_selector.vhd b/gbe_trb/base/trb_net16_gbe_protocol_selector.vhd index d740a72..8ade6b1 100644 --- a/gbe_trb/base/trb_net16_gbe_protocol_selector.vhd +++ b/gbe_trb/base/trb_net16_gbe_protocol_selector.vhd @@ -80,6 +80,9 @@ entity trb_net16_gbe_protocol_selector is GSC_BUSY_IN : in std_logic; MAKE_RESET_OUT : out std_logic; + MY_TRBNET_ADDRESS_IN : in std_logic_vector(15 downto 0); + ISSUE_REBOOT_OUT : out std_logic; + -- signal for data readout -- CTS interface CTS_NUMBER_IN : in std_logic_vector(15 downto 0); @@ -313,7 +316,7 @@ begin ping_gen : if INCLUDE_PING = '1' generate --protocol No. 3 Ping - Ping : trb_net16_gbe_response_constructor_Ping + Ping : entity work.trb_net16_gbe_response_constructor_KillPing generic map(STAT_ADDRESS_BASE => 3 ) port map( @@ -322,6 +325,8 @@ begin ---- INTERFACE MY_MAC_IN => MY_MAC_IN, + MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN, + ISSUE_REBOOT_OUT => ISSUE_REBOOT_OUT, MY_IP_IN => my_ip, PS_DATA_IN => PS_DATA_IN, PS_WR_EN_IN => PS_WR_EN_IN, diff --git a/gbe_trb/base/trb_net_gbe_protocols.vhd b/gbe_trb/base/trb_net_gbe_protocols.vhd index 4d47ca9..2193dfe 100644 --- a/gbe_trb/base/trb_net_gbe_protocols.vhd +++ b/gbe_trb/base/trb_net_gbe_protocols.vhd @@ -312,6 +312,56 @@ package trb_net_gbe_protocols is DEBUG_OUT : out std_logic_vector(63 downto 0) ); end component; + + component trb_net16_gbe_response_constructor_KillPing is + generic(STAT_ADDRESS_BASE : integer := 0 + ); + port( + CLK : in std_logic; -- system clock + RESET : in std_logic; + + -- INTERFACE + MY_MAC_IN : in std_logic_vector(47 downto 0); + MY_IP_IN : in std_logic_vector(31 downto 0); + PS_DATA_IN : in std_logic_vector(8 downto 0); + PS_WR_EN_IN : in std_logic; + PS_ACTIVATE_IN : in std_logic; + PS_RESPONSE_READY_OUT : out std_logic; + PS_BUSY_OUT : out std_logic; + PS_SELECTED_IN : in std_logic; + PS_SRC_MAC_ADDRESS_IN : in std_logic_vector(47 downto 0); + PS_DEST_MAC_ADDRESS_IN : in std_logic_vector(47 downto 0); + PS_SRC_IP_ADDRESS_IN : in std_logic_vector(31 downto 0); + PS_DEST_IP_ADDRESS_IN : in std_logic_vector(31 downto 0); + PS_SRC_UDP_PORT_IN : in std_logic_vector(15 downto 0); + PS_DEST_UDP_PORT_IN : in std_logic_vector(15 downto 0); + TC_RD_EN_IN : in std_logic; + TC_DATA_OUT : out std_logic_vector(8 downto 0); + TC_FRAME_SIZE_OUT : out std_logic_vector(15 downto 0); + TC_FRAME_TYPE_OUT : out std_logic_vector(15 downto 0); + TC_IP_PROTOCOL_OUT : out std_logic_vector(7 downto 0); + TC_IDENT_OUT : out std_logic_vector(15 downto 0); + TC_DEST_MAC_OUT : out std_logic_vector(47 downto 0); + TC_DEST_IP_OUT : out std_logic_vector(31 downto 0); + TC_DEST_UDP_OUT : out std_logic_vector(15 downto 0); + TC_SRC_MAC_OUT : out std_logic_vector(47 downto 0); + TC_SRC_IP_OUT : out std_logic_vector(31 downto 0); + TC_SRC_UDP_OUT : out std_logic_vector(15 downto 0); + STAT_DATA_OUT : out std_logic_vector(31 downto 0); + STAT_ADDR_OUT : out std_logic_vector(7 downto 0); + STAT_DATA_RDY_OUT : out std_logic; + STAT_DATA_ACK_IN : in std_logic; + RECEIVED_FRAMES_OUT : out std_logic_vector(15 downto 0); + SENT_FRAMES_OUT : out std_logic_vector(15 downto 0); + -- END OF INTERFACE + + MY_TRBNET_ADDRESS_IN : in std_logic_vector(15 downto 0); + ISSUE_REBOOT_OUT : out std_logic; + + -- debug + DEBUG_OUT : out std_logic_vector(63 downto 0) + ); + end component; component trb_net16_gbe_response_constructor_PseudoPing is generic(STAT_ADDRESS_BASE : integer := 0 diff --git a/gbe_trb/testbenches/aa_full_wrapper_tb.vhd b/gbe_trb/testbenches/aa_full_wrapper_tb.vhd index 9ec8a38..cfaab58 100644 --- a/gbe_trb/testbenches/aa_full_wrapper_tb.vhd +++ b/gbe_trb/testbenches/aa_full_wrapper_tb.vhd @@ -25,7 +25,7 @@ begin DO_SIMULATION => 1, INCLUDE_DEBUG => 0, USE_INTERNAL_TRBNET_DUMMY => 0, - USE_EXTERNAL_TRBNET_DUMMY => 1, + USE_EXTERNAL_TRBNET_DUMMY => 0, RX_PATH_ENABLE => 1, FIXED_SIZE_MODE => 1, INCREMENTAL_MODE => 0, @@ -67,6 +67,7 @@ begin FEE_READ_OUT => open, FEE_STATUS_BITS_IN => (others => '0'), FEE_BUSY_IN => '0', + MY_TRBNET_ADDRESS_IN => x"e001", MC_UNIQUE_ID_IN => (others => '0'), GSC_CLK_IN => clk_sys, GSC_INIT_DATAREADY_OUT => open, -- 2.43.0