From b18227b6fb6a50666c5c4e22f4dfd5245e36936e Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Fri, 21 Apr 2023 12:51:25 +0200 Subject: [PATCH] add files for large slowcontrol transfers --- gbe_trb/base/gbe_protocol_selector.vhd | 2 +- .../base/trb_net16_gbe_transmit_control2.vhd | 14 +++- gbe_trb/base/trb_net_gbe_protocols.vhd | 66 +++++++++++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/gbe_trb/base/gbe_protocol_selector.vhd b/gbe_trb/base/gbe_protocol_selector.vhd index 6c22e2b..63ad85c 100644 --- a/gbe_trb/base/gbe_protocol_selector.vhd +++ b/gbe_trb/base/gbe_protocol_selector.vhd @@ -382,7 +382,7 @@ begin end generate no_ping_gen; sctrl_gen : if INCLUDE_SLOWCTRL = '1' generate - SCTRL : trb_net16_gbe_response_constructor_SCTRL + SCTRL : trb_net16_gbe_response_constructor_SCTRL_L generic map(STAT_ADDRESS_BASE => 8, SLOWCTRL_BUFFER_SIZE => SLOWCTRL_BUFFER_SIZE ) diff --git a/gbe_trb/base/trb_net16_gbe_transmit_control2.vhd b/gbe_trb/base/trb_net16_gbe_transmit_control2.vhd index ed92de7..dc54206 100644 --- a/gbe_trb/base/trb_net16_gbe_transmit_control2.vhd +++ b/gbe_trb/base/trb_net16_gbe_transmit_control2.vhd @@ -121,7 +121,7 @@ begin if (local_end = x"0000") then transmit_next_state <= SEND_ONE; else - if (actual_frame_bytes = TC_MAX_FRAME_IN - x"1") then + if (actual_frame_bytes = TC_MAX_FRAME_IN - x"1" and local_end > x"0002") then -- gk 15.03.2023 workaround for 2 leftover bytes, add them to the last frame transmit_next_state <= SEND_ONE; else transmit_next_state <= TRANSMIT; @@ -240,7 +240,11 @@ begin if rising_edge(CLK) then if (transmit_current_state = PREPARE_HEADERS) then if (local_end >= TC_MAX_FRAME_IN) then - ip_size <= TC_MAX_FRAME_IN; + if (local_end = TC_MAX_FRAME_IN + x"1") then -- gk 15.03.2023 nasty workaround for 2 leftover bytes, add them to the last frame + ip_size <= TC_MAX_FRAME_IN + x"2"; + else + ip_size <= TC_MAX_FRAME_IN; + end if; else ip_size <= local_end + x"1"; end if; @@ -259,7 +263,11 @@ begin if rising_edge(CLK) then if (transmit_current_state = PREPARE_HEADERS) then if (local_end >= TC_MAX_FRAME_IN) then - more_fragments <= '1'; + if (local_end = TC_MAX_FRAME_IN + x"1") then -- gk 15.03.2023 nasty workaround for 2 leftover bytes, add them to the last frame + more_fragments <= '0'; + else + more_fragments <= '1'; + end if; else more_fragments <= '0'; end if; diff --git a/gbe_trb/base/trb_net_gbe_protocols.vhd b/gbe_trb/base/trb_net_gbe_protocols.vhd index 226559b..832f264 100644 --- a/gbe_trb/base/trb_net_gbe_protocols.vhd +++ b/gbe_trb/base/trb_net_gbe_protocols.vhd @@ -527,6 +527,72 @@ package trb_net_gbe_protocols is ); end component; + component trb_net16_gbe_response_constructor_SCTRL_L is + generic(STAT_ADDRESS_BASE : integer := 0; + SLOWCTRL_BUFFER_SIZE : integer range 1 to 4 := 1 + ); + 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; + DEBUG_OUT : out std_logic_vector(63 downto 0); + -- END OF INTERFACE + + -- protocol specific ports + GSC_CLK_IN : in std_logic; + GSC_INIT_DATAREADY_OUT : out std_logic; + GSC_INIT_DATA_OUT : out std_logic_vector(15 downto 0); + GSC_INIT_PACKET_NUM_OUT : out std_logic_vector(2 downto 0); + GSC_INIT_READ_IN : in std_logic; + GSC_REPLY_DATAREADY_IN : in std_logic; + GSC_REPLY_DATA_IN : in std_logic_vector(15 downto 0); + GSC_REPLY_PACKET_NUM_IN : in std_logic_vector(2 downto 0); + GSC_REPLY_READ_OUT : out std_logic; + GSC_BUSY_IN : in std_logic; + MAKE_RESET_OUT : out std_logic; + CFG_ADDITIONAL_HDR_IN : in std_logic; + CFG_MAX_REPLY_SIZE_IN : in std_logic_vector(31 downto 0); + -- end of protocol specific ports + + MONITOR_SELECT_REC_OUT : out std_logic_vector(31 downto 0); + MONITOR_SELECT_REC_BYTES_OUT : out std_logic_vector(31 downto 0); + MONITOR_SELECT_SENT_BYTES_OUT : out std_logic_vector(31 downto 0); + MONITOR_SELECT_SENT_OUT : out std_logic_vector(31 downto 0); + DATA_HIST_OUT : out hist_array + ); + end component; + component trb_net16_gbe_response_constructor_Stat is generic(STAT_ADDRESS_BASE : integer := 0 ); -- 2.43.0