]> jspc29.x-matter.uni-frankfurt.de Git - cri.git/commitdiff
small changes for internal Interface in slow control part for future connection of...
authorAdrian Weber <adrian.a.weber@exp2.physik.uni-giessen.de>
Thu, 25 Feb 2021 12:53:11 +0000 (13:53 +0100)
committerAdrian Weber <adrian.a.weber@exp2.physik.uni-giessen.de>
Thu, 25 Feb 2021 12:53:11 +0000 (13:53 +0100)
src/hub/cri_hub_func.vhd
src/hub/trb_net16_cri_hub.vhd
src/hub/trb_net16_cri_hub_slwcntrl.vhd

index 67ccc1add209dd19bb3bc20e52e1df726bed488c..59c34d39ef9429d7e24bff0c8f98e5fb5907301c 100644 (file)
@@ -8,13 +8,15 @@ use work.trb_net16_hub_func.all;
 
 package cri_hub_func is
 
-  function calc_uplink_number (DOWNLINK_NUM   : integer)
+  function calc_uplink_number (DOWNLINK_NUM   : integer;
+                               INT_NUM        : integer)
     return hub_mii_config_t;
 
   function calc_downlink_number (DOWNLINK_NUM   : integer)
     return hub_mii_config_t;    
     
-  function calc_uplink_only_number (DOWNLINK_NUM   : integer)
+  function calc_uplink_only_number (DOWNLINK_NUM   : integer;
+                                    INT_NUM        : integer)
     return hub_mii_config_t;
     
   function calc_number_data_hubs (MII_NUMBER   : integer)
@@ -31,7 +33,8 @@ end package cri_hub_func;
 package body cri_hub_func is
 
 
-  function calc_uplink_number (DOWNLINK_NUM   : integer) -- DOWNLINK_NUM is number of Downlinks ! Automaticly inserts one uplink at end
+  function calc_uplink_number (DOWNLINK_NUM   : integer;  -- DOWNLINK_NUM is number of Downlinks ! Automaticly inserts one uplink at end
+                               INT_NUM        : integer) -- Number of Internal Interfaces
     return hub_mii_config_t is       -- 0 1 2 3 4 5 6 7 8 9 a b c d e f 
     variable tmp : hub_mii_config_t := (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
     begin
@@ -39,6 +42,8 @@ package body cri_hub_func is
       for i in 0 to 16 loop
         if (i = DOWNLINK_NUM) then 
           tmp(i) := 1;
+        elsif ((INT_NUM > 0) and (i = DOWNLINK_NUM + INT_NUM + 1)) then -- INT_NUM is after Uplink and hub control channel
+          tmp(i) := 1;          
         else 
           tmp(i) := 0;
         end if;
@@ -63,11 +68,12 @@ package body cri_hub_func is
       return tmp;
     end function;    
 
-  function calc_uplink_only_number (DOWNLINK_NUM   : integer)
+  function calc_uplink_only_number (DOWNLINK_NUM   : integer;
+                                    INT_NUM        : integer)
     return hub_mii_config_t is
     begin
     
-      return calc_uplink_number(DOWNLINK_NUM);
+      return calc_uplink_number(DOWNLINK_NUM, INT_NUM);
     end function;    
 
   function calc_number_data_hubs (MII_NUMBER   : integer) -- ALl links. first N-1 are downlinks, last is uplink!
index 9eedbd07932d051148b226b853b8e4e60ca3ae20..215025a362fd4207f9fc436c46a453b3f7197b9e 100644 (file)
@@ -81,22 +81,22 @@ entity trb_net16_cri_hub is
     ONEWIRE_WRITE           : in  std_logic;
 
     --INT: interfaces to connect APIs
---     INT_INIT_DATAREADY_OUT    : out std_logic_vector (INT_NUMBER downto 0);
---     INT_INIT_DATA_OUT         : out std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0);
---     INT_INIT_PACKET_NUM_OUT   : out std_logic_vector (INT_NUMBER*c_NUM_WIDTH  downto 0);
---     INT_INIT_READ_IN          : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
---     INT_INIT_DATAREADY_IN     : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
---     INT_INIT_DATA_IN          : in  std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0) := (others => '0');
---     INT_INIT_PACKET_NUM_IN    : in  std_logic_vector (INT_NUMBER*c_NUM_WIDTH  downto 0) := (others => '0');
---     INT_INIT_READ_OUT         : out std_logic_vector (INT_NUMBER downto 0);
---     INT_REPLY_DATAREADY_OUT   : out std_logic_vector (INT_NUMBER downto 0);
---     INT_REPLY_DATA_OUT        : out std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0);
---     INT_REPLY_PACKET_NUM_OUT  : out std_logic_vector (INT_NUMBER*c_NUM_WIDTH  downto 0);
---     INT_REPLY_READ_IN         : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
---     INT_REPLY_DATAREADY_IN    : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
---     INT_REPLY_DATA_IN         : in  std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0) := (others => '0');
---     INT_REPLY_PACKET_NUM_IN   : in  std_logic_vector (INT_NUMBER*c_NUM_WIDTH downto 0) := (others => '0');
---     INT_REPLY_READ_OUT        : out std_logic_vector (INT_NUMBER downto 0);
+    INT_INIT_DATAREADY_OUT    : out std_logic_vector (INT_NUMBER downto 0);
+    INT_INIT_DATA_OUT         : out std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0);
+    INT_INIT_PACKET_NUM_OUT   : out std_logic_vector (INT_NUMBER*c_NUM_WIDTH  downto 0);
+    INT_INIT_READ_IN          : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
+    INT_INIT_DATAREADY_IN     : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
+    INT_INIT_DATA_IN          : in  std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0) := (others => '0');
+    INT_INIT_PACKET_NUM_IN    : in  std_logic_vector (INT_NUMBER*c_NUM_WIDTH  downto 0) := (others => '0');
+    INT_INIT_READ_OUT         : out std_logic_vector (INT_NUMBER downto 0);
+    INT_REPLY_DATAREADY_OUT   : out std_logic_vector (INT_NUMBER downto 0);
+    INT_REPLY_DATA_OUT        : out std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0);
+    INT_REPLY_PACKET_NUM_OUT  : out std_logic_vector (INT_NUMBER*c_NUM_WIDTH  downto 0);
+    INT_REPLY_READ_IN         : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
+    INT_REPLY_DATAREADY_IN    : in  std_logic_vector (INT_NUMBER downto 0) := (others => '0');
+    INT_REPLY_DATA_IN         : in  std_logic_vector (INT_NUMBER*c_DATA_WIDTH downto 0) := (others => '0');
+    INT_REPLY_PACKET_NUM_IN   : in  std_logic_vector (INT_NUMBER*c_NUM_WIDTH downto 0) := (others => '0');
+    INT_REPLY_READ_OUT        : out std_logic_vector (INT_NUMBER downto 0);
 
     COMMON_STAT_REGS             : in  std_logic_vector (std_COMSTATREG*32-1 downto 0) := (others => '0');  --Status of common STAT regs
     COMMON_CTRL_REGS             : out std_logic_vector (std_COMCTRLREG*32-1 downto 0);  --Status of common STAT regs
@@ -183,9 +183,9 @@ begin
       HUB_USED_CHANNELS   => (0,0,0,1),
       INIT_ADDRESS        => INIT_ADDRESS,
       MII_NUMBER          => HUB_CONTROLLER_NUM,
-      MII_IS_UPLINK       => calc_uplink_number(HUB_CONTROLLER_NUM-1),  --(0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),--(0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),-- -- adjust to HUB_CONTROLLER_NUM (here it is for 5)
+      MII_IS_UPLINK       => calc_uplink_number(HUB_CONTROLLER_NUM-1,INT_NUMBER),  --(0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),--(0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),-- -- adjust to HUB_CONTROLLER_NUM (here it is for 5)
       MII_IS_DOWNLINK     => calc_downlink_number(HUB_CONTROLLER_NUM-1),--(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),--
-      MII_IS_UPLINK_ONLY  => calc_uplink_only_number(HUB_CONTROLLER_NUM-1),--(0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),--(0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),--
+      MII_IS_UPLINK_ONLY  => calc_uplink_only_number(HUB_CONTROLLER_NUM-1,INT_NUMBER),--(0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),--(0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),--
       --USE_ONEWIRE         => c_YES,
       HARDWARE_VERSION    => HARDWARE_VERSION,
       INCLUDED_FEATURES   => INCLUDED_FEATURES,
@@ -193,7 +193,8 @@ begin
       CLOCK_FREQUENCY     => CLOCK_FREQUENCY,
       BROADCAST_SPECIAL_ADDR => BROADCAST_SPECIAL_ADDR,
       COMPILE_TIME        => COMPILE_TIME,
-      USE_VAR_ENDPOINT_ID => c_NO
+      USE_VAR_ENDPOINT_ID => c_NO,
+      INT_NUMBER          => INT_NUMBER
       )
     port map (
       CLK    => CLK,
@@ -235,6 +236,24 @@ begin
       ONEWIRE_ADDR                    => ONEWIRE_ADDR, 
       ONEWIRE_WRITE                   => ONEWIRE_WRITE,
       
+      --INT: interfaces to connect APIs
+      INT_INIT_DATAREADY_OUT          => INT_INIT_DATAREADY_OUT,
+      INT_INIT_DATA_OUT               => INT_INIT_DATA_OUT, 
+      INT_INIT_PACKET_NUM_OUT         => INT_INIT_PACKET_NUM_OUT,
+      INT_INIT_READ_IN                => INT_INIT_READ_IN,
+      INT_INIT_DATAREADY_IN           => INT_INIT_DATAREADY_IN,
+      INT_INIT_DATA_IN                => INT_INIT_DATA_IN,  
+      INT_INIT_PACKET_NUM_IN          => INT_INIT_PACKET_NUM_IN,
+      INT_INIT_READ_OUT               => INT_INIT_READ_OUT, 
+      INT_REPLY_DATAREADY_OUT         => INT_REPLY_DATAREADY_OUT,
+      INT_REPLY_DATA_OUT              => INT_REPLY_DATA_OUT,
+      INT_REPLY_PACKET_NUM_OUT        => INT_REPLY_PACKET_NUM_OUT,
+      INT_REPLY_READ_IN               => INT_REPLY_READ_IN,
+      INT_REPLY_DATAREADY_IN          => INT_REPLY_DATAREADY_IN,
+      INT_REPLY_DATA_IN               => INT_REPLY_DATA_IN, 
+      INT_REPLY_PACKET_NUM_IN         => INT_REPLY_PACKET_NUM_IN,
+      INT_REPLY_READ_OUT              => INT_REPLY_READ_OUT,
+      
       COMMON_STAT_REGS                => (others => '0'),--open,--common_stat_reg,
       COMMON_CTRL_REGS                => COMMON_CTRL_REGS,      
       MY_ADDRESS_OUT                  => open,--my_address,
index e2fad1f1f330845e23ec99af789e358d3aecf25d..03cbbfa72c669a7f0147d09a73f76f588a59ca40 100644 (file)
@@ -41,23 +41,23 @@ entity trb_net16_cri_hub_slwcntrl is
                                    
     MED_STAT_OP                    : in  std_logic_vector (MII_NUMBER*16-1 downto 0);
          
-    HUB_INIT_DATAREADY_IN          : in  std_logic_vector((MII_NUMBER+1)-1 downto 0);
-    HUB_INIT_DATA_IN               : in  std_logic_vector((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0);
-    HUB_INIT_PACKET_NUM_IN         : in  std_logic_vector((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0);
-    HUB_INIT_READ_OUT              : out std_logic_vector((MII_NUMBER+1)-1 downto 0);
-    HUB_INIT_DATAREADY_OUT         : out std_logic_vector((MII_NUMBER+1)-1 downto 0);
-    HUB_INIT_DATA_OUT              : out std_logic_vector((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0);
-    HUB_INIT_PACKET_NUM_OUT        : out std_logic_vector((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0);
-    HUB_INIT_READ_IN               : in  std_logic_vector((MII_NUMBER+1)-1 downto 0);
-
-    HUB_REPLY_DATAREADY_IN         : in  std_logic_vector((MII_NUMBER+1)-1 downto 0);
-    HUB_REPLY_DATA_IN              : in  std_logic_vector((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0);
-    HUB_REPLY_PACKET_NUM_IN        : in  std_logic_vector((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0);
-    HUB_REPLY_READ_OUT             : out std_logic_vector((MII_NUMBER+1)-1 downto 0);    
-    HUB_REPLY_DATAREADY_OUT        : out std_logic_vector((MII_NUMBER+1)-1 downto 0);
-    HUB_REPLY_DATA_OUT             : out std_logic_vector((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0);
-    HUB_REPLY_PACKET_NUM_OUT       : out std_logic_vector((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0);
-    HUB_REPLY_READ_IN              : in  std_logic_vector((MII_NUMBER+1)-1 downto 0);
+    HUB_INIT_DATAREADY_IN          : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
+    HUB_INIT_DATA_IN               : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0);
+    HUB_INIT_PACKET_NUM_IN         : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0);
+    HUB_INIT_READ_OUT              : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
+    HUB_INIT_DATAREADY_OUT         : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
+    HUB_INIT_DATA_OUT              : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0);
+    HUB_INIT_PACKET_NUM_OUT        : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0);
+    HUB_INIT_READ_IN               : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
+
+    HUB_REPLY_DATAREADY_IN         : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
+    HUB_REPLY_DATA_IN              : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0);
+    HUB_REPLY_PACKET_NUM_IN        : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0);
+    HUB_REPLY_READ_OUT             : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);    
+    HUB_REPLY_DATAREADY_OUT        : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
+    HUB_REPLY_DATA_OUT             : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0);
+    HUB_REPLY_PACKET_NUM_OUT       : out std_logic_vector((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0);
+    HUB_REPLY_READ_IN              : in  std_logic_vector((MII_NUMBER+1+INT_NUMBER)-1 downto 0);
 
     CNTRL_API_B2H_REPLY_DATAREADY  : out std_logic;
     CNTRL_API_B2H_REPLY_DATA       : out std_logic_vector(c_DATA_WIDTH-1 downto 0);
@@ -336,29 +336,29 @@ begin
   HUBLOGIC : trb_net16_hub_logic
     generic map (
     --media interfaces
-      POINT_NUMBER        => MII_NUMBER+1,
+      POINT_NUMBER        => MII_NUMBER+1+INT_NUMBER,
       MII_IS_UPLINK_ONLY  => MII_IS_UPLINK_ONLY
       )
     port map(
       CLK                   => CLK,
       RESET                 => reset_i,
       CLK_EN                => CLK_EN,
-      INIT_DATAREADY_IN     => HUB_INIT_DATAREADY_IN((MII_NUMBER+1)-1 downto 0),
-      INIT_DATA_IN          => HUB_INIT_DATA_IN((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0),
-      INIT_PACKET_NUM_IN    => HUB_INIT_PACKET_NUM_IN((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0),
-      INIT_READ_OUT         => HUB_INIT_READ_OUT((MII_NUMBER+1)-1 downto 0),
-      INIT_DATAREADY_OUT    => HUB_INIT_DATAREADY_OUT((MII_NUMBER+1)-1 downto 0),
-      INIT_DATA_OUT         => HUB_INIT_DATA_OUT((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0),
-      INIT_PACKET_NUM_OUT   => HUB_INIT_PACKET_NUM_OUT((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0),
-      INIT_READ_IN          => HUB_INIT_READ_IN((MII_NUMBER+1)-1 downto 0),
-      REPLY_DATAREADY_IN    => HUB_REPLY_DATAREADY_IN((MII_NUMBER+1)-1 downto 0),
-      REPLY_DATA_IN         => HUB_REPLY_DATA_IN((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0),
-      REPLY_PACKET_NUM_IN   => HUB_REPLY_PACKET_NUM_IN((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0),
-      REPLY_READ_OUT        => HUB_REPLY_READ_OUT((MII_NUMBER+1)-1 downto 0),
-      REPLY_DATAREADY_OUT   => HUB_REPLY_DATAREADY_OUT((MII_NUMBER+1)-1 downto 0),
-      REPLY_DATA_OUT        => HUB_REPLY_DATA_OUT((MII_NUMBER+1)*c_DATA_WIDTH-1 downto 0),
-      REPLY_PACKET_NUM_OUT  => HUB_REPLY_PACKET_NUM_OUT((MII_NUMBER+1)*c_NUM_WIDTH-1 downto 0),
-      REPLY_READ_IN         => HUB_REPLY_READ_IN((MII_NUMBER+1)-1 downto 0),
+      INIT_DATAREADY_IN     => HUB_INIT_DATAREADY_IN((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      INIT_DATA_IN          => HUB_INIT_DATA_IN((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0),
+      INIT_PACKET_NUM_IN    => HUB_INIT_PACKET_NUM_IN((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0),
+      INIT_READ_OUT         => HUB_INIT_READ_OUT((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      INIT_DATAREADY_OUT    => HUB_INIT_DATAREADY_OUT((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      INIT_DATA_OUT         => HUB_INIT_DATA_OUT((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0),
+      INIT_PACKET_NUM_OUT   => HUB_INIT_PACKET_NUM_OUT((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0),
+      INIT_READ_IN          => HUB_INIT_READ_IN((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      REPLY_DATAREADY_IN    => HUB_REPLY_DATAREADY_IN((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      REPLY_DATA_IN         => HUB_REPLY_DATA_IN((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0),
+      REPLY_PACKET_NUM_IN   => HUB_REPLY_PACKET_NUM_IN((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0),
+      REPLY_READ_OUT        => HUB_REPLY_READ_OUT((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      REPLY_DATAREADY_OUT   => HUB_REPLY_DATAREADY_OUT((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
+      REPLY_DATA_OUT        => HUB_REPLY_DATA_OUT((MII_NUMBER+1+INT_NUMBER)*c_DATA_WIDTH-1 downto 0),
+      REPLY_PACKET_NUM_OUT  => HUB_REPLY_PACKET_NUM_OUT((MII_NUMBER+1+INT_NUMBER)*c_NUM_WIDTH-1 downto 0),
+      REPLY_READ_IN         => HUB_REPLY_READ_IN((MII_NUMBER+1+INT_NUMBER)-1 downto 0),
       STAT                  => buf_HUB_STAT_CHANNEL((c_SLOW_CTRL_CHANNEL+1)*16-1 downto c_SLOW_CTRL_CHANNEL*16),
       STAT_locked           => HUB_locked(c_SLOW_CTRL_CHANNEL),
       STAT_POINTS_locked    => buf_STAT_POINTS_locked((c_SLOW_CTRL_CHANNEL+1)*32-1 downto c_SLOW_CTRL_CHANNEL*32),