wait;
end process DO_RESET;
+ STIMULI1: process (CLK)
+ file protokoll : text open read_mode is "in_obuf_ctrl.txt";
+ variable myoutline : line;
+ variable leer : character;
+ variable varx4 : std_logic_vector(5 downto 0);
+
+ begin
+ if falling_edge(CLK) then
+ if (not endfile(protokoll)) then
+ readline(protokoll,myoutline);
+ read(myoutline,varx4);
+ read_ctrl <= varx4;
+ end if;
+ end if;
+ end process;
+
STIMULI: process
file protokoll : text open read_mode is "in_obuf.txt";
variable myoutline : line;
variable var1, var2 : std_logic;
variable varx1 : std_logic_vector(2 downto 0);
variable varx2, varx3 : std_logic_vector(3 downto 0);
- variable varx4 : std_logic_vector(5 downto 0);
begin
wait on CLK;
if (not endfile(protokoll)) then
readline(protokoll,myoutline);
- read(myoutline,varx4);
- read_ctrl <= varx4;
- read(myoutline,leer);
+-- read(myoutline,varx4);
+-- read_ctrl <= varx4;
+-- read(myoutline,leer);
read(myoutline,var1);
int_dataready_in <= var1;
architecture trb_net_obuf_arch of trb_net_obuf is
signal current_output_buffer, next_output_buffer : STD_LOGIC_VECTOR (53 downto 0);
- signal current_ACK_word, current_EOB_word, current_DATA_word :
+ signal current_ACK_word, current_EOB_word, current_DATA_word, current_NOP_word :
STD_LOGIC_VECTOR (53 downto 0);
signal current_DATAREADY_OUT, next_DATAREADY_OUT : STD_LOGIC;
MED_DATA_OUT <= current_output_buffer(50 downto 0);
MED_ERROR_OUT <= current_output_buffer(53 downto 51);
- decrease_TRANSMITTED_BUFFERS <= '0';
+ decrease_TRANSMITTED_BUFFERS <= GOT_ACK_IN;
COMB_NEXT_TRANSFER : process(current_output_buffer, current_DATAREADY_OUT, sent_DATA,
- MED_READ_IN, current_DATA_word, sent_EOB)
+ MED_READ_IN, current_DATA_word, sent_EOB, sent_ACK,
+ current_EOB_word, current_ACK_word, reg_SEND_ACK_IN )
begin -- process
next_DATAREADY_OUT <= current_DATAREADY_OUT;
next_output_buffer <= current_output_buffer;
INT_READ_OUT <= '0';
increase_TRANSMITTED_BUFFERS <= '0';
next_DATA_COUNT <= CURRENT_DATA_COUNT;
+ next_SEND_ACK_IN <= reg_SEND_ACK_IN;
-- EOB should go into the stream
- if (current_DATAREADY_OUT = '0' and sent_EOB = '1')
- or (current_DATAREADY_OUT = '1' and sent_EOB = '1' and MED_READ_IN = '1' ) then
+ if (current_DATAREADY_OUT = '0' and sent_ACK = '1')
+ or (current_DATAREADY_OUT = '1' and sent_ACK = '1' and MED_READ_IN = '1' ) then
next_DATAREADY_OUT <= '1';
- next_output_buffer <= current_EOB_word;
- next_DATA_COUNT <= (others => '0');
+ next_output_buffer <= current_ACK_word;
+ next_SEND_ACK_IN <= '0';
+ else
+ next_SEND_ACK_IN <= sent_ACK;
+ if (current_DATAREADY_OUT = '0' and sent_EOB = '1')
+ or (current_DATAREADY_OUT = '1' and sent_EOB = '1' and MED_READ_IN = '1' ) then
+ next_DATAREADY_OUT <= '1';
+ next_output_buffer <= current_EOB_word;
+ next_DATA_COUNT <= (others => '0');
+ increase_TRANSMITTED_BUFFERS <= '1';
-- we have something to offer
- elsif (current_DATAREADY_OUT = '0' and sent_DATA = '1')
- or (current_DATAREADY_OUT = '1' and sent_DATA = '1' and MED_READ_IN = '1' ) then
- next_DATAREADY_OUT <= '1';
- next_output_buffer <= current_DATA_word;
- INT_READ_OUT <= '1';
- next_DATA_COUNT <= CURRENT_DATA_COUNT +1;
+ elsif (current_DATAREADY_OUT = '0' and sent_DATA = '1')
+ or (current_DATAREADY_OUT = '1' and sent_DATA = '1' and MED_READ_IN = '1' ) then
+ next_DATAREADY_OUT <= '1';
+ next_output_buffer <= current_DATA_word;
+ INT_READ_OUT <= '1';
+ if INT_DATA_IN(TYPE_POSITION) = TYPE_TRM then --TRM means EOB
+ next_DATA_COUNT <= (others => '0');
+ increase_TRANSMITTED_BUFFERS <= '1';
+ else
+ next_DATA_COUNT <= CURRENT_DATA_COUNT +1;
+ end if;
-- we will be empty in the next step
- elsif (current_DATAREADY_OUT = '0' and sent_DATA = '0')
- or (current_DATAREADY_OUT = '1' and sent_DATA = '0' and MED_READ_IN = '1' ) then
- next_DATAREADY_OUT <= '0';
+ elsif (current_DATAREADY_OUT = '0' and sent_DATA = '0')
+ or (current_DATAREADY_OUT = '1' and sent_DATA = '0' and MED_READ_IN = '1' ) then
+ next_DATAREADY_OUT <= '0';
+ next_output_buffer <= current_NOP_word;
+ end if;
end if;
end process;
sent_EOB <= '0';
end if;
end process;
+
+ current_NOP_word(TYPE_POSITION) <= TYPE_ILLEGAL;
+ current_NOP_word(47 downto 0) <= (others => '0');
+ current_NOP_word(53 downto 51) <= (others => '0');
current_DATA_word(50 downto 0) <= INT_DATA_IN;
current_DATA_word(53 downto 51) <= INT_ERROR_IN;