]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
Made CTS/config.vhd handling more flexible
authorAndreas Neiser <neiser@kph.uni-mainz.de>
Tue, 30 Apr 2013 06:57:11 +0000 (08:57 +0200)
committerAndreas Neiser <neiser@kph.uni-mainz.de>
Tue, 30 Apr 2013 06:57:11 +0000 (08:57 +0200)
cts/.gitignore [new file with mode: 0644]
cts/compile_central_frankfurt.pl
cts/compile_central_gsi.pl
cts/config_default.vhd [moved from cts/config.vhd with 100% similarity]
cts/config_mainz_a2.vhd [new file with mode: 0644]

diff --git a/cts/.gitignore b/cts/.gitignore
new file mode 100644 (file)
index 0000000..7970c6c
--- /dev/null
@@ -0,0 +1,2 @@
+/config.vhd
+
index fa244ee4f59e8dd42635f4e40b9806ac030d7d45..4cfd71558e1e48e8848f2100c659143c77ecfe2a 100755 (executable)
@@ -46,7 +46,9 @@ system("cat ../tdc_releases/tdc_v1.4/tdc_constraints.lpf >> workdir/$TOPNAME.lpf
 system("cat ".$TOPNAME."_constraints.lpf >> workdir/$TOPNAME.lpf");
 system("sed -i 's#THE_TDC/#gen_TDC_THE_TDC/#g' workdir/$TOPNAME.lpf");
 
-if($ENV{'LPF_ONLY'} == 1) {exit;}
+system("ln -f -s config_default.vhd config.vhd");
+
+if(defined $ENV{'LPF_ONLY'} and $ENV{'LPF_ONLY'} == 1) {exit;}
 
 #set -e
 #set -o errexit
index 7f7c600b6754ac0cf0392ef9fdfed4a0535753e7..9276e91ce288692385011f3a85b3f7e048167313 100755 (executable)
@@ -46,6 +46,8 @@ system("cat ../tdc_releases/tdc_v1.4/tdc_constraints.lpf >> workdir/$TOPNAME.lpf
 system("cat ".$TOPNAME."_constraints.lpf >> workdir/$TOPNAME.lpf");
 system("sed -i 's#THE_TDC/#gen_TDC_THE_TDC/#g' workdir/$TOPNAME.lpf");
 
+system("ln -f -s config_mainz_a2.vhd config.vhd");
+
 if(defined $ENV{'LPF_ONLY'} and $ENV{'LPF_ONLY'} == 1) {exit;}
 
 #set -e
similarity index 100%
rename from cts/config.vhd
rename to cts/config_default.vhd
diff --git a/cts/config_mainz_a2.vhd b/cts/config_mainz_a2.vhd
new file mode 100644 (file)
index 0000000..7c57e9a
--- /dev/null
@@ -0,0 +1,107 @@
+library ieee;
+USE IEEE.std_logic_1164.ALL;
+use ieee.numeric_std.all;
+use work.trb_net_std.all;
+
+package config is
+
+
+------------------------------------------------------------------------------
+--Begin of configuration
+------------------------------------------------------------------------------
+
+--include TDC for all four trigger input lines
+    constant INCLUDE_TDC : integer range c_NO to c_YES := c_YES;
+    
+--use all four SFP (1-4) as downlink to other boards.     
+    constant USE_4_SFP   : integer range c_NO to c_YES := c_NO;
+
+    
+--Run wih 125 MHz instead of 100 MHz     
+    constant USE_125_MHZ : integer range c_NO to c_YES := c_YES;    
+
+--Which external trigger module (ETM) to use?
+    type ETM_CHOICE_type is (ETM_CHOICE_MBS_VULOM, ETM_CHOICE_MAINZ_A2);
+    constant ETM_CHOICE : ETM_CHOICE_type := ETM_CHOICE_MAINZ_A2;
+    
+------------------------------------------------------------------------------
+--End of configuration
+------------------------------------------------------------------------------
+
+
+
+
+    
+------------------------------------------------------------------------------
+--Hub configuration 
+------------------------------------------------------------------------------
+    type hub_mii_t is array(0 to 1) of integer;    
+    type hub_ct    is array(0 to 16) of integer;
+    type hub_cfg_t is array(0 to 1) of hub_ct;    
+
+  --this is used to select the proper configuration in the main code    
+    constant CFG_MODE : integer;
+    
+    
+  --first entry is normal CTS with one optical output, second one is with four optical outputs
+  --slow-control is accepted on SFP1 only, triggers are sent to all used SFP
+    constant INTERNAL_NUM_ARR     : hub_mii_t := (5,5);
+    constant INTERFACE_NUM_ARR    : hub_mii_t := (5,8);
+    constant IS_UPLINK_ARR        : hub_cfg_t := ((0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0),
+                                                  (0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0));
+    constant IS_DOWNLINK_ARR      : hub_cfg_t := ((1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0),
+                                                  (1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0));
+    constant IS_UPLINK_ONLY_ARR   : hub_cfg_t := ((0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0),
+                                                  (0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0)); 
+                           
+                          
+    constant INTERNAL_NUM         : integer;
+    constant INTERFACE_NUM        : integer;
+    constant IS_UPLINK            : hub_ct;
+    constant IS_DOWNLINK          : hub_ct;
+    constant IS_UPLINK_ONLY       : hub_ct;
+    
+    
+    -- MII_NUMBER        => 5, --(8)
+    -- INT_NUMBER        => 5,
+    -- INT_CHANNELS      => (0,1,0,1,3),
+
+    -- No trigger / sctrl sent to optical link, slow control receiving possible
+    -- MII_IS_UPLINK        => (0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0);
+    -- MII_IS_DOWNLINK      => (1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0);
+    -- MII_IS_UPLINK_ONLY   => (0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0);
+
+    -- Trigger / sctrl sent to optical link, slow control receiving possible
+    -- MII_IS_UPLINK        => (0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0);
+    -- MII_IS_DOWNLINK      => (1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0);
+    -- MII_IS_UPLINK_ONLY   => (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0);
+    -- & disable port 4 in c0 and c1 -- no triggers from/to optical link
+
+    -- Trigger / sctrl sent to 4 optical links
+    -- MII_IS_UPLINK        => (0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0);
+    -- MII_IS_DOWNLINK      => (1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0);
+    -- MII_IS_UPLINK_ONLY   => (0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0);
+    -- & disable port 4 in c0 and c1 -- no triggers from/to optical link
+
+------------------------------------------------------------------------------
+--CTS configuration
+------------------------------------------------------------------------------
+    constant cts_rdo_additional_ports : integer;
+
+end;
+
+package body config is
+--compute correct configuration mode
+  constant CFG_MODE : integer := USE_4_SFP;
+  constant cts_rdo_additional_ports : integer := 1 + INCLUDE_TDC;
+
+  constant INTERNAL_NUM         : integer := INTERNAL_NUM_ARR(CFG_MODE);
+  constant INTERFACE_NUM        : integer := INTERFACE_NUM_ARR(CFG_MODE);
+  constant IS_UPLINK            : hub_ct  := IS_UPLINK_ARR(CFG_MODE);
+  constant IS_DOWNLINK          : hub_ct  := IS_DOWNLINK_ARR(CFG_MODE);
+  constant IS_UPLINK_ONLY       : hub_ct  := IS_UPLINK_ONLY_ARR(CFG_MODE); 
+  
+  
+end package body;