---------------------------------------
--- one sbuf for each type of api
+-- a sbuf on the active channel
---------------------------------------
- gen_init_sbuf: if API_TYPE = 1 generate
- INIT_SBUF: trb_net_sbuf
+ ACTIVE_SBUF: trb_net_sbuf
generic map (
DATA_WIDTH => 51,
VERSION => 1)
SYN_DATA_OUT => INT_ACTIVE_DATA_OUT,
SYN_READ_IN => INT_ACTIVE_READ_IN
);
- end generate;
+
--sbuf_free <= sbuf_next_READ or INT_INIT_READ_IN; --sbuf killed in next cycle
end process;
-
-
+---------------------------------------
+-- the state machine for the active part
+---------------------------------------
+-- gen_active_fsm : if API_TYPE = 1 generate
STATE_COMB : process(current_state, APL_SEND_IN, combined_header,
INT_ACTIVE_READ_IN, APL_WRITE_IN, fifo_to_int_empty,
fifo_to_int_data_out, combined_trailer,
fifo_to_apl_write <= '0';
next_APL_DATAREADY_OUT <= '0';
fifo_to_apl_read <= '0';
--------------------------------------------------------------------------------
--- IDLE
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- IDLE
+ -------------------------------------------------------------------------------
if current_state = IDLE then
if APL_SEND_IN = '1' then
if APL_SHORT_TRANSFER_IN = '1' and APL_WRITE_IN = '0' and fifo_to_int_empty = '1' then
else
next_state <= IDLE;
end if; -- APL_SEND_IN
--------------------------------------------------------------------------------
--- SEND_SHORT
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- SEND_SHORT
+ -------------------------------------------------------------------------------
elsif current_state = SEND_SHORT then
next_state <= SEND_SHORT;
if APL_SEND_IN = '0' then -- terminate the transfer
else
update_registered_trailer <= '1';
end if;
--------------------------------------------------------------------------------
--- SEND_HEADER
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- SEND_HEADER
+ -------------------------------------------------------------------------------
elsif current_state = SEND_HEADER then
if sbuf_free = '1' then -- kill current header
next_state <= RUNNING;
else
next_state <= SEND_HEADER;
end if;
--------------------------------------------------------------------------------
--- RUNNING
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- RUNNING
+ -------------------------------------------------------------------------------
elsif current_state = RUNNING then
if APL_SEND_IN = '0' then -- terminate the transfer
if fifo_to_int_empty = '1' then -- immediate stop
fifo_to_int_read <= '1';
end if; -- fifo_to_int_empty = '0'
end if;
--------------------------------------------------------------------------------
--- SHUTDOWN: Empty the pipe
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- SHUTDOWN: Empty the pipe
+ -------------------------------------------------------------------------------
elsif current_state = SHUTDOWN then
next_state <= SHUTDOWN;
if fifo_to_int_empty = '0' and sbuf_free = '1' then
next_INT_ACTIVE_DATAREADY_OUT <= '1';
out_select <= TRM;
end if;
--------------------------------------------------------------------------------
--- SEND_TRAILER
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- SEND_TRAILER
+ -------------------------------------------------------------------------------
elsif current_state = SEND_TRAILER then
if sbuf_free = '1' then -- kill current trailer
next_state <= WAITING;
else
next_state <= SEND_TRAILER;
end if;
--------------------------------------------------------------------------------
--- WAITING => for the answer
--------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
+ -- WAITING => for the answer or a request
+ -------------------------------------------------------------------------------
elsif current_state = WAITING then
next_state <= WAITING;
-- here we have to supply the receiver port
-- OPEN QUESTION: Address matching? makes sense for a reply transfer?
end if; -- end state switch
end process;
+-- end generate;
+
+---------------------------------------
+-- the state machine for the passive part
+---------------------------------------
+-- gen_passive_fsm : if API_TYPE = 0 generate
+-- STATE_COMB : process(current_state, APL_SEND_IN, combined_header,
+-- INT_ACTIVE_READ_IN, APL_WRITE_IN, fifo_to_int_empty,
+-- fifo_to_int_data_out, combined_trailer,
+-- next_registered_trailer, fifo_to_int_data_out,
+-- fifo_to_apl_empty, INT_PASSIVE_DATAREADY_IN,
+-- reg_INT_PASSIVE_READ_OUT,fifo_to_apl_read,
+-- reg_APL_DATAREADY_OUT, fifo_to_apl_data_out,
+-- reg_APL_DATAREADY_OUT, APL_READ_IN, sbuf_free,
+-- reg_APL_TYP_OUT, APL_SHORT_TRANSFER_IN, fifo_to_apl_full)
+-- begin
+-- next_state <= MY_ERROR;
+-- next_INT_ACTIVE_DATAREADY_OUT <= '0';
+-- out_select <= DAT;
+-- update_registered_trailer <= '0';
+-- fifo_to_int_read <= '0';
+-- next_INT_PASSIVE_READ_OUT <= '0';
+-- fifo_to_apl_write <= '0';
+-- next_APL_DATAREADY_OUT <= '0';
+-- fifo_to_apl_read <= '0';
+--
+-- if current_state = then
+-- next_state <= WAITING;
+-- -- here we have to supply the receiver port
+-- -- part 1: connection to network
+-- if fifo_to_apl_full = '0' or (fifo_to_apl_read = '1' and reg_APL_DATAREADY_OUT = '1') then
+-- next_INT_PASSIVE_READ_OUT <= '1';
+-- end if;
+-- if reg_INT_PASSIVE_READ_OUT = '1' and INT_PASSIVE_DATAREADY_IN = '1' then
+-- fifo_to_apl_write <= '1'; -- use fifo as the pipe
+-- end if;
+--
+-- -- part 2: connection to apl
+-- if (fifo_to_apl_empty = '0') then
+-- next_APL_DATAREADY_OUT <= '1';
+-- end if; -- read/no read
+--
+-- if reg_APL_DATAREADY_OUT = '1' and APL_READ_IN = '1' then
+-- -- valid read
+-- fifo_to_apl_read <= '1';
+-- if reg_APL_TYP_OUT = TYPE_TRM and (fifo_to_apl_read = '1' and reg_APL_DATAREADY_OUT = '1') then -- transfer completely finished
+-- next_state <= IDLE;
+-- end if;
+-- end if;
+-- -- MISSING: SEQNR check
+-- -- OPEN QUESTION: Address matching? makes sense for a reply transfer?
+--
+--
+-- end if;
+-- end process;
+-- end generate;
+---------------------------------------
+--
+---------------------------------------
+
-- combine the next header
combined_header(F1_POSITION) <= APL_MY_ADDRESS_IN;
combined_header(F2_POSITION) <= APL_TARGET_ADDRESS_IN;
if RESET = '1' then
sequence_counter <= (others => '0');
reg_INT_PASSIVE_READ_OUT <= '0';
- current_state <= IDLE;
+ if API_TYPE = 1 then
+ current_state <= IDLE;
+ else
+ current_state <= WAITING;
+ end if;
tb_current_state <= IDLE;
tb_registered_trailer <= (others => '0');
tb_registered_target <= ILLEGAL_ADRESS;