From: Andreas Neiser Date: Tue, 30 Apr 2013 06:57:11 +0000 (+0200) Subject: Made CTS/config.vhd handling more flexible X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=42f9282ecbb585559ebc234f28552c7b74ebd41b;p=trb3.git Made CTS/config.vhd handling more flexible --- diff --git a/cts/.gitignore b/cts/.gitignore new file mode 100644 index 0000000..7970c6c --- /dev/null +++ b/cts/.gitignore @@ -0,0 +1,2 @@ +/config.vhd + diff --git a/cts/compile_central_frankfurt.pl b/cts/compile_central_frankfurt.pl index fa244ee..4cfd715 100755 --- a/cts/compile_central_frankfurt.pl +++ b/cts/compile_central_frankfurt.pl @@ -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 diff --git a/cts/compile_central_gsi.pl b/cts/compile_central_gsi.pl index 7f7c600..9276e91 100755 --- a/cts/compile_central_gsi.pl +++ b/cts/compile_central_gsi.pl @@ -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 diff --git a/cts/config.vhd b/cts/config_default.vhd 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 index 0000000..7c57e9a --- /dev/null +++ b/cts/config_mainz_a2.vhd @@ -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;