From: hadeshyp Date: Thu, 17 Jul 2008 14:24:15 +0000 (+0000) Subject: updated trigger receiver entities, Jan X-Git-Tag: oldGBE~541 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=7c6e2bab279fb21c1a5a1b4f15ee737b79651916;p=trbnet.git updated trigger receiver entities, Jan --- diff --git a/trb_net16_endpoint_1_trg_0_api.vhd b/trb_net16_endpoint_1_trg_0_api.vhd index f8197c6..8c13ab7 100644 --- a/trb_net16_endpoint_1_trg_0_api.vhd +++ b/trb_net16_endpoint_1_trg_0_api.vhd @@ -8,36 +8,34 @@ USE IEEE.std_logic_UNSIGNED.ALL; library work; use work.trb_net_std.all; ---Entity decalaration for clock generator entity trb_net16_endpoint_1_trg_0_api is generic ( - TRG_INIT_DEPTH : integer := 6; - TRG_REPLY_DEPTH : integer := 6; TRG_CHANNEL : integer := 0; TRG_SECURE_MODE : integer := 0 -- if 0, error pattern and dtype must be valid until next - -- trigger comes in. if 1 these can be valid on falling edge of hold_trm only + -- trigger comes in. if 1 these can be valid on falling edge of hold_trm only ); port( -- Misc - CLK : in std_logic; - RESET : in std_logic; + CLK : in std_logic; + RESET : in std_logic; CLK_EN : in std_logic; -- Media direction port - MED_DATAREADY_OUT: out std_logic; --Data word ready to be read out - --by the media (via the TrbNetIOMultiplexer) - MED_DATA_OUT: out std_logic_vector (c_DATA_WIDTH-1 downto 0); -- Data word - MED_PACKET_NUM_OUT:out std_logic_vector (c_NUM_WIDTH-1 downto 0); - MED_READ_IN: in std_logic; -- Media is reading - - MED_DATAREADY_IN: in std_logic; -- Data word is offered by the Media - -- (the IOBUF MUST read) - MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); -- Data word - MED_PACKET_NUM_IN: in std_logic_vector (c_NUM_WIDTH-1 downto 0); - MED_READ_OUT: out std_logic; -- buffer reads a word from media - MED_ERROR_IN: in std_logic_vector (2 downto 0); -- Status bits - + MED_DATAREADY_OUT : out std_logic; + MED_DATA_OUT : out std_logic_vector (c_DATA_WIDTH-1 downto 0); + MED_PACKET_NUM_OUT : out std_logic_vector (c_NUM_WIDTH-1 downto 0); + MED_READ_IN : in std_logic; + + MED_DATAREADY_IN : in std_logic; + MED_DATA_IN : in std_logic_vector (c_DATA_WIDTH-1 downto 0); + MED_PACKET_NUM_IN : in std_logic_vector (c_NUM_WIDTH-1 downto 0); + MED_READ_OUT : out std_logic; + MED_ERROR_IN : in std_logic_vector (2 downto 0); + MED_STAT_OP : in std_logic_vector (15 downto 0); + MED_CTRL_OP : out std_logic_vector (15 downto 0); + + --Trigger Output LVL1_ERROR_PATTERN_OUT : out std_logic_vector(31 downto 0); LVL1_GOT_TRIGGER_OUT : out std_logic; LVL1_DTYPE_OUT : out std_logic_vector(3 downto 0); @@ -46,9 +44,9 @@ entity trb_net16_endpoint_1_trg_0_api is LVL1_RELEASE_IN : in std_logic; -- Status and control port => just coming from the iobuf for debugging - STAT_GEN: out std_logic_vector (31 downto 0); -- General Status - STAT_LOCKED: out std_logic_vector (31 downto 0); -- Status of the handshake and buffer control - STAT_IBUF_BUFFER: out std_logic_vector (31 downto 0); -- Status of the handshake and buffer control + STAT_GEN: out std_logic_vector (31 downto 0); + STAT_LOCKED: out std_logic_vector (31 downto 0); + STAT_IBUF_BUFFER: out std_logic_vector (31 downto 0); STAT_api_control_signals: out std_logic_vector(31 downto 0); STAT_MPLEX: out std_logic_vector(31 downto 0); CTRL_GEN: in std_logic_vector (31 downto 0); @@ -64,8 +62,8 @@ architecture trb_net16_endpoint_1_trg_0_api_arch of trb_net16_endpoint_1_trg_0_a component trb_net16_iobuf is generic ( - IBUF_DEPTH : integer range 0 to 6 := c_FIFO_BRAM;--std_FIFO_DEPTH; - IBUF_SECURE_MODE : integer range 0 to 1 := c_NO;--std_IBUF_SECURE_MODE; + IBUF_DEPTH : integer range 0 to 6 := 0; + IBUF_SECURE_MODE : integer range 0 to 1 := c_NO; SBUF_VERSION : integer range 0 to 1 := std_SBUF_VERSION; OBUF_DATA_COUNT_WIDTH : integer range 2 to 7 := std_DATA_COUNT_WIDTH; USE_ACKNOWLEDGE : integer range 0 to 1 := std_USE_ACKNOWLEDGE; @@ -91,7 +89,7 @@ component trb_net16_iobuf is MED_REPLY_READ_IN: in std_logic; - MED_DATAREADY_IN: in std_logic; -- Data word is offered by the Media(the IOBUF MUST read) + MED_DATAREADY_IN: in std_logic; MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); MED_PACKET_NUM_IN: in std_logic_vector (c_NUM_WIDTH-1 downto 0); MED_READ_OUT: out std_logic; @@ -173,8 +171,8 @@ component trb_net16_term is ); port( -- Misc - CLK : in std_logic; - RESET : in std_logic; + CLK : in std_logic; + RESET : in std_logic; CLK_EN : in std_logic; INT_DATAREADY_OUT: out std_logic; @@ -283,8 +281,8 @@ begin MED_INIT_READ_IN <= m_READ_IN(i*2); MED_REPLY_READ_IN <= m_READ_IN(i+1); MED_IBUF_DATAREADY_IN <= m_DATAREADY_IN(i); - MED_IBUF_DATA_IN <= m_DATA_IN((i+1)*c_DATA_WIDTH-1 downto i*c_DATA_WIDTH); - MED_IBUF_PACKET_NUM_IN <= m_PACKET_NUM_IN(i*c_NUM_WIDTH+1 downto i*c_NUM_WIDTH); + MED_IBUF_DATA_IN <= m_DATA_IN(c_DATA_WIDTH-1 downto 0); + MED_IBUF_PACKET_NUM_IN <= m_PACKET_NUM_IN(c_NUM_WIDTH-1 downto 0); m_READ_OUT(i) <= MED_IBUF_READ_OUT; end generate; genelse: if i /= TRG_CHANNEL generate @@ -294,8 +292,8 @@ begin RESET => RESET, CLK_EN => CLK_EN, MED_DATAREADY_IN => m_DATAREADY_IN(i), - MED_DATA_IN => m_DATA_IN((i+1)*c_DATA_WIDTH-1 downto i*c_DATA_WIDTH), - MED_PACKET_NUM_IN => m_PACKET_NUM_IN(i*c_NUM_WIDTH+1 downto i*c_NUM_WIDTH), + MED_DATA_IN => m_DATA_IN(c_DATA_WIDTH-1 downto 0), + MED_PACKET_NUM_IN => m_PACKET_NUM_IN(c_NUM_WIDTH-1 downto 0), MED_READ_OUT => m_READ_OUT(i), MED_INIT_DATAREADY_OUT => m_DATAREADY_OUT(i*2), @@ -312,6 +310,10 @@ begin end generate; IOBUF: trb_net16_iobuf + generic map( + USE_ACKNOWLEDGE => cfg_USE_ACKNOWLEDGE(TRG_CHANNEL), + USE_CHECKSUM => cfg_USE_CHECKSUM(TRG_CHANNEL) + ) port map ( -- Misc CLK => CLK , diff --git a/trb_net16_endpoint_1_trg_2_data_1_regio.vhd b/trb_net16_endpoint_1_trg_2_data_1_regio.vhd index 18a5c46..6d48c0f 100644 --- a/trb_net16_endpoint_1_trg_2_data_1_regio.vhd +++ b/trb_net16_endpoint_1_trg_2_data_1_regio.vhd @@ -705,7 +705,7 @@ begin gentrgapi : if i = 0 generate trglvl1 : trb_net16_term generic map( - USE_APL_PORT => c_NO, + USE_APL_PORT => c_YES, SECURE_MODE => std_TERM_SECURE_MODE ) port map( diff --git a/trb_net16_iobuf.vhd b/trb_net16_iobuf.vhd index 375c25b..1cbf63f 100644 --- a/trb_net16_iobuf.vhd +++ b/trb_net16_iobuf.vhd @@ -36,7 +36,7 @@ entity trb_net16_iobuf is MED_REPLY_READ_IN: in std_logic; - MED_DATAREADY_IN: in std_logic; -- Data word is offered by the Media(the IOBUF MUST read) + MED_DATAREADY_IN: in std_logic; MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); MED_PACKET_NUM_IN: in std_logic_vector (c_NUM_WIDTH-1 downto 0); MED_READ_OUT: out std_logic; @@ -157,34 +157,32 @@ architecture trb_net16_iobuf_arch of trb_net16_iobuf is ); end component; - -- component trb_net16_term_ibuf is - -- generic( - -- SECURE_MODE : integer range 0 to 1 := std_TERM_SECURE_MODE; - -- SBUF_VERSION : integer range 0 to 1 := std_SBUF_VERSION - -- ); - -- port( - -- -- Misc - -- CLK : in std_logic; - -- RESET : in std_logic; - -- CLK_EN : in std_logic; - -- -- Media direction port - -- MED_DATAREADY_IN: in std_logic; - -- MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); - -- MED_PACKET_NUM_IN: in std_logic_vector (c_NUM_WIDTH-1 downto 0); - -- MED_READ_OUT: out std_logic; - -- MED_ERROR_IN: in std_logic_vector (2 downto 0); - -- --Internal direction port - -- INT_DATAREADY_OUT: out std_logic; - -- INT_DATA_OUT: out std_logic_vector (c_DATA_WIDTH-1 downto 0); - -- INT_PACKET_NUM_OUT:out std_logic_vector (c_NUM_WIDTH-1 downto 0); - -- INT_READ_IN: in std_logic; - -- INT_ERROR_OUT: out std_logic_vector (2 downto 0); - -- --Status and control port - -- STAT_LOCKED: out std_logic_vector (15 downto 0); - -- CTRL_LOCKED: in std_logic_vector (15 downto 0); - -- STAT_BUFFER: out std_logic_vector (31 downto 0) - -- ); - -- end component; + component trb_net16_term_ibuf is + generic( + SECURE_MODE : integer range 0 to 1 := std_TERM_SECURE_MODE; + SBUF_VERSION : integer range 0 to 1 := std_SBUF_VERSION + ); + port( + -- Misc + CLK : in std_logic; + RESET : in std_logic; + CLK_EN : in std_logic; + -- Media direction port + MED_DATAREADY_IN: in std_logic; + MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); + MED_PACKET_NUM_IN :in std_logic_vector(c_NUM_WIDTH-1 downto 0); + MED_READ_OUT: out std_logic; + MED_ERROR_IN: in std_logic_vector (2 downto 0); + -- Internal direction port + INT_DATAREADY_OUT: out std_logic; + INT_DATA_OUT: out std_logic_vector (c_DATA_WIDTH-1 downto 0); + INT_PACKET_NUM_OUT:out std_logic_vector(c_NUM_WIDTH-1 downto 0); + INT_READ_IN: in std_logic; + INT_ERROR_OUT: out std_logic_vector (2 downto 0); + -- Status and control port + STAT_BUFFER: out std_logic_vector (31 downto 0) + ); + end component; -- internal signals for the INITIBUF signal IBUF_error: STD_LOGIC_VECTOR (2 downto 0); -- error watch needed! @@ -230,32 +228,32 @@ begin ); end generate; - -- GEN_TERM_IBUF: if INIT_DEPTH=0 generate - -- INITIBUF : trb_net16_term_ibuf - -- generic map( - -- SBUF_VERSION => SBUF_VERSION, - -- SECURE_MODE => IBUF_SECURE_MODE - -- ) - -- port map ( - -- CLK => CLK, - -- RESET => RESET, - -- CLK_EN => CLK_EN, - -- MED_DATAREADY_IN => MED_INIT_DATAREADY_IN, - -- MED_DATA_IN => MED_INIT_DATA_IN, - -- MED_PACKET_NUM_IN => MED_INIT_PACKET_NUM_IN, - -- MED_READ_OUT => MED_INIT_READ_OUT, - -- MED_ERROR_IN => MED_INIT_ERROR_IN, - -- INT_HEADER_IN => '0', - -- INT_DATAREADY_OUT => INT_INIT_DATAREADY_OUT, - -- INT_DATA_OUT => INT_INIT_DATA_OUT, - -- INT_PACKET_NUM_OUT => INT_INIT_PACKET_NUM_OUT, - -- INT_READ_IN => INT_INIT_READ_IN, - -- INT_ERROR_OUT => INITIBUF_error, - -- STAT_LOCKED(15 downto 0) => INITIBUF_stat_locked, - -- CTRL_LOCKED(15 downto 0) => INITIBUF_ctrl_locked, - -- STAT_BUFFER(31 downto 0) => INITIBUF_stat_buffer - -- ); - -- end generate; + GEN_TERM_IBUF: if IBUF_DEPTH=0 generate + IBUF : trb_net16_term_ibuf + generic map( + SBUF_VERSION => SBUF_VERSION, + SECURE_MODE => IBUF_SECURE_MODE + ) + port map ( + CLK => CLK, + RESET => RESET, + CLK_EN => CLK_EN, + MED_DATAREADY_IN => MED_DATAREADY_IN, + MED_DATA_IN => MED_DATA_IN, + MED_PACKET_NUM_IN => MED_PACKET_NUM_IN, + MED_READ_OUT => MED_READ_OUT, + MED_ERROR_IN => MED_ERROR_IN, + INT_DATAREADY_OUT => INT_INIT_DATAREADY_OUT, + INT_DATA_OUT => INT_INIT_DATA_OUT, + INT_PACKET_NUM_OUT => INT_INIT_PACKET_NUM_OUT, + INT_READ_IN => INT_INIT_READ_IN, + INT_ERROR_OUT => IBUF_error, + STAT_BUFFER(31 downto 0) => IBUF_stat_buffer + ); + INT_REPLY_DATAREADY_OUT <= '0'; + INT_REPLY_DATA_OUT <= (others => '0'); + INT_REPLY_PACKET_NUM_OUT <= (others => '0'); + end generate; diff --git a/trb_net16_term.vhd b/trb_net16_term.vhd index 1fd9b90..b7c1374 100644 --- a/trb_net16_term.vhd +++ b/trb_net16_term.vhd @@ -51,16 +51,16 @@ end entity; architecture trb_net16_term_arch of trb_net16_term is signal next_APL_DTYPE_OUT, reg_APL_DTYPE_OUT: std_logic_vector(3 downto 0); - signal reg_APL_ERROR_PATTERN_OUT, next_APL_ERROR_PATTERN_OUT: std_logic_vector(31 downto 0); + signal reg_APL_ERROR_PATTERN_OUT: std_logic_vector(31 downto 0); signal next_APL_SEQNR_OUT, reg_APL_SEQNR_OUT: std_logic_vector(7 downto 0); signal next_APL_GOT_TRM, reg_APL_GOT_TRM: std_logic; signal reg_APL_DTYPE_IN, buf_APL_DTYPE_IN : std_logic_vector(3 downto 0); signal reg_APL_ERROR_PATTERN_IN, buf_APL_ERROR_PATTERN_IN: std_logic_vector(31 downto 0); - signal current_packet_type, saved_packet_type : std_logic_vector(2 downto 0); + signal saved_packet_type : std_logic_vector(2 downto 0); - signal transfer_counter, next_transfer_counter : std_logic_vector(1 downto 0); + signal transfer_counter : std_logic_vector(1 downto 0); signal send_trm, next_send_trm : std_logic; signal buf_INT_DATAREADY_OUT, next_INT_DATAREADY_OUT : std_logic; signal buf_INT_DATA_OUT, next_INT_DATA_OUT : std_logic_vector(15 downto 0); @@ -72,23 +72,22 @@ begin APL_ERROR_PATTERN_OUT <= reg_APL_ERROR_PATTERN_OUT; APL_SEQNR_OUT <= reg_APL_SEQNR_OUT; APL_GOT_TRM <= reg_APL_GOT_TRM; - INT_READ_OUT <= not send_trm and not reg_APL_GOT_TRM; + INT_READ_OUT <= '1'; --not send_trm and not reg_APL_GOT_TRM; end generate; g1n: if USE_APL_PORT = 0 generate APL_DTYPE_OUT <= (others => '0'); APL_ERROR_PATTERN_OUT <= (others => '0'); APL_SEQNR_OUT <= (others => '0'); APL_GOT_TRM <= '0'; - INT_READ_OUT <= not send_trm; + INT_READ_OUT <= '1'; --not send_trm; end generate; - process(RESET, reg_APL_DTYPE_OUT, reg_APL_SEQNR_OUT, reg_APL_GOT_TRM, current_packet_type, + process(RESET, reg_APL_DTYPE_OUT, reg_APL_SEQNR_OUT, reg_APL_GOT_TRM, INT_PACKET_NUM_IN, INT_DATA_IN, APL_RELEASE_TRM, send_trm, transfer_counter, INT_READ_IN, saved_packet_type, buf_APL_ERROR_PATTERN_IN, buf_APL_DTYPE_IN, buf_INT_DATA_OUT, buf_INT_DATAREADY_OUT) begin - --next_APL_ERROR_PATTERN_OUT <= reg_APL_ERROR_PATTERN_OUT; if USE_APL_PORT = 1 then next_APL_DTYPE_OUT <= reg_APL_DTYPE_OUT; next_APL_SEQNR_OUT <= reg_APL_SEQNR_OUT; @@ -104,7 +103,6 @@ begin next_send_trm <= '0'; next_INT_DATAREADY_OUT <= '0'; next_INT_DATA_OUT <= buf_INT_DATA_OUT; - next_transfer_counter <= transfer_counter; if (reg_APL_GOT_TRM = '1' and (APL_RELEASE_TRM = '1' or USE_APL_PORT = 0)) or send_trm = '1' then -- if (reg_APL_GOT_TRM = '1' and (APL_RELEASE_TRM = '1' )) or send_trm = '1' or 0 = 0 then @@ -129,7 +127,7 @@ begin next_INT_DATA_OUT(11 downto 4) <= reg_APL_SEQNR_OUT; end if; end if; - if APL_RELEASE_TRM = '1' and reg_APL_GOT_TRM = '1' and USE_APL_PORT = 0 then + if (APL_RELEASE_TRM = '1' and reg_APL_GOT_TRM = '1') or USE_APL_PORT = c_NO then next_APL_GOT_TRM <= '0'; end if; end process; diff --git a/trb_net16_term_ibuf.vhd b/trb_net16_term_ibuf.vhd index e418fec..7f8db94 100644 --- a/trb_net16_term_ibuf.vhd +++ b/trb_net16_term_ibuf.vhd @@ -1,7 +1,8 @@ -- term_ibuf can be used instead of ibuf, if only short transfers are received. -- it keeps only the TRM words -- EOB are killed --- ACK are regognized +-- ACK are recognized +-- reply channel is killed -- all other words (HDR, DAT) are not stored LIBRARY IEEE; @@ -24,21 +25,18 @@ entity trb_net16_term_ibuf is RESET : in std_logic; CLK_EN : in std_logic; -- Media direction port - MED_DATAREADY_IN: in std_logic; -- Data word is offered by the Media (the IOBUF MUST read) - MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); -- Data word + MED_DATAREADY_IN: in std_logic; + MED_DATA_IN: in std_logic_vector (c_DATA_WIDTH-1 downto 0); MED_PACKET_NUM_IN :in std_logic_vector(c_NUM_WIDTH-1 downto 0); - MED_READ_OUT: out std_logic; -- buffer reads a word from media - MED_ERROR_IN: in std_logic_vector (2 downto 0); -- Status bits + MED_READ_OUT: out std_logic; + MED_ERROR_IN: in std_logic_vector (2 downto 0); -- Internal direction port - INT_HEADER_IN: in std_logic; -- Concentrator kindly asks to resend the last header INT_DATAREADY_OUT: out std_logic; - INT_DATA_OUT: out std_logic_vector (c_DATA_WIDTH-1 downto 0); -- Data word + INT_DATA_OUT: out std_logic_vector (c_DATA_WIDTH-1 downto 0); INT_PACKET_NUM_OUT:out std_logic_vector(c_NUM_WIDTH-1 downto 0); INT_READ_IN: in std_logic; - INT_ERROR_OUT: out std_logic_vector (2 downto 0); -- Status bits + INT_ERROR_OUT: out std_logic_vector (2 downto 0); -- Status and control port - STAT_LOCKED: out std_logic_vector (15 downto 0); - CTRL_LOCKED: in std_logic_vector (15 downto 0); STAT_BUFFER: out std_logic_vector (31 downto 0) ); end entity; @@ -71,7 +69,6 @@ architecture trb_net16_term_ibuf_arch of trb_net16_term_ibuf is end component; signal got_ack_internal, reg_ack_internal : std_logic; --should be raised for 1 cycle when ack - signal is_locked, got_locked,release_locked : std_logic; signal got_eob_out, reg_eob_out: std_logic; signal sbuf_free, comb_next_read: std_logic; signal tmp_INT_DATAREADY_OUT: std_logic; @@ -80,7 +77,8 @@ architecture trb_net16_term_ibuf_arch of trb_net16_term_ibuf is type ERROR_STATE is (IDLE, GOT_OVERFLOW_ERROR, GOT_LOCKED_ERROR, GOT_UNDEFINED_ERROR); signal current_error_state, next_error_state : ERROR_STATE; signal next_rec_buffer_size_out, current_rec_buffer_size_out : std_logic_vector(3 downto 0); - signal current_packet_type, saved_packet_type : std_logic_vector(2 downto 0); + signal current_packet_type, saved_packet_type : std_logic_vector(3 downto 0); + signal buf_MED_READ_OUT : std_logic; -- buffer size control begin @@ -90,54 +88,46 @@ begin begin if rising_edge(CLK) then if RESET = '1' then - saved_packet_type <= "111"; + saved_packet_type <= "0111"; elsif MED_PACKET_NUM_IN = "00" then - saved_packet_type <= MED_DATA_IN(2 downto 0); + saved_packet_type <= MED_DATA_IN(3 downto 0); end if; end if; end process; --create comb. real packet type - current_packet_type <= MED_DATA_IN(2 downto 0) when (MED_PACKET_NUM_IN = "00") + current_packet_type <= MED_DATA_IN(3 downto 0) when (MED_PACKET_NUM_IN = "00") else saved_packet_type; -- this process controls the writing of the media into the fifo FILTER_DATAREADY_IN : process(MED_DATA_IN, MED_DATAREADY_IN, MED_ERROR_IN, - is_locked, current_rec_buffer_size_out, - current_error_state, release_locked, + current_rec_buffer_size_out, current_error_state, sbuf_free, MED_PACKET_NUM_IN, current_packet_type) begin got_ack_internal <= '0'; next_rec_buffer_size_out <= current_rec_buffer_size_out; next_error_state <= current_error_state; - tmp_INT_DATA_OUT <= MED_DATA_IN;--(others => '0'); - tmp_INT_PACKET_NUM_OUT <= MED_PACKET_NUM_IN;--(others => '0'); + tmp_INT_DATA_OUT <= MED_DATA_IN; + tmp_INT_PACKET_NUM_OUT <= MED_PACKET_NUM_IN; tmp_INT_DATAREADY_OUT <= '0'; got_eob_out <= '0'; - got_locked <= is_locked; - if MED_DATAREADY_IN = '1' then -- data word offered - if current_packet_type = TYPE_ACK then + if MED_DATAREADY_IN = '1' then + if current_packet_type = '1' & TYPE_ACK then --ACK in reply if MED_PACKET_NUM_IN = "00" then got_ack_internal <= '1'; elsif MED_PACKET_NUM_IN = "10" then next_rec_buffer_size_out <= MED_DATA_IN(3 downto 0); end if; - elsif current_packet_type = TYPE_TRM then + elsif current_packet_type = '0' & TYPE_TRM then --TRM in init if MED_PACKET_NUM_IN = "11" then - got_eob_out <= '1'; --exactly when buffer is killed - if release_locked = '0' then - got_locked <= '1'; - end if; + got_eob_out <= '1'; end if; tmp_INT_DATAREADY_OUT <= '1'; - elsif current_packet_type = TYPE_EOB then + elsif current_packet_type = '0' & TYPE_EOB then --EOB in init if MED_PACKET_NUM_IN = "11" then got_eob_out <= '1'; end if; end if; - if is_locked = '1' and current_packet_type /= TYPE_ACK then - next_error_state <= GOT_LOCKED_ERROR; - end if; if sbuf_free = '0' then next_error_state <= GOT_OVERFLOW_ERROR; end if; @@ -146,7 +136,8 @@ begin - MED_READ_OUT <= '1'; -- I always can read, since APL has to read always + MED_READ_OUT <= buf_MED_READ_OUT; + buf_MED_READ_OUT <= '1'; reg_buffer: process(CLK) begin @@ -154,10 +145,12 @@ begin if RESET = '1' then current_rec_buffer_size_out <= (others => '0'); reg_ack_internal <= '0'; + reg_eob_out <= '0'; current_error_state <= IDLE; elsif CLK_EN = '1' then current_rec_buffer_size_out <= next_rec_buffer_size_out; reg_ack_internal <= got_ack_internal; + reg_eob_out <= got_eob_out; current_error_state <= next_error_state; end if; end if; @@ -184,32 +177,18 @@ begin SYN_READ_IN => INT_READ_IN ); sbuf_free <= comb_next_read or INT_READ_IN; --sbuf killed - release_locked <= CTRL_LOCKED(0); - STAT_LOCKED(0) <= is_locked; - STAT_LOCKED(15 downto 1) <= (others => '0'); - reg_locked: process(CLK) - begin - if rising_edge(CLK) then - if RESET = '1' then - is_locked <= '0'; - reg_eob_out <= '0'; - elsif CLK_EN = '1' then - is_locked <= got_locked and not release_locked; - reg_eob_out <= got_eob_out; - end if; - end if; - end process; + + -- make STAT_BUFFER STAT_BUFFER(3 downto 0) <= "0111"; --always "biggest fifo" STAT_BUFFER(7 downto 4) <= current_rec_buffer_size_out; STAT_BUFFER(8) <= reg_eob_out; - STAT_BUFFER(9) <= reg_ack_internal; - STAT_BUFFER(11 downto 10) <= "00" when current_error_state = IDLE else - "01" when current_error_state = GOT_OVERFLOW_ERROR else - "10" when current_error_state = GOT_LOCKED_ERROR - else "11"; + STAT_BUFFER(9) <= '0'; + STAT_BUFFER(10) <= '0'; + STAT_BUFFER(11) <= reg_ack_internal; + STAT_BUFFER(31 downto 12) <= (others => '0'); end architecture; \ No newline at end of file diff --git a/trb_net_priority_arbiter.vhd b/trb_net_priority_arbiter.vhd index 9b2a91d..09ee4ce 100755 --- a/trb_net_priority_arbiter.vhd +++ b/trb_net_priority_arbiter.vhd @@ -98,7 +98,7 @@ architecture trb_net_priority_arbiter_arch of trb_net_priority_arbiter is use_rr <= current_rr_mask(0) and CTRL(9); --rol_mask is on RESULT_OUT <= current_final_pattern; - + comb_rr : process(current_p1_pattern, current_p2_pattern,use_rr, current_final_pattern, sampled_rr_pattern1, sampled_rr_pattern2, proposed_rr_pattern1, proposed_rr_pattern2, leading_rr_pattern1, leading_rr_pattern2, @@ -111,7 +111,7 @@ architecture trb_net_priority_arbiter_arch of trb_net_priority_arbiter is next_p2_pattern <= current_p2_pattern; next_rr_mask <= current_rr_mask; next_final_pattern <= (others => '0'); - + if use_rr = '1' then -- when _using_ the rr, overwrite the current pattern with a new one ( -- this means do the "round" of the robin