]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
some updates
authorhadeshyp <hadeshyp>
Mon, 24 Dec 2007 23:16:09 +0000 (23:16 +0000)
committerhadeshyp <hadeshyp>
Mon, 24 Dec 2007 23:16:09 +0000 (23:16 +0000)
13 files changed:
trb_net16_api_base.vhd
trb_net16_endpoint_0_trg_1_api.vhd
trb_net16_endpoint_1_trg_1_api.vhd
trb_net16_fifo.vhd
trb_net16_hub_base.vhd
trb_net16_hub_logic.vhd
trb_net16_ibuf.vhd
trb_net16_iobuf.vhd
trb_net16_obuf_nodata.vhd [new file with mode: 0644]
trb_net16_term.vhd
trb_net16_term_buf.vhd
trb_net_fifo_16bit_bram_dualport.vhd
trb_net_sbuf.vhd

index c9e3082278c5263001a0ae83b1135a47773daae5..19c17b0f3135bdb3d99cfd25c9672c507b770f74 100644 (file)
@@ -9,7 +9,7 @@ use work.trb_net_std.all;
 entity trb_net16_api_base is
 
   generic (
-    API_TYPE : integer := 1;              -- type of api: 0 passive, 1 active
+    API_TYPE : integer := 0;              -- type of api: 0 passive, 1 active
     --FIFO size is given in 2^(n+1) 64Bit-packets i.e. 2^(n+3) 16bit packets
     FIFO_TO_INT_DEPTH : integer := 1;     -- direction to medium
     FIFO_TO_APL_DEPTH : integer := 1;     -- direction to application
@@ -388,9 +388,9 @@ begin
   STAT_FIFO_TO_APL(10)           <= reg_APL_DATAREADY_OUT;
 
 ---------------------------------------
--- a sbuf on the active channel
+-- a sbuf (to_int direction)
 ---------------------------------------
-  ACTIVE_SBUF: trb_net16_sbuf
+  SBUF: trb_net16_sbuf
     generic map (
       DATA_WIDTH => 16,
       NUM_WIDTH  => 2,
@@ -510,7 +510,7 @@ begin
         next_wait_for_answer <= '0';
         get_slave_running <= '0';
 
-        if reg_APL_TYP_OUT = TYPE_TRM and reg_APL_PACKET_NUM_OUT = "11" and APL_READ_IN = '1' then
+        if reg_APL_TYP_OUT = TYPE_TRM and reg_APL_PACKET_NUM_OUT = "11" and (APL_READ_IN = '1' or state_to_apl = WRONG_ADDR) then
           next_state_to_apl <= IDLE;
         end if;
 
index 7e427260384752ff4642396857b8dac492d1402e..48f7f1cbf0be36097b81390a3c8ab1f2fbe52c35 100644 (file)
@@ -11,8 +11,8 @@ use work.trb_net_std.all;
 entity trb_net16_endpoint_0_trg_1_api is
 
   generic (
-    API_TYPE                : integer range 0 to 1 := 1;
-    INIT_DEPTH              : integer range 0 to 6 := 0;
+    API_TYPE                : integer range 0 to 1 := 0;
+    INIT_DEPTH              : integer range 0 to 6 := 1;
     REPLY_DEPTH             : integer range 0 to 6 := 1;
     FIFO_TO_INT_DEPTH       : integer range 0 to 6 := 1;
     FIFO_TO_APL_DEPTH       : integer range 0 to 6 := 1;
@@ -20,6 +20,9 @@ entity trb_net16_endpoint_0_trg_1_api is
     MUX_WIDTH               : integer range 1 to 5 := 3;
     MUX_SECURE_MODE         : integer range 0 to 1 := 0;
     IBUF_SECURE_MODE        : integer range 0 to 1 := 1;
+    IOBUF_USE_ACKNOWLEDGE   : integer range 0 to 1 := 1;
+    INIT_CAN_SEND_DATA      : integer range 0 to 1 := 1;
+    REPLY_CAN_SEND_DATA     : integer range 0 to 1 := 1;
     DAT_CHANNEL             : integer range 0 to 3 := 0; --range 0 to 2**(MUX_WIDTH-1)
     DATA_WIDTH              : integer := 16;
     NUM_WIDTH               : integer := 2
@@ -90,10 +93,15 @@ architecture trb_net16_endpoint_0_trg_1_api_arch of trb_net16_endpoint_0_trg_1_a
 
 component trb_net16_iobuf is
 
-  generic (INIT_DEPTH : integer := 3; 
-           REPLY_DEPTH : integer := 3;
-           IBUF_SECURE_MODE : integer range 0 to 1 := 1);
-
+  generic (
+    INIT_DEPTH           : integer := 1;
+    REPLY_DEPTH          : integer := 1;
+    IBUF_SECURE_MODE     : integer range 0 to 1 := 1;
+               --use sbuf in med_to_api direction?
+    USE_ACKNOWLEDGE      : integer range 0 to 1 := 0;
+    INIT_CAN_SEND_DATA   : integer range 0 to 1 := 0;
+    REPLY_CAN_SEND_DATA  : integer range 0 to 1 := 1
+    );
   port(
     --  Misc
     CLK    : in std_logic;      
@@ -169,9 +177,6 @@ component trb_net16_api_base is
                                           -- for the direction to
                                           -- internal world
     FIFO_TO_APL_DEPTH : integer := 3;     -- direction to application
-    FIFO_TERM_BUFFER_DEPTH  : integer := 0;  -- fifo for auto-answering of
-                                        -- the master path, if set to 0
-                                        -- no buffer is used at all
     SBUF_VERSION : integer range 0 to 1 := 0
     );
 
@@ -416,7 +421,6 @@ begin
         API_TYPE => 1,
         FIFO_TO_INT_DEPTH => FIFO_TO_INT_DEPTH,
         FIFO_TO_APL_DEPTH => FIFO_TO_APL_DEPTH,
-        FIFO_TERM_BUFFER_DEPTH => 0,
         SBUF_VERSION => SBUF_VERSION
         )
       port map (
@@ -474,7 +478,6 @@ begin
         API_TYPE => 0,
         FIFO_TO_INT_DEPTH => FIFO_TO_INT_DEPTH,
         FIFO_TO_APL_DEPTH => FIFO_TO_APL_DEPTH,
-        FIFO_TERM_BUFFER_DEPTH => 0,
         SBUF_VERSION => SBUF_VERSION
         )
       port map (
@@ -546,10 +549,14 @@ STAT_api_control_signals(29) <= buf_api_stat_fifo_to_apl(14);
 
 IOBUF: trb_net16_iobuf
 
-  generic map (INIT_DEPTH => INIT_DEPTH,
-               REPLY_DEPTH => REPLY_DEPTH,
-               IBUF_SECURE_MODE => IBUF_SECURE_MODE)
-
+  generic map (
+    INIT_DEPTH => INIT_DEPTH,
+    REPLY_DEPTH => REPLY_DEPTH,
+    IBUF_SECURE_MODE => IBUF_SECURE_MODE,
+    USE_ACKNOWLEDGE  => IOBUF_USE_ACKNOWLEDGE,
+    INIT_CAN_SEND_DATA  => INIT_CAN_SEND_DATA,
+    REPLY_CAN_SEND_DATA => REPLY_CAN_SEND_DATA
+    )
   port map (
     --  Misc
     CLK     => CLK ,
index 4d425b6fd1428d89fadfc726f8a05186f775d683..1654af035cbcab0ebc32e499f60b822aac266830 100644 (file)
@@ -184,9 +184,7 @@ architecture trb_net16_endpoint_1_trg_1_api_arch of trb_net16_endpoint_1_trg_1_a
     generic (API_TYPE : integer := API_TYPE;              -- type of api: 0 passive, 1 active
             --FIFO size is given in 2^(n+1) 64Bit-packets i.e. 2^(n+3) 16bit packets
             FIFO_TO_INT_DEPTH : integer := 1;     -- direction to medium
-            FIFO_TO_APL_DEPTH : integer := 1;     -- direction to application
-            FIFO_TERM_BUFFER_DEPTH  : integer := 0);  -- fifo for auto-answering master path
-                                                  -- if set to 0, no buffer is used
+            FIFO_TO_APL_DEPTH : integer := 1);     -- direction to application
     port(
       --  Misc
       CLK    : in std_logic;
@@ -241,9 +239,6 @@ architecture trb_net16_endpoint_1_trg_1_api_arch of trb_net16_endpoint_1_trg_1_a
 
   component trb_net16_term is
     generic (
-      FIFO_TERM_BUFFER_DEPTH  : integer := 0;  -- fifo for auto-answering of
-                                                -- the master path, if set to 0
-                                                -- no buffer is used at all
       SECURE_MODE : integer range 0 to 1 := 0
                --if secure_mode is not used, apl must provide error pattern and dtype until
                --next trigger comes in. In secure mode these must be available when hold_trm goes low
@@ -494,8 +489,7 @@ begin
       generic map (
         API_TYPE => 1,
         FIFO_TO_INT_DEPTH => DAT_FIFO_TO_INT_DEPTH,
-        FIFO_TO_APL_DEPTH => DAT_FIFO_TO_APL_DEPTH,
-        FIFO_TERM_BUFFER_DEPTH => 0
+        FIFO_TO_APL_DEPTH => DAT_FIFO_TO_APL_DEPTH
         )
       port map (
         --  Misc
@@ -551,8 +545,7 @@ begin
       generic map (
         API_TYPE => 0,
         FIFO_TO_INT_DEPTH => DAT_FIFO_TO_INT_DEPTH,
-        FIFO_TO_APL_DEPTH => DAT_FIFO_TO_APL_DEPTH,
-        FIFO_TERM_BUFFER_DEPTH => 0
+        FIFO_TO_APL_DEPTH => DAT_FIFO_TO_APL_DEPTH
         )
       port map (
         --  Misc
@@ -762,7 +755,6 @@ DAT_IOBUF: trb_net16_iobuf
   
   TRG_INIT : trb_net16_term
     generic map (
-      FIFO_TERM_BUFFER_DEPTH => 0,
       SECURE_MODE => TRG_SECURE_MODE
       )
     port map(
index 0a3c9889bca59520d0ecfb85f0b4d5e085eccaed..5468600f9e380d0cca4e95dbb072ee5354dbba00 100644 (file)
@@ -16,7 +16,7 @@ entity trb_net16_fifo is
     generic (
       DATA_WIDTH : integer := 16;     -- FIFO word width
       NUM_WIDTH  : integer := 2;
-      DEPTH      : integer := 1       -- Depth of the FIFO, 2^(n+1) 64Bit packets
+      DEPTH      : integer := 6       -- Depth of the FIFO, 2^(n+1) 64Bit packets
       );
     port (
       CLK    : in std_logic;
index 7f67aecd4ec4ff892a1580b3fc41876bc483c38e..6d78455d2543b6be243815fd2186aff5c0cc6636 100644 (file)
@@ -19,7 +19,7 @@ entity trb_net16_hub_base is
     HUB_CTRL_CHANNELNUM     : integer range 0 to 3 := 0;
     HUB_CTRL_DEPTH          : integer range 0 to 6 := 1;
     HUB_CTRL_REG_ADDR_WIDTH : integer range 1 to 7 := 4;
-    IBUF_SECURE_MODE        : integer range 0 to 1 := 1;
+    IBUF_SECURE_MODE        : integer range 0 to 1 := 0;
   --media interfaces
     MII_NUMBER              : integer range 2 to 16 := 12;
 --each row is one media interface and each column is one channel. starting with 0,0, ending with 15,15
@@ -347,7 +347,6 @@ end component;
       API_TYPE : integer := 1;
       FIFO_TO_INT_DEPTH : integer := 1;
       FIFO_TO_APL_DEPTH : integer := 1;
-      FIFO_TERM_BUFFER_DEPTH  : integer := 0;
       SBUF_VERSION      : integer := 0);
     port(
       --  Misc
@@ -400,9 +399,6 @@ end component;
 
   component trb_net16_term is
     generic (
-      FIFO_TERM_BUFFER_DEPTH  : integer := 0;  -- fifo for auto-answering of
-                                                -- the master path, if set to 0
-                                                -- no buffer is used at all
       SECURE_MODE : integer range 0 to 1 := 0
                --if secure_mode is not used, apl must provide error pattern and dtype until
                --next trigger comes in. In secure mode these must be available when hold_trm goes low
@@ -490,6 +486,8 @@ begin
 
 --generate multiplexers
   gen_muxes: for i in 0 to MII_NUMBER-1 generate
+    constant t : integer := 0;
+  begin
     MPLEX: trb_net16_io_multiplexer
       generic map (
         DATA_WIDTH  => DATA_WIDTH,
@@ -524,6 +522,7 @@ begin
 
 --generate IOBufs for MII
   gen_iobufs: for i in 0 to MII_NUMBER*2**(MUX_WIDTH-1)-1 generate
+    constant t : integer := 0;
   begin
     IOBUF: trb_net16_iobuf
       generic map (
@@ -600,8 +599,7 @@ begin
       generic map(
         API_TYPE               => 0,
         FIFO_TO_INT_DEPTH      => HUB_CTRL_DEPTH,
-        FIFO_TO_APL_DEPTH      => HUB_CTRL_DEPTH,
-        FIFO_TERM_BUFFER_DEPTH => 0
+        FIFO_TO_APL_DEPTH      => HUB_CTRL_DEPTH
         )
       port map(
         --  Misc
@@ -658,12 +656,13 @@ begin
       constant aploffset : integer := i - offset;
     begin
       gen_pas_api : if API_TYPE(aploffset) = 0 generate
+        constant t : integer := 0;
+      begin      
         PAS_API : trb_net16_api_base
           generic map(
             API_TYPE               => API_TYPE(aploffset),
             FIFO_TO_INT_DEPTH      => API_FIFO_TO_INT_DEPTH(aploffset),
-            FIFO_TO_APL_DEPTH      => API_FIFO_TO_APL_DEPTH(aploffset),
-            FIFO_TERM_BUFFER_DEPTH => 0
+            FIFO_TO_APL_DEPTH      => API_FIFO_TO_APL_DEPTH(aploffset)
             )
           port map(
             --  Misc
@@ -714,12 +713,13 @@ begin
             );
       end generate;
       gen_act_api : if API_TYPE(aploffset) = 1 generate
+        constant t : integer := 0;
+      begin      
         ACT_API : trb_net16_api_base
           generic map(
             API_TYPE               => API_TYPE(aploffset),
             FIFO_TO_INT_DEPTH      => API_FIFO_TO_INT_DEPTH(aploffset),
-            FIFO_TO_APL_DEPTH      => API_FIFO_TO_APL_DEPTH(aploffset),
-            FIFO_TERM_BUFFER_DEPTH => 0
+            FIFO_TO_APL_DEPTH      => API_FIFO_TO_APL_DEPTH(aploffset)
             )
           port map(
             --  Misc
@@ -778,7 +778,6 @@ begin
    begin
     TRG : trb_net16_term
       generic map (
-        FIFO_TERM_BUFFER_DEPTH => 0,
         SECURE_MODE => TRG_SECURE_MODE
         )
       port map(
index 29fea129677014f9b94dda3014262d76c3d4c0ad..0e758b5198384ca4e49db1d7a1fff7a45fe70259 100644 (file)
@@ -214,7 +214,7 @@ STAT_ERRORBITS <= REPLY_combined_trm_F1 & REPLY_combined_trm_F2;
   INIT_READ_OUT <= buf_INIT_READ_OUT;
 
   gen_iro : for i in 0 to POINT_NUMBER-1 generate
-    buf_INIT_READ_OUT(i) <= init_arbiter_read_out(i) and not init_locked;
+    buf_INIT_READ_OUT(i) <= init_arbiter_read_out(i) and not init_locked and INIT_muxed_READ;
   end generate;
 
   gen_init_pool_data0: for i in 0 to DATA_WIDTH-1 generate
@@ -474,7 +474,7 @@ STAT_ERRORBITS <= REPLY_combined_trm_F1 & REPLY_combined_trm_F2;
       CTRL => (others => '0')
       );
 
-  reply_arbiter_input <= REPLY_DATAREADY_IN;
+  reply_arbiter_input <= REPLY_DATAREADY_IN and not REPLY_reading_trm;
 
   -- we have to care to read multiples of four packets from every point
   -- release is currently done after first packet of TRM
@@ -507,7 +507,7 @@ STAT_ERRORBITS <= REPLY_combined_trm_F1 & REPLY_combined_trm_F2;
       end if;
     end process;
 
-  reply_arbiter_CLK_EN <= not reply_point_lock;        --1 cycle too late?
+  reply_arbiter_CLK_EN <= not next_point_lock;
 
 
 
@@ -558,7 +558,7 @@ STAT_ERRORBITS <= REPLY_combined_trm_F1 & REPLY_combined_trm_F2;
         comb_REPLY_POOL_DATAREADY  <= comb_REPLY_muxed_DATAREADY;
         comb_REPLY_POOL_DATA       <= comb_REPLY_muxed_DATA;
         comb_REPLY_POOL_PACKET_NUM <= comb_REPLY_muxed_PACKET_NUM;
-        if send_reply_trm = '1' and comb_REPLY_muxed_PACKET_NUM = "11" then
+        if send_reply_trm = '1' then
           next_state <= SENDING_REPLY_TRM;
         end if;
       end if;
index f063051320c86a909f6086e3e14b6c99d35c1802..5f8fc771a8d2d705ac9275e6902ba7ebe8d107cb 100644 (file)
@@ -11,7 +11,8 @@ use work.trb_net_std.all;
 entity trb_net16_ibuf is
   generic (
     DEPTH : integer range 0 to 7 := 1;
-    IBUF_SECURE_MODE : integer range 0 to 1 := 1
+    USE_ACKNOWLEDGE : integer range 0 to 1 := 1;
+    IBUF_SECURE_MODE : integer range 0 to 1 := 0
                  --use sbuf in med_to_api direction?
     );
   port(
@@ -186,7 +187,7 @@ begin
       next_rec_buffer_size_out <= current_rec_buffer_size_out;
       next_error_state <= current_error_state;
       if MED_DATAREADY_IN = '1' and reg_read_out= '1' then
-        if current_packet_type = TYPE_ACK then
+        if current_packet_type = TYPE_ACK and USE_ACKNOWLEDGE = 1 then
           if MED_PACKET_NUM_IN = "00" and current_error_state /= GOT_OVERFLOW_ERROR then
             got_ack_internal <=   '1';
           end if;
@@ -246,6 +247,14 @@ begin
         );
 
     sbuf_free <= comb_next_read or INT_READ_IN;  --sbuf killed
+  end generate;
+  gen_notsecure : if IBUF_SECURE_MODE = 0 generate
+   INT_DATA_OUT <= tmp_INT_DATA_OUT;
+   INT_DATAREADY_OUT <= tmp_INT_DATAREADY_OUT;
+   INT_PACKET_NUM_OUT <= tmp_INT_PACKET_NUM_OUT;
+   sbuf_free <= '1';
+  end generate;
+
 
   -- this process controls what will be forwarded to the internal point
     DATA_OUT : process (INT_HEADER_IN, fifo_data_out,
@@ -257,51 +266,27 @@ begin
       tmp_INT_DATAREADY_OUT <= '0';
       got_eob_out <= '0';
       got_locked  <= is_locked;
-      fifo_read <= sbuf_free and not fifo_empty;
-      if current_fifo_packet_type = TYPE_EOB and fifo_packet_num_out = "00" then
+      if IBUF_SECURE_MODE = 1 then
+        fifo_read <= sbuf_free and not fifo_empty;
+      else
+        fifo_read <= INT_READ_IN and buf_INT_DATAREADY_OUT and not fifo_empty;
+      end if;
+      if current_fifo_packet_type = TYPE_EOB and fifo_packet_num_out = "00" and USE_ACKNOWLEDGE = 1 then
         tmp_INT_DATA_OUT(2 downto 0) <= TYPE_DAT;
       end if;
       if fifo_empty = '0' and sbuf_free = '1' then
         tmp_INT_DATAREADY_OUT <= '1';
-        if (current_fifo_packet_type = TYPE_EOB or current_fifo_packet_type = TYPE_TRM)
-                                  and fifo_packet_num_out = "11" then
-          got_eob_out <= '1';
-        end if;
-        if current_fifo_packet_type = TYPE_TRM then
-          got_locked <= is_locked or not release_locked;
-        end if;
-      end if;
-    end process;
-  end generate;
-
-  gen_notsecure : if IBUF_SECURE_MODE = 0 generate
-   DATA_OUT : process (INT_HEADER_IN, fifo_data_out, INT_READ_IN,
-                        release_locked, is_locked, sbuf_free, fifo_empty,
-                        fifo_packet_num_out, current_fifo_packet_type)
-    begin
-      INT_DATA_OUT <= fifo_data_out;
-      INT_PACKET_NUM_OUT <= fifo_packet_num_out;
-      buf_INT_DATAREADY_OUT <= '0';
-      got_eob_out <= '0';
-      got_locked  <= is_locked;
-      fifo_read <= INT_READ_IN and buf_INT_DATAREADY_OUT and not fifo_empty;
-      if current_fifo_packet_type = TYPE_EOB and fifo_packet_num_out = "00" then
-        INT_DATA_OUT(2 downto 0) <= TYPE_DAT;
-      end if;
-      if fifo_empty = '0' then
-        buf_INT_DATAREADY_OUT <= '1';
-        if (current_fifo_packet_type = TYPE_EOB or current_fifo_packet_type = TYPE_TRM)
-                                  and fifo_packet_num_out = "11" then
-          got_eob_out <= '1';
-        end if;
-        if current_fifo_packet_type = TYPE_TRM then
-          got_locked <= is_locked or not release_locked;
+        if USE_ACKNOWLEDGE = 1 then
+          if (current_fifo_packet_type = TYPE_EOB or current_fifo_packet_type = TYPE_TRM)
+                                    and fifo_packet_num_out = "11" then
+            got_eob_out <= '1';
+          end if;
+          if current_fifo_packet_type = TYPE_TRM then
+            got_locked <= is_locked or not release_locked;
+          end if;
         end if;
       end if;
     end process;
-    INT_DATAREADY_OUT <= buf_INT_DATAREADY_OUT;
-  end generate;
-
 
 
 --BUGBUG HDR retransmit needed
@@ -309,22 +294,24 @@ begin
   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;
-        else
-          is_locked <= is_locked;
-          reg_eob_out <= reg_eob_out;
+
+  gen_ack1 : if USE_ACKNOWLEDGE = 1 generate
+    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;
+          else
+            is_locked <= is_locked;
+            reg_eob_out <= reg_eob_out;
+          end if;
         end if;
-      end if;
-    end process;
+      end process;
+  end generate;
 
 --saving last HDR
   reading_header <= '1' when (current_fifo_packet_type = TYPE_HDR and fifo_empty = '0') else '0';
@@ -362,9 +349,16 @@ begin
   
 -- make STAT_BUFFER
   STAT_BUFFER(3 downto 0) <= (fifo_depth(3 downto 0));
-  STAT_BUFFER(7 downto 4) <= current_rec_buffer_size_out;
-  STAT_BUFFER(8) <= reg_eob_out;
-  STAT_BUFFER(9) <= reg_ack_internal;
+
+  gen_ack2 : if USE_ACKNOWLEDGE = 1 generate
+    STAT_BUFFER(7 downto 4) <= current_rec_buffer_size_out;
+    STAT_BUFFER(8) <= reg_eob_out;
+    STAT_BUFFER(9) <= reg_ack_internal;
+  end generate;
+  gen_ack3 : if USE_ACKNOWLEDGE = 0 generate
+    STAT_BUFFER(9 downto 4) <= (others => '0');
+  end generate;
+
 
   MAKE_ERROR_BITS : process(current_error_state)
     begin
index efdec3ebcab1ec766ede7722720701b283655ec2..7295c92497f0a136c75b4d9ebaaac84ce4e6e120 100644 (file)
@@ -14,8 +14,11 @@ entity trb_net16_iobuf is
   generic (
     INIT_DEPTH : integer := 1;
     REPLY_DEPTH : integer := 1;
-    IBUF_SECURE_MODE : integer range 0 to 1 := 0
+    IBUF_SECURE_MODE : integer range 0 to 1 := 1;
                --use sbuf in med_to_api direction?
+    USE_ACKNOWLEDGE  : integer range 0 to 1 := 1;
+    INIT_CAN_SEND_DATA  : integer range 0 to 1 := 1;
+    REPLY_CAN_SEND_DATA  : integer range 0 to 1 := 1
     );
   port(
     --  Misc
@@ -89,7 +92,9 @@ architecture trb_net16_iobuf_arch of trb_net16_iobuf is
 
   component trb_net16_obuf is
     generic (
-      DATA_COUNT_WIDTH : integer := 5
+      DATA_COUNT_WIDTH : integer := 5;
+      CAN_SEND_DATA  : integer range 0 to 1 := 1;
+      USE_ACKNOWLEDGE : integer range 0 to 1
       );
     port(
       --  Misc
@@ -114,9 +119,29 @@ architecture trb_net16_iobuf_arch of trb_net16_iobuf is
       );
   end component;
 
+  component trb_net16_obuf_nodata is
+    port(
+      --  Misc
+      CLK    : in std_logic;
+      RESET  : in std_logic;
+      CLK_EN : in std_logic;
+      --  Media direction port
+      MED_DATAREADY_OUT: out std_logic;
+      MED_DATA_OUT:      out std_logic_vector (15 downto 0); -- Data word
+      MED_PACKET_NUM_OUT:out std_logic_vector(1 downto 0);
+      MED_READ_IN:       in  std_logic;
+      --STAT
+      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);
+      CTRL_BUFFER:       in  std_logic_vector (31 downto 0)
+      );
+  end component;
+
   component trb_net16_ibuf is
     generic (
       DEPTH : integer range 0 to 7 := 1;
+      USE_ACKNOWLEDGE : integer range 0 to 1;
       IBUF_SECURE_MODE : integer range 0 to 1 := 1
                --use sbuf in med_to_api direction?
       );
@@ -203,6 +228,7 @@ begin
     INITIBUF : trb_net16_ibuf
       generic map (
         DEPTH => INIT_DEPTH,
+        USE_ACKNOWLEDGE => USE_ACKNOWLEDGE,
         IBUF_SECURE_MODE => IBUF_SECURE_MODE)
       port map (
         CLK       => CLK,
@@ -229,6 +255,7 @@ begin
     REPLYIBUF : trb_net16_ibuf
       generic map (
         DEPTH => REPLY_DEPTH,
+        USE_ACKNOWLEDGE => USE_ACKNOWLEDGE,
         IBUF_SECURE_MODE => IBUF_SECURE_MODE)
       port map (
         CLK       => CLK,
@@ -297,43 +324,125 @@ begin
         );
   end generate;
 
-  INITOBUF : trb_net16_obuf
-    port map (
-      CLK       => CLK,
-      RESET     => RESET,
-      CLK_EN    => CLK_EN,
-      MED_DATAREADY_OUT => MED_INIT_DATAREADY_OUT,
-      MED_DATA_OUT => MED_INIT_DATA_OUT,
-      MED_PACKET_NUM_OUT => MED_INIT_PACKET_NUM_OUT,
-      MED_READ_IN => MED_INIT_READ_IN,
-      INT_DATAREADY_IN => INT_INIT_DATAREADY_IN,
-      INT_DATA_IN => INT_INIT_DATA_IN,
-      INT_PACKET_NUM_IN => INT_INIT_PACKET_NUM_IN,
-      INT_READ_OUT => INT_INIT_READ_OUT,
-      STAT_LOCKED(15 downto 0) => INITOBUF_stat_locked,
-      CTRL_LOCKED(15 downto 0) => INITOBUF_ctrl_locked,
-      STAT_BUFFER(31 downto 0) => INITOBUF_stat_buffer,
-      CTRL_BUFFER(31 downto 0) => INITOBUF_ctrl_buffer
-      );
+  genINITOBUF1 : if INIT_CAN_SEND_DATA = 1 generate
+    INITOBUF : trb_net16_obuf
+      generic map (
+        USE_ACKNOWLEDGE => USE_ACKNOWLEDGE
+        )
+      port map (
+        CLK       => CLK,
+        RESET     => RESET,
+        CLK_EN    => CLK_EN,
+        MED_DATAREADY_OUT => MED_INIT_DATAREADY_OUT,
+        MED_DATA_OUT => MED_INIT_DATA_OUT,
+        MED_PACKET_NUM_OUT => MED_INIT_PACKET_NUM_OUT,
+        MED_READ_IN => MED_INIT_READ_IN,
+        INT_DATAREADY_IN => INT_INIT_DATAREADY_IN,
+        INT_DATA_IN => INT_INIT_DATA_IN,
+        INT_PACKET_NUM_IN => INT_INIT_PACKET_NUM_IN,
+        INT_READ_OUT => INT_INIT_READ_OUT,
+        STAT_LOCKED(15 downto 0) => INITOBUF_stat_locked,
+        CTRL_LOCKED(15 downto 0) => INITOBUF_ctrl_locked,
+        STAT_BUFFER(31 downto 0) => INITOBUF_stat_buffer,
+        CTRL_BUFFER(31 downto 0) => INITOBUF_ctrl_buffer
+        );
+  end generate;
+  genINITOBUF2 : if INIT_CAN_SEND_DATA = 0 generate
+    gen_INITOBUF3 : if USE_ACKNOWLEDGE = 1 generate
+      INITOBUF : trb_net16_obuf_nodata
+        port map (
+          CLK       => CLK,
+          RESET     => RESET,
+          CLK_EN    => CLK_EN,
+          MED_DATAREADY_OUT => MED_INIT_DATAREADY_OUT,
+          MED_DATA_OUT => MED_INIT_DATA_OUT,
+          MED_PACKET_NUM_OUT => MED_INIT_PACKET_NUM_OUT,
+          MED_READ_IN => MED_INIT_READ_IN,
+          STAT_LOCKED(15 downto 0) => INITOBUF_stat_locked,
+          CTRL_LOCKED(15 downto 0) => INITOBUF_ctrl_locked,
+          STAT_BUFFER(31 downto 0) => INITOBUF_stat_buffer,
+          CTRL_BUFFER(31 downto 0) => INITOBUF_ctrl_buffer
+          );
+      INT_INIT_READ_OUT <= '0';
+    end generate;
+    gen_INITOBUF4 : if USE_ACKNOWLEDGE = 0 generate
+      MED_INIT_DATAREADY_OUT <= '0';
+      MED_INIT_DATA_OUT <= (others => '0');
+      MED_INIT_PACKET_NUM_OUT <= (others => '0');
+    end generate;
+  end generate;
 
-  REPLYOBUF : trb_net16_obuf
-    port map (
-      CLK       => CLK,
-      RESET     => RESET,
-      CLK_EN    => CLK_EN,
-      MED_DATAREADY_OUT => MED_REPLY_DATAREADY_OUT,
-      MED_DATA_OUT => MED_REPLY_DATA_OUT,
-      MED_PACKET_NUM_OUT => MED_REPLY_PACKET_NUM_OUT,
-      MED_READ_IN => MED_REPLY_READ_IN,
-      INT_DATAREADY_IN => INT_REPLY_DATAREADY_IN,
-      INT_DATA_IN => INT_REPLY_DATA_IN,
-      INT_PACKET_NUM_IN => INT_REPLY_PACKET_NUM_IN,
-      INT_READ_OUT => INT_REPLY_READ_OUT,
-      STAT_LOCKED(15 downto 0) => REPLYOBUF_stat_locked,
-      CTRL_LOCKED(15 downto 0) => REPLYOBUF_ctrl_locked,
-      STAT_BUFFER(31 downto 0) => REPLYOBUF_stat_buffer,
-      CTRL_BUFFER(31 downto 0) => REPLYOBUF_ctrl_buffer
-      );
+
+  genREPLYOBUF1 : if REPLY_CAN_SEND_DATA = 1 generate
+    REPLYOBUF : trb_net16_obuf
+      generic map (
+        USE_ACKNOWLEDGE => USE_ACKNOWLEDGE
+        )
+      port map (
+        CLK       => CLK,
+        RESET     => RESET,
+        CLK_EN    => CLK_EN,
+        MED_DATAREADY_OUT => MED_REPLY_DATAREADY_OUT,
+        MED_DATA_OUT => MED_REPLY_DATA_OUT,
+        MED_PACKET_NUM_OUT => MED_REPLY_PACKET_NUM_OUT,
+        MED_READ_IN => MED_REPLY_READ_IN,
+        INT_DATAREADY_IN => INT_REPLY_DATAREADY_IN,
+        INT_DATA_IN => INT_REPLY_DATA_IN,
+        INT_PACKET_NUM_IN => INT_REPLY_PACKET_NUM_IN,
+        INT_READ_OUT => INT_REPLY_READ_OUT,
+        STAT_LOCKED(15 downto 0) => REPLYOBUF_stat_locked,
+        CTRL_LOCKED(15 downto 0) => REPLYOBUF_ctrl_locked,
+        STAT_BUFFER(31 downto 0) => REPLYOBUF_stat_buffer,
+        CTRL_BUFFER(31 downto 0) => REPLYOBUF_ctrl_buffer
+        );
+  end generate;
+  genREPLYOBUF2 : if REPLY_CAN_SEND_DATA = 0 generate
+    gen_REPLYOBUF3 : if USE_ACKNOWLEDGE = 1 generate
+      REPLYOBUF : trb_net16_obuf_nodata
+        port map (
+          CLK       => CLK,
+          RESET     => RESET,
+          CLK_EN    => CLK_EN,
+          MED_DATAREADY_OUT => MED_REPLY_DATAREADY_OUT,
+          MED_DATA_OUT => MED_REPLY_DATA_OUT,
+          MED_PACKET_NUM_OUT => MED_REPLY_PACKET_NUM_OUT,
+          MED_READ_IN => MED_REPLY_READ_IN,
+          STAT_LOCKED(15 downto 0) => REPLYOBUF_stat_locked,
+          CTRL_LOCKED(15 downto 0) => REPLYOBUF_ctrl_locked,
+          STAT_BUFFER(31 downto 0) => REPLYOBUF_stat_buffer,
+          CTRL_BUFFER(31 downto 0) => REPLYOBUF_ctrl_buffer
+          );
+      INT_REPLY_READ_OUT <= '0';
+    end generate;
+    gen_REPLYOBUF4 : if USE_ACKNOWLEDGE = 0 generate
+      MED_REPLY_DATAREADY_OUT <= '0';
+      MED_REPLY_DATA_OUT <= (others => '0');
+      MED_REPLY_PACKET_NUM_OUT <= (others => '0');
+    end generate;
+  end generate;
+
+
+--   REPLYOBUF : trb_net16_obuf
+--     generic map (
+--       USE_ACKNOWLEDGE => USE_ACKNOWLEDGE
+--       )
+--     port map (
+--       CLK       => CLK,
+--       RESET     => RESET,
+--       CLK_EN    => CLK_EN,
+--       MED_DATAREADY_OUT => MED_REPLY_DATAREADY_OUT,
+--       MED_DATA_OUT => MED_REPLY_DATA_OUT,
+--       MED_PACKET_NUM_OUT => MED_REPLY_PACKET_NUM_OUT,
+--       MED_READ_IN => MED_REPLY_READ_IN,
+--       INT_DATAREADY_IN => INT_REPLY_DATAREADY_IN,
+--       INT_DATA_IN => INT_REPLY_DATA_IN,
+--       INT_PACKET_NUM_IN => INT_REPLY_PACKET_NUM_IN,
+--       INT_READ_OUT => INT_REPLY_READ_OUT,
+--       STAT_LOCKED(15 downto 0) => REPLYOBUF_stat_locked,
+--       CTRL_LOCKED(15 downto 0) => REPLYOBUF_ctrl_locked,
+--       STAT_BUFFER(31 downto 0) => REPLYOBUF_stat_buffer,
+--       CTRL_BUFFER(31 downto 0) => REPLYOBUF_ctrl_buffer
+--       );
 
 
 -- build the registers according to the wiki page
@@ -353,81 +462,91 @@ begin
   REPLYOBUF_ctrl_buffer(9 downto 0) <= REPLYIBUF_stat_buffer(9 downto 0);
   REPLYOBUF_ctrl_buffer(31 downto 10) <= (others => '0');
 
-  STAT_LOCKED(0) <= INIT_IS_LOCKED;
-  STAT_LOCKED(1) <= REPLY_IS_LOCKED;
-  STAT_LOCKED(31 downto 2) <= (others => '0');
 
-  STAT_GEN  <= (others => '0');
-
-  REPLYOBUF_ctrl_locked(15 downto 2) <= (others => '0');
-  REPLYIBUF_ctrl_locked(15 downto 2) <= (others => '0');
-  INITOBUF_ctrl_locked(15 downto 2) <= (others => '0');
-  INITIBUF_ctrl_locked(15 downto 2) <= (others => '0');
-
--- comb part of the locking control
-  comb_locked : process (INIT_IS_LOCKED, REPLY_IS_LOCKED, INITIBUF_stat_locked,
-                       REPLYOBUF_stat_locked, REPLYIBUF_stat_locked,
-                       INITOBUF_stat_locked,  CTRL_LOCKED)
-    
-    begin  -- process
-      next_INIT_IS_LOCKED <= INIT_IS_LOCKED;
-      next_REPLY_IS_LOCKED <= REPLY_IS_LOCKED;
-      REPLYOBUF_ctrl_locked(1 downto 0) <= (others => '0');
-      REPLYIBUF_ctrl_locked(1 downto 0) <= (others => '0');
-      INITOBUF_ctrl_locked(1 downto 0) <= (others => '0');
-      INITIBUF_ctrl_locked(1 downto 0) <= (others => '0');
+  gen0a: if USE_ACKNOWLEDGE = 0 generate
+    STAT_LOCKED <= (others => '0');
+    REPLYOBUF_ctrl_locked <= (others => '0');
+    REPLYIBUF_ctrl_locked <= (others => '0');
+    INITOBUF_ctrl_locked  <= (others => '0');
+    INITIBUF_ctrl_locked  <= (others => '0');
+  end generate;
+  gen0: if USE_ACKNOWLEDGE = 1 generate
+    STAT_LOCKED(0) <= INIT_IS_LOCKED;
+    STAT_LOCKED(1) <= REPLY_IS_LOCKED;
+    STAT_LOCKED(31 downto 2) <= (others => '0');
   
-      if REPLY_IS_LOCKED = '1' then
-        -- listen to INITOBUF
-        if INITOBUF_stat_locked(0) = '1' or CTRL_LOCKED(1) = '1' then
-          next_REPLY_IS_LOCKED <= '0';
-          REPLYIBUF_ctrl_locked(0) <= '1';
-        else
-          next_REPLY_IS_LOCKED <= '1';
-        end if;
-      else
-        -- listen to REPLYIBUF itself
-        if REPLYIBUF_stat_locked(0) = '1' then
-          next_REPLY_IS_LOCKED <= '1';
-          INITOBUF_ctrl_locked(0) <= '1';
-        else
-          next_REPLY_IS_LOCKED <= '0';
-        end if;
-      end if;   
-      if INIT_IS_LOCKED = '1' then
-        -- listen to REPLYOBUF
-        if REPLYOBUF_stat_locked(0) = '1' or CTRL_LOCKED(0) = '1' then
-          next_INIT_IS_LOCKED <= '0';
-          INITIBUF_ctrl_locked(0) <= '1';
+    STAT_GEN  <= (others => '0');
+  
+    REPLYOBUF_ctrl_locked(15 downto 2) <= (others => '0');
+    REPLYIBUF_ctrl_locked(15 downto 2) <= (others => '0');
+    INITOBUF_ctrl_locked(15 downto 2) <= (others => '0');
+    INITIBUF_ctrl_locked(15 downto 2) <= (others => '0');
+  
+  -- comb part of the locking control
+    comb_locked : process (INIT_IS_LOCKED, REPLY_IS_LOCKED, INITIBUF_stat_locked,
+                        REPLYOBUF_stat_locked, REPLYIBUF_stat_locked,
+                        INITOBUF_stat_locked,  CTRL_LOCKED)
+      
+      begin  -- process
+        next_INIT_IS_LOCKED <= INIT_IS_LOCKED;
+        next_REPLY_IS_LOCKED <= REPLY_IS_LOCKED;
+        REPLYOBUF_ctrl_locked(1 downto 0) <= (others => '0');
+        REPLYIBUF_ctrl_locked(1 downto 0) <= (others => '0');
+        INITOBUF_ctrl_locked(1 downto 0) <= (others => '0');
+        INITIBUF_ctrl_locked(1 downto 0) <= (others => '0');
+    
+        if REPLY_IS_LOCKED = '1' then
+          -- listen to INITOBUF
+          if INITOBUF_stat_locked(0) = '1' or CTRL_LOCKED(1) = '1' then
+            next_REPLY_IS_LOCKED <= '0';
+            REPLYIBUF_ctrl_locked(0) <= '1';
+          else
+            next_REPLY_IS_LOCKED <= '1';
+          end if;
         else
-          next_INIT_IS_LOCKED <= '1';
-        end if;
-      else
-        -- listen to INITIBUF itself
-        if INITIBUF_stat_locked(0) = '1' then
-          next_INIT_IS_LOCKED <= '1';
-          REPLYOBUF_ctrl_locked(0) <= '1';
+          -- listen to REPLYIBUF itself
+          if REPLYIBUF_stat_locked(0) = '1' then
+            next_REPLY_IS_LOCKED <= '1';
+            INITOBUF_ctrl_locked(0) <= '1';
+          else
+            next_REPLY_IS_LOCKED <= '0';
+          end if;
+        end if;   
+        if INIT_IS_LOCKED = '1' then
+          -- listen to REPLYOBUF
+          if REPLYOBUF_stat_locked(0) = '1' or CTRL_LOCKED(0) = '1' then
+            next_INIT_IS_LOCKED <= '0';
+            INITIBUF_ctrl_locked(0) <= '1';
+          else
+            next_INIT_IS_LOCKED <= '1';
+          end if;
         else
-          next_INIT_IS_LOCKED <= '0';
-        end if;
-      end if;  
+          -- listen to INITIBUF itself
+          if INITIBUF_stat_locked(0) = '1' then
+            next_INIT_IS_LOCKED <= '1';
+            REPLYOBUF_ctrl_locked(0) <= '1';
+          else
+            next_INIT_IS_LOCKED <= '0';
+          end if;
+        end if;  
+    
+      end process;
   
-    end process;
-
-  reg_locked: process(CLK)
-    begin
-      if rising_edge(CLK) then
-        if RESET = '1' then
-          INIT_IS_LOCKED <= '0';
-          REPLY_IS_LOCKED <= '1';
-        elsif CLK_EN = '1' then
-          INIT_IS_LOCKED <= next_INIT_IS_LOCKED;
-          REPLY_IS_LOCKED <= next_REPLY_IS_LOCKED;
-        else
-          INIT_IS_LOCKED <= INIT_IS_LOCKED;
-          REPLY_IS_LOCKED <= REPLY_IS_LOCKED;
+    reg_locked: process(CLK)
+      begin
+        if rising_edge(CLK) then
+          if RESET = '1' then
+            INIT_IS_LOCKED <= '0';
+            REPLY_IS_LOCKED <= '1';
+          elsif CLK_EN = '1' then
+            INIT_IS_LOCKED <= next_INIT_IS_LOCKED;
+            REPLY_IS_LOCKED <= next_REPLY_IS_LOCKED;
+          else
+            INIT_IS_LOCKED <= INIT_IS_LOCKED;
+            REPLY_IS_LOCKED <= REPLY_IS_LOCKED;
+          end if;
         end if;
-      end if;
-    end process;
+      end process;
+  end generate;
 
 end architecture;
diff --git a/trb_net16_obuf_nodata.vhd b/trb_net16_obuf_nodata.vhd
new file mode 100644 (file)
index 0000000..31f0ce4
--- /dev/null
@@ -0,0 +1,125 @@
+LIBRARY IEEE;
+USE IEEE.std_logic_1164.ALL;
+USE IEEE.std_logic_ARITH.ALL;
+USE IEEE.std_logic_UNSIGNED.ALL;
+use work.trb_net_std.all;
+
+entity trb_net16_obuf_nodata is
+  port(
+    --  Misc
+    CLK    : in std_logic;
+    RESET  : in std_logic;
+    CLK_EN : in std_logic;
+    --  Media direction port
+    MED_DATAREADY_OUT: out std_logic;
+    MED_DATA_OUT:      out std_logic_vector (15 downto 0); -- Data word
+    MED_PACKET_NUM_OUT:out std_logic_vector(1 downto 0);
+    MED_READ_IN:       in  std_logic;
+    --STAT
+    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);
+    CTRL_BUFFER:       in  std_logic_vector (31 downto 0)
+    );
+end entity;
+
+
+
+architecture trb_net16_obuf_nodata_arch of trb_net16_obuf_nodata is
+
+  signal SEND_BUFFER_SIZE_IN : std_logic_vector(3 downto 0);
+  signal SEND_ACK_IN         : std_logic;
+  signal current_NOP_word    : std_logic_vector(15 downto 0);
+  signal current_ACK_word    : std_logic_vector(15 downto 0);
+  signal transfer_counter    : std_logic_vector(1  downto 0);
+
+  signal buf_MED_DATAREADY_OUT, next_MED_DATAREADY_OUT : std_logic;
+  signal buf_MED_DATA_OUT, next_MED_DATA_OUT           : std_logic_vector(15 downto 0);
+  signal buf_MED_PACKET_NUM_OUT                        : std_logic_vector(1 downto 0);
+  signal sending_ACK, next_sending_ACK                 : std_logic;
+  signal send_ACK                                      : std_logic;
+  signal reg_SEND_ACK_IN_2, next_SEND_ACK_IN_2         : std_logic;
+  signal reg_SEND_ACK_IN, next_SEND_ACK_IN             : std_logic;
+
+begin
+  SEND_BUFFER_SIZE_IN       <= CTRL_BUFFER(3 downto 0);
+  SEND_ACK_IN               <= CTRL_BUFFER(8);
+
+  send_ACK     <= SEND_ACK_IN or reg_SEND_ACK_IN or reg_SEND_ACK_IN_2;
+  next_SEND_ACK_IN_2 <= (reg_SEND_ACK_IN_2 or SEND_ACK_IN) and reg_SEND_ACK_IN;
+
+  MED_DATAREADY_OUT <= buf_MED_DATAREADY_OUT;
+  MED_PACKET_NUM_OUT <= buf_MED_PACKET_NUM_OUT;
+  MED_DATA_OUT <= buf_MED_DATA_OUT;
+
+  process(current_NOP_word, send_ACK, SEND_ACK, current_ACK_word, transfer_counter, MED_READ_IN)
+    begin
+      next_MED_DATA_OUT <= current_NOP_word;
+      next_MED_DATAREADY_OUT <= '0';
+      next_SEND_ACK_IN  <= send_ACK;
+
+
+      if reg_SEND_ACK_IN = '1' then
+        next_MED_DATA_OUT <= current_ACK_word;
+        next_MED_DATAREADY_OUT <= '1';
+        if transfer_counter <= "11" and MED_READ_IN = '1' then
+          next_SEND_ACK_IN <= '0';
+        end if;
+      end if;
+    end process;
+
+  REG_SEND_DATA : process(CLK)
+    begin
+      if rising_edge(CLK) then
+        if RESET = '1' then
+          buf_MED_DATA_OUT <= (others => '0');
+          buf_MED_PACKET_NUM_OUT <= (others => '0');
+          buf_MED_DATAREADY_OUT <= '0';
+        else
+          buf_MED_DATA_OUT <= next_MED_DATA_OUT;
+          buf_MED_PACKET_NUM_OUT <= transfer_counter;
+          buf_MED_DATAREADY_OUT <= next_MED_DATAREADY_OUT;
+        end if;
+      end if;
+    end process;
+
+  GENERATE_WORDS : process(transfer_counter, SEND_BUFFER_SIZE_IN)
+    begin
+      current_NOP_word  <= (others => '0');
+      current_NOP_word(2 downto 0) <= TYPE_ILLEGAL;
+      current_ACK_word  <= (others => '0');
+      if transfer_counter = "10" then
+        current_ACK_word(3 downto 0) <= SEND_BUFFER_SIZE_IN;
+      elsif transfer_counter = "00" then
+        current_ACK_word(2 downto 0) <= TYPE_ACK;
+      end if;
+    end process;
+
+  REG_TRANSFER_COUNTER : process(CLK)
+    begin
+      if rising_edge(CLK) then
+        if RESET = '1' then
+          transfer_counter <= (others => '0');
+        elsif buf_MED_DATAREADY_OUT = '1' and MED_READ_IN = '1' then
+          transfer_counter <= transfer_counter + 1;
+        end if;
+      end if;
+    end process;
+
+  REG_SEND_ACK : process(CLK)
+    begin
+      if rising_edge(CLK) then
+        if RESET = '1' then
+          reg_SEND_ACK_IN       <= '0';
+          reg_SEND_ACK_IN_2     <= '0';
+        elsif CLK_EN = '1' then
+          reg_SEND_ACK_IN       <= next_SEND_ACK_IN;
+          reg_SEND_ACK_IN_2     <= next_SEND_ACK_IN_2;
+        end if;
+      end if;
+    end process;
+
+  STAT_LOCKED <= (others => '0');
+  STAT_BUFFER <= (others => '0');
+
+end architecture;
index f932b5380dbdf0a9a6f922ddb4aaba26919b35d3..b52b413cc140587eef27267167cb54dcaa5e1793 100644 (file)
@@ -73,7 +73,8 @@ begin
 
     process(RESET, reg_APL_DTYPE_OUT, reg_APL_SEQNR_OUT, reg_APL_GOT_TRM, current_packet_type,
             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)
+            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;
         next_APL_DTYPE_OUT         <= reg_APL_DTYPE_OUT;
index 6fba2f9f3b05acaa1027140e9d44d79cb47a182b..d33a14ae350df6ed6791f41e7dfda1eb74dcbbad 100644 (file)
@@ -69,7 +69,9 @@ begin
           MED_REPLY_DATAREADY_IN, MED_REPLY_PACKET_NUM_IN, MED_REPLY_DATA_IN,
           send_INIT_ack, send_REPLY_ack, send_REPLY_trm, sending_REPLY_ACK,
           REPLY_transfer_counter, REPLY_saved_packet_type, MED_INIT_READ_IN,
-          INIT_SEQNR, INIT_transfer_counter, INIT_saved_packet_type, MED_REPLY_READ_IN)
+          INIT_SEQNR, INIT_transfer_counter, INIT_saved_packet_type, MED_REPLY_READ_IN,
+          buf_MED_INIT_DATA_OUT, buf_MED_REPLY_DATA_OUT, buf_MED_INIT_DATAREADY_OUT,
+          buf_MED_REPLY_DATAREADY_OUT)
     begin
       sent_INIT_ack <= '0';
       sent_REPLY_ack <= '0';
index 5321037ad2486ae119869444b90a02dbd3fb9b27..e0797cf28b224d6d7cb1ebeb02072e6eac285c14 100644 (file)
@@ -1,3 +1,6 @@
+--this fifo uses standard read behaviour: data is available one clock cycle after read was high.
+
+
 library ieee;
 use ieee.std_logic_1164.all;
 use ieee.std_logic_unsigned.all;
index 0655a4f83f4a9fdb501ee7966224bf916685f8e7..a62f4cd7eaa4df4058b93c13a19f541f9c92cb8c 100644 (file)
@@ -156,8 +156,7 @@ begin
         move_b1_buffer <= '1';
         move_b2_buffer <= '1';
       elsif combined_COMB_DATAREADY_IN = '1' then
-        -- ONLY COMB logic is writing into the sbuf
-        -- FATAL ERROR
+        -- ONLY COMB logic is writing into the sbuf FATAL ERROR
         next_got_overflow <= '1';
       elsif SYN_READ_IN = '1' then
         next_buffer_state <= BUFFER_B2_FULL;
@@ -165,6 +164,7 @@ begin
         move_b1_buffer <= '1';
         move_b2_buffer <= '1';
       end if;
+
     end if;
 
     -- for version1 it is more complicated: we have to gate