From: hadeshyp Date: Mon, 19 Mar 2007 13:27:27 +0000 (+0000) Subject: added minus one for speed, Ingo X-Git-Tag: oldGBE~747 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=088acaf1b268c97a5419a00b0affaa7be0f9ccd5;p=trbnet.git added minus one for speed, Ingo --- diff --git a/trb_net_obuf.vhd b/trb_net_obuf.vhd index bb3cadd..ff2389a 100644 --- a/trb_net_obuf.vhd +++ b/trb_net_obuf.vhd @@ -70,6 +70,7 @@ architecture trb_net_obuf_arch of trb_net_obuf is signal CURRENT_DATA_COUNT, next_DATA_COUNT : STD_LOGIC_VECTOR (15 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 (15 downto 0); signal TRANSMITTED_BUFFERS, next_TRANSMITTED_BUFFERS : STD_LOGIC_VECTOR (1 downto 0); signal increase_TRANSMITTED_BUFFERS, decrease_TRANSMITTED_BUFFERS : STD_LOGIC; @@ -110,7 +111,8 @@ 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,next_DATA_COUNT, + max_DATA_COUNT_minus_one,next_DATA_COUNT, + max_DATA_COUNT, next_TRANSMITTED_BUFFERS) begin current_output_buffer <= current_NOP_word; @@ -150,7 +152,7 @@ architecture trb_net_obuf_arch of trb_net_obuf is end if; --finally, block data read if the rec buffer is full if sent_data = '0' or - (next_DATA_COUNT = max_DATA_COUNT-1) or + (next_DATA_COUNT = max_DATA_COUNT_minus_one) or next_TRANSMITTED_BUFFERS(1) = '1' then next_INT_READ_OUT <= '0'; @@ -202,7 +204,7 @@ architecture trb_net_obuf_arch of trb_net_obuf is current_EOB_word(47 downto 0) <= (others => '0'); gen_sent_EOB : process (CURRENT_DATA_COUNT, max_DATA_COUNT) begin - if (CURRENT_DATA_COUNT = max_DATA_COUNT-1) then + if (CURRENT_DATA_COUNT = max_DATA_COUNT_minus_one) then sent_EOB <= '1'; else sent_EOB <= '0'; @@ -221,6 +223,11 @@ architecture trb_net_obuf_arch of trb_net_obuf is "0000000000010000" when REC_BUFFER_SIZE_IN="0011" else "0000000000100000" when REC_BUFFER_SIZE_IN="0100" else "0000000000000010"; + next_max_DATA_COUNT_minus_one <= "0000000000000011" when REC_BUFFER_SIZE_IN="0001" else + "0000000000000111" when REC_BUFFER_SIZE_IN="0010" else + "0000000000001111" when REC_BUFFER_SIZE_IN="0011" else + "0000000000011111" when REC_BUFFER_SIZE_IN="0100" else + "0000000000000001"; -- next_max_DATA_COUNT <= 2 ** (REC_BUFFER_SIZE_IN + 1); -- BUGBUG via pattern_gen @@ -229,10 +236,10 @@ architecture trb_net_obuf_arch of trb_net_obuf is if rising_edge(CLK) then if RESET = '1' then max_DATA_COUNT <= (1 => '1', others => '0'); - elsif CLK_EN = '1' then - max_DATA_COUNT <= next_max_DATA_COUNT; + next_max_DATA_COUNT_minus_one <= (0 => '1', others => '0'); else - max_DATA_COUNT <= max_DATA_COUNT; + max_DATA_COUNT <= next_max_DATA_COUNT; + next_max_DATA_COUNT_minus_one <= next_max_DATA_COUNT_minus_one; end if; end if; end process;