From: hadeshyp Date: Mon, 10 Sep 2007 12:08:45 +0000 (+0000) Subject: some changes to api, Jan X-Git-Tag: oldGBE~708 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=870ef25eeff70667962b2bdc548fe139e50b767d;p=trbnet.git some changes to api, Jan --- diff --git a/trb_net_base_api.vhd b/trb_net_base_api.vhd index a7e3e11..09b4b87 100644 --- a/trb_net_base_api.vhd +++ b/trb_net_base_api.vhd @@ -548,7 +548,7 @@ begin -- part 2: connection to apl -- if fifo_to_apl_empty = '0' then - if fifo_to_apl_empty = '0' and reg_APL_DATAREADY_OUT = '0' then --is this really correct???? + if fifo_to_apl_empty = '0' and not (reg_APL_DATAREADY_OUT = '1' and APL_READ_IN = '1') then --is this really correct???? next_APL_DATAREADY_OUT <= '1'; end if; -- read/no read @@ -623,9 +623,12 @@ begin -- connect receiver fifo_to_apl_data_in <= INT_SLAVE_DATA_IN; + +-- this has to be registered! -- reg_APL_DATAREADY_OUT <= next_APL_DATAREADY_OUT; -- reg_APL_DATA_OUT <= next_APL_DATA_OUT; -- reg_APL_TYP_OUT <= next_APL_TYP_OUT; + APL_DATAREADY_OUT <= reg_APL_DATAREADY_OUT; APL_DATA_OUT <= reg_APL_DATA_OUT; APL_TYP_OUT <= reg_APL_TYP_OUT; @@ -634,7 +637,8 @@ begin or (slave_running = '0' and API_TYPE = 0)) else '1'; APL_SEQNR_OUT <= sequence_counter; - + +--removed and put into main state machine -- generate the sequence counter -- -- combinatorial part -- SEQNR_COMB : process(sequence_counter, current_state, next_state) diff --git a/trb_net_ibuf.vhd b/trb_net_ibuf.vhd index 0e61fbc..4c472c0 100644 --- a/trb_net_ibuf.vhd +++ b/trb_net_ibuf.vhd @@ -153,7 +153,7 @@ signal next_rec_buffer_size_out, current_rec_buffer_size_out elsif is_locked = '1' then next_error_state <= GOT_LOCKED_ERROR; end if; -- end TYPE - end if; -- end MED_DATAREADY_IN + end if; -- end MED_DATAREADY_IN if fifo_full = '0' then -- and is_locked = '0' then next_read_out <= '1'; end if; diff --git a/trb_net_obuf.vhd b/trb_net_obuf.vhd index d4bc67e..a4f0aa3 100644 --- a/trb_net_obuf.vhd +++ b/trb_net_obuf.vhd @@ -35,12 +35,11 @@ entity trb_net_obuf is STAT_BUFFER: out STD_LOGIC_VECTOR (31 downto 0); CTRL_BUFFER: in STD_LOGIC_VECTOR (31 downto 0) ); -END trb_net_obuf; +end trb_net_obuf; architecture trb_net_obuf_arch of trb_net_obuf is component trb_net_sbuf is - generic (DATA_WIDTH : integer := 56; VERSION : integer := 1); @@ -61,7 +60,7 @@ architecture trb_net_obuf_arch of trb_net_obuf is -- Status and control port STAT_BUFFER: out STD_LOGIC ); - END component; + end component; signal current_output_buffer : STD_LOGIC_VECTOR (50 downto 0); signal current_ACK_word, current_EOB_word, current_DATA_word, current_NOP_word : @@ -75,7 +74,9 @@ architecture trb_net_obuf_arch of trb_net_obuf is signal CURRENT_DATA_COUNT, next_DATA_COUNT : STD_LOGIC_VECTOR (DATA_COUNT_WIDTH-1 downto 0); -- signal max_DATA_COUNT, next_max_DATA_COUNT : STD_LOGIC_VECTOR (15 downto 0); signal max_DATA_COUNT_minus_one, next_max_DATA_COUNT_minus_one : STD_LOGIC_VECTOR (DATA_COUNT_WIDTH-1 downto 0); + signal max_DATA_COUNT_minus_two, next_max_DATA_COUNT_minus_two : STD_LOGIC_VECTOR (DATA_COUNT_WIDTH-1 downto 0); signal tmp_next_max_DATA_COUNT_minus_one : STD_LOGIC_VECTOR (15 downto 0); + signal tmp_next_max_DATA_COUNT_minus_two : STD_LOGIC_VECTOR (15 downto 0); signal TRANSMITTED_BUFFERS, next_TRANSMITTED_BUFFERS : STD_LOGIC_VECTOR (1 downto 0); signal increase_TRANSMITTED_BUFFERS, decrease_TRANSMITTED_BUFFERS : STD_LOGIC; @@ -116,7 +117,7 @@ architecture trb_net_obuf_arch of trb_net_obuf is CURRENT_DATA_COUNT,reg_SEND_ACK_IN,reg_INT_READ_OUT, INT_DATAREADY_IN, INT_DATA_IN, sent_ACK, sent_EOB, current_ACK_word,current_EOB_word, sbuf_free, sent_data, - max_DATA_COUNT_minus_one,next_DATA_COUNT, + max_DATA_COUNT_minus_two,next_DATA_COUNT, next_TRANSMITTED_BUFFERS) begin current_output_buffer <= current_NOP_word; @@ -148,7 +149,7 @@ architecture trb_net_obuf_arch of trb_net_obuf is current_output_buffer <= current_ACK_word; next_SEND_ACK_IN <= '0'; comb_dataready <= '1'; - next_INT_READ_OUT <= '0'; --stop activity to be on the save side + next_INT_READ_OUT <= '0'; --stop activity to be on the safe side elsif sent_ACK = '1' and sbuf_free = '0' then next_SEND_ACK_IN <= '1'; elsif sent_EOB = '1' and sbuf_free = '1' then @@ -156,12 +157,14 @@ architecture trb_net_obuf_arch of trb_net_obuf is next_DATA_COUNT <= (others => '0'); increase_TRANSMITTED_BUFFERS <= '1'; comb_dataready <= '1'; - next_INT_READ_OUT <= '0'; --stop activity to be on the save side + next_INT_READ_OUT <= '0'; --stop activity to be on the safe side end if; --finally, block data read if the rec buffer is full if sent_data = '0' or - (next_DATA_COUNT(DATA_COUNT_WIDTH-1 downto 0) = max_DATA_COUNT_minus_one(DATA_COUNT_WIDTH-1 downto 0)) + ((current_DATA_COUNT(DATA_COUNT_WIDTH-1 downto 0) = (max_DATA_COUNT_minus_two(DATA_COUNT_WIDTH-1 downto 0))) + and reg_INT_READ_OUT = '1' and INT_DATAREADY_IN = '1' and INT_DATA_IN(TYPE_POSITION) = TYPE_TRM) + --long version of (next_count = max_count-1) or (next_TRANSMITTED_BUFFERS(1) = '1' and SWITCH_OFF_BUFFER_CHECK = 0) then next_INT_READ_OUT <= '0'; @@ -237,7 +240,13 @@ architecture trb_net_obuf_arch of trb_net_obuf is "0000000000001111" when REC_BUFFER_SIZE_IN="0011" else "0000000000011111" when REC_BUFFER_SIZE_IN="0100" else "0000000000000001"; + tmp_next_max_DATA_COUNT_minus_two <= "0000000000000010" when REC_BUFFER_SIZE_IN="0001" else + "0000000000000110" when REC_BUFFER_SIZE_IN="0010" else + "0000000000001110" when REC_BUFFER_SIZE_IN="0011" else + "0000000000011110" when REC_BUFFER_SIZE_IN="0100" else + "0000000000000000"; next_max_DATA_COUNT_minus_one(DATA_COUNT_WIDTH-1 downto 0) <= tmp_next_max_DATA_COUNT_minus_one(DATA_COUNT_WIDTH-1 downto 0); + next_max_DATA_COUNT_minus_two(DATA_COUNT_WIDTH-1 downto 0) <= tmp_next_max_DATA_COUNT_minus_two(DATA_COUNT_WIDTH-1 downto 0); -- next_max_DATA_COUNT <= 2 ** (REC_BUFFER_SIZE_IN + 1); -- BUGBUG via pattern_gen @@ -248,9 +257,11 @@ architecture trb_net_obuf_arch of trb_net_obuf is -- max_DATA_COUNT <= (1 => '1', others => '0'); max_DATA_COUNT_minus_one(0) <= '1'; max_DATA_COUNT_minus_one(DATA_COUNT_WIDTH-1 downto 1) <= (others => '0'); + max_DATA_COUNT_minus_two(DATA_COUNT_WIDTH-1 downto 0) <= (others => '0'); else -- max_DATA_COUNT <= next_max_DATA_COUNT; max_DATA_COUNT_minus_one <= next_max_DATA_COUNT_minus_one; + max_DATA_COUNT_minus_two <= next_max_DATA_COUNT_minus_two; end if; end if; end process; @@ -310,7 +321,6 @@ architecture trb_net_obuf_arch of trb_net_obuf is is_locked <= '0'; elsif CLK_EN = '1' then is_locked <= got_locked; - else is_locked <= is_locked; end if;