From 212e7bb6ab6fcca78034c221f44e0d168e26501f Mon Sep 17 00:00:00 2001 From: Manuel Penschuck Date: Mon, 15 Dec 2014 22:31:10 +0100 Subject: [PATCH] CTS: Moved selection of trigger module into config file; added config for tof --- cts/config_default.vhd | 7 ++ cts/config_heidelberg_tof.vhd | 148 ++++++++++++++++++++++++++++++++++ cts/config_mainz_a2.vhd | 6 ++ cts/trb3_central.vhd | 17 ++-- 4 files changed, 170 insertions(+), 8 deletions(-) create mode 100644 cts/config_heidelberg_tof.vhd diff --git a/cts/config_default.vhd b/cts/config_default.vhd index 17910d2..f260949 100644 --- a/cts/config_default.vhd +++ b/cts/config_default.vhd @@ -37,6 +37,13 @@ package config is constant ETM_CHOICE : ETM_CHOICE_type := ETM_CHOICE_MBS_VULOM; constant ETM_ID : std_logic_vector(7 downto 0); + + + constant TRIGGER_COIN_COUNT : integer := 4; + constant TRIGGER_PULSER_COUNT : integer := 2; + constant TRIGGER_RAND_PULSER : integer := 1; + constant TRIGGER_ADDON_COUNT : integer := 6; + constant PERIPH_TRIGGER_COUNT : integer := 2; ------------------------------------------------------------------------------ --End of configuration diff --git a/cts/config_heidelberg_tof.vhd b/cts/config_heidelberg_tof.vhd new file mode 100644 index 0000000..a254547 --- /dev/null +++ b/cts/config_heidelberg_tof.vhd @@ -0,0 +1,148 @@ +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 +------------------------------------------------------------------------------ + + constant INCLUDE_CTS : integer range c_NO to c_YES := c_YES; + constant INCLUDE_CBMNET : integer range c_NO to c_YES := c_NO; + +--include TDC for all four trigger input lines + constant INCLUDE_TDC : integer range c_NO to c_YES := c_YES; + constant TDC_CHANNEL_NUMBER : integer := 5; + +--Use 64 word ringbuffer instead of 128 word ringbuffer in TDC channels + constant USE_64_FIFO : integer := c_YES; + +--Define ringbuffer size for TDC channels: 32-64-128 + constant RING_BUFFER_SIZE : integer range 0 to 128 := 1; + +--use all four SFP (1-4) as downlink to other boards (only w/o CBMNET) + 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_NO; + +--Run external 200 MHz clock source + constant USE_EXTERNAL_CLOCK : integer range c_NO to c_YES := c_YES; + +--Which external trigger module (ETM) to use? + constant INCLUDE_ETM : integer range c_NO to c_YES := c_YES; + type ETM_CHOICE_type is (ETM_CHOICE_MBS_VULOM, ETM_CHOICE_MAINZ_A2, ETM_CHOICE_CBMNET); + constant ETM_CHOICE : ETM_CHOICE_type := ETM_CHOICE_MBS_VULOM; + + constant ETM_ID : std_logic_vector(7 downto 0); + + + constant TRIGGER_COIN_COUNT : integer := 0; + constant TRIGGER_PULSER_COUNT : integer := 4; + constant TRIGGER_RAND_PULSER : integer := 1; + constant TRIGGER_ADDON_COUNT : integer := 10; + constant PERIPH_TRIGGER_COUNT : integer := 0; + +------------------------------------------------------------------------------ +--End of configuration +------------------------------------------------------------------------------ + +--Ports: +-- LVL1/IPU SCtrl +-- 0 FPGA 1 FPGA 1 +-- 1 FPGA 2 FPGA 2 +-- 2 FPGA 3 FPGA 3 +-- 3 FPGA 4 FPGA 4 +-- 4 opt. link opt. link +-- 5-7 SFP 2-4 +-- 5(8) CTS read-out internal 0 1 - X X O --downlink only +-- 6(9) CTS TRG Sctrl GbE 2 3 4 X X X --uplink only + +------------------------------------------------------------------------------ +--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; + type hw_info_t is array(0 to 1) of std_logic_vector(31 downto 0); + + --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); +-- 0 1 2 3 4 5 6 7 8 9 a b c d e f + 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,1,0,0,0,0,1,0,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,0,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,1,0,0,0,0,0,0,0)); + constant HARDWARE_INFO_ARR : hw_info_t := (x"9000CEE0",x"9000CEE2"); + + constant INTERNAL_NUM : integer; + constant INTERFACE_NUM : integer; + constant IS_UPLINK : hub_ct; + constant IS_DOWNLINK : hub_ct; + constant IS_UPLINK_ONLY : hub_ct; + constant HARDWARE_INFO : std_logic_vector(31 downto 0); + + -- 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 + INCLUDE_CBMNET; + + constant HARDWARE_INFO : std_logic_vector (31 downto 0) := HARDWARE_INFO_ARR(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); + + function etm_id_func return std_logic_vector is + variable res : unsigned(7 downto 0); + begin + res := x"00"; + if INCLUDE_ETM=c_YES then + res := x"60"; + res := res + TO_UNSIGNED(ETM_CHOICE_type'pos(ETM_CHOICE), 4); + end if; + return std_logic_vector(res); + end function; + + constant ETM_ID : std_logic_vector(7 downto 0) := etm_id_func; + +end package body; diff --git a/cts/config_mainz_a2.vhd b/cts/config_mainz_a2.vhd index 55c4443..b5728a5 100644 --- a/cts/config_mainz_a2.vhd +++ b/cts/config_mainz_a2.vhd @@ -38,6 +38,12 @@ package config is constant ETM_ID : std_logic_vector(7 downto 0); + constant TRIGGER_COIN_COUNT : integer := 4; + constant TRIGGER_PULSER_COUNT : integer := 2; + constant TRIGGER_RAND_PULSER : integer := 1; + constant TRIGGER_ADDON_COUNT : integer := 6; + constant PERIPH_TRIGGER_COUNT : integer := 2; + ------------------------------------------------------------------------------ --End of configuration ------------------------------------------------------------------------------ diff --git a/cts/trb3_central.vhd b/cts/trb3_central.vhd index 576d00b..c492699 100644 --- a/cts/trb3_central.vhd +++ b/cts/trb3_central.vhd @@ -444,7 +444,7 @@ architecture trb3_central_arch of trb3_central is signal cts_rdo_trg_information : std_logic_vector(23 downto 0); signal cts_rdo_trg_number : std_logic_vector(15 downto 0); - constant CTS_ADDON_LINE_COUNT : integer := 22; + constant CTS_ADDON_LINE_COUNT : integer := 38; constant CTS_OUTPUT_MULTIPLEXERS : integer := 8; constant CTS_OUTPUT_INPUTS : integer := 16; @@ -634,14 +634,14 @@ begin generic map ( EXTERNAL_TRIGGER_ID => ETM_ID, -- fill in trigger logic enumeration id of external trigger logic - TRIGGER_COIN_COUNT => 4, - TRIGGER_PULSER_COUNT => 2, - TRIGGER_RAND_PULSER => 1, + TRIGGER_COIN_COUNT => TRIGGER_COIN_COUNT, + TRIGGER_PULSER_COUNT => TRIGGER_PULSER_COUNT, + TRIGGER_RAND_PULSER => TRIGGER_RAND_PULSER, - TRIGGER_INPUT_COUNT => 0, -- now all inputs are routed via an input multiplexer! - TRIGGER_ADDON_COUNT => 6, + TRIGGER_INPUT_COUNT => 0, -- obsolete! now all inputs are routed via an input multiplexer! + TRIGGER_ADDON_COUNT => TRIGGER_ADDON_COUNT, - PERIPH_TRIGGER_COUNT => 2, + PERIPH_TRIGGER_COUNT => PERIPH_TRIGGER_COUNT, OUTPUT_MULTIPLEXERS => CTS_OUTPUT_MULTIPLEXERS, @@ -718,6 +718,7 @@ begin cts_addon_triggers_in(19) <= or_all(JIN1); cts_addon_triggers_in(20) <= or_all(JIN2); cts_addon_triggers_in(21) <= or_all(NIM_IN); + cts_addon_triggers_in(37 downto 22) <= JTTL; LED_BANK(7 downto 6) <= cts_addon_activity_i(4 downto 3); LED_RJ_GREEN <= ( @@ -1800,7 +1801,7 @@ begin -- JOUT1 <= x"0"; -- JOUT2 <= x"0"; -- JOUTLVDS <= x"00"; - --JTTL <= x"0000"; + JTTL <= (others => 'Z'); LED_BANK(5 downto 0) <= (others => '0'); LED_FAN_GREEN <= led_time_ref_i; -- 2.43.0