22 use IEEE.STD_LOGIC_1164.
all;
23 use IEEE.NUMERIC_STD.
all;
24 library infrastructure_lib;
25 use infrastructure_lib.all;
32 use ipbus_lib.ipbus.
all;
33 library TOB_rdout_lib;
41 library TOB_rdout_lib;
46 generic(n_channels : natural := N_MGT;
47 ENCODING_MODE : integer;
48 ENABLE_INPUT_RAM : boolean;
49 EFEX_POSITION : integer := 0;
50 ENABLE_OUTPUT_RAMS : boolean;
51 ENABLE_SORTING_INPUT_RAM : boolean;
52 ENABLE_SORTING_OUTPUT_RAM : boolean;
53 FPGA_NUMBER : integer;
54 EG_ALGO_VERSION : std_logic_vector(1 downto 0);
55 TAU_ALGO_VERSION : std_logic_vector(1 downto 0));
57 clk200 : in std_logic;
58 rx_clk280 : in std_logic_vector(n_channels-1 downto 0);
70 BCR_in : in std_logic;
71 ttc_orbit_length_reg : in std_logic_vector(11 downto 0);
72 bcmuxvalue_sych_reg : in std_logic_vector(11 downto 0);
76 mux_sel : in std_logic_vector(255 downto 0);
77 enable_mgt : in std_logic_vector(n_channels -1 downto 0);
79 start_pulse_rst : out std_logic;
80 bc_cntr_0 : out std_logic_vector(111 downto 0);
81 bc_cntr_1 : out std_logic_vector(111 downto 0);
82 bc_cntr_2 : out std_logic_vector(111 downto 0);
83 bc_cntr_3 : out std_logic_vector(111 downto 0);
84 bc_mux_cntr_0 : out std_logic_vector(111 downto 0);
85 bc_mux_cntr_1 : out std_logic_vector(111 downto 0);
86 bc_mux_cntr_2 : out std_logic_vector(111 downto 0);
87 bc_mux_cntr_3 : out std_logic_vector(111 downto 0);
88 bcn_synch : out std_logic_vector(63 downto 0);
89 crc_error_chan : out std_logic_vector(63 downto 0);
123 delay_latch : out std_logic_vector(n_channels-1 downto 0);
124 delay_num : out std_logic_vector(255 downto 0);
125 Reg224_latch : out std_logic_vector(n_channels-1 downto 0);
126 ttc_pipe : out std_logic_vector(n_channels-1 downto 0);
127 data_readout_0 : out std_logic_vector(223 downto 0);
128 data_readout_1 : out std_logic_vector(223 downto 0);
129 data_readout_2 : out std_logic_vector(223 downto 0);
130 data_readout_3 : out std_logic_vector(223 downto 0);
131 start : in std_logic;
133 sel_data_in : in std_logic;
134 ram_data_mgt0 : in std_logic_vector (3647 downto 0);
135 ram_data_mgt1 : in std_logic_vector (3647 downto 0);
136 ram_data_mgt2 : in std_logic_vector (3647 downto 0);
137 ram_data_mgt3 : in std_logic_vector (3647 downto 0);
139 MGT_Commadet : in std_logic_vector(n_channels-1 downto 0);
140 MGT_Data : in mgt_rxdata_array (15 downto 0);
143 align_frame : in std_logic_vector(n_channels-1 downto 0);
144 disperr_error : in std_logic_vector(n_channels-1 downto 0);
145 notable_error : in std_logic_vector(n_channels-1 downto 0)
153 COMPONENT ila_inputRam
160 probe0 :
IN STD_LOGIC_VECTOR(
19 DOWNTO 0)
166 signal eg_Sync, eg_XSync : std_logic;
167 signal tau_XSync : std_logic;
168 signal eg_XValid : std_logic_vector(OUTPUT_TOBS-1 downto 0);
169 signal tau_XValid : std_logic_vector(OUTPUT_TOBS-1 downto 0);
178 signal mgt_data_int : mgt_data_in;
179 signal ram_data_int : ram_data_in;
180 signal sorted_TOB_BCN_i, XTOB_BCN_i, TOB_BCN_i : std_logic_vector(11 downto 0);
181 signal probe0 : STD_LOGIC_VECTOR(19 DOWNTO 0);
182 signal bcn_cntr_i :std_logic_vector(11 downto 0);
184 attribute keep : string;
185 attribute max_fanout : integer;
186 attribute keep of sel_data_in : signal is "true";
187 attribute max_fanout of sel_data_in : signal is 30;
197 mgt_data_int <= (00 => MGT_Data(00).gt0_rxdata_out, 01 => MGT_Data(00).gt1_rxdata_out, 02 => MGT_Data(00).gt2_rxdata_out, 03 => MGT_Data(00).gt3_rxdata_out,
198 04 => MGT_Data(01).gt0_rxdata_out, 05 => MGT_Data(01).gt1_rxdata_out, 06 => MGT_Data(01).gt2_rxdata_out, 07 => MGT_Data(01).gt3_rxdata_out,
199 08 => MGT_Data(02).gt0_rxdata_out, 09 => MGT_Data(02).gt1_rxdata_out, 10 => MGT_Data(02).gt2_rxdata_out, 11 => MGT_Data(02).gt3_rxdata_out,
200 12 => MGT_Data(03).gt0_rxdata_out, 13 => MGT_Data(03).gt1_rxdata_out, 14 => MGT_Data(03).gt2_rxdata_out, 15 => MGT_Data(03).gt3_rxdata_out,
201 16 => MGT_Data(04).gt0_rxdata_out, 17 => MGT_Data(04).gt1_rxdata_out, 18 => MGT_Data(04).gt2_rxdata_out, 19 => MGT_Data(04).gt3_rxdata_out,
202 20 => MGT_Data(05).gt0_rxdata_out, 21 => MGT_Data(05).gt1_rxdata_out, 22 => MGT_Data(05).gt2_rxdata_out, 23 => MGT_Data(05).gt3_rxdata_out,
203 24 => MGT_Data(06).gt0_rxdata_out, 25 => MGT_Data(06).gt1_rxdata_out, 26 => MGT_Data(06).gt2_rxdata_out, 27 => MGT_Data(06).gt3_rxdata_out,
204 28 => MGT_Data(07).gt0_rxdata_out, 29 => MGT_Data(07).gt1_rxdata_out, 30 => MGT_Data(07).gt2_rxdata_out, 31 => MGT_Data(07).gt3_rxdata_out,
205 32 => MGT_Data(08).gt0_rxdata_out, 33 => MGT_Data(08).gt1_rxdata_out, 34 => MGT_Data(08).gt2_rxdata_out, 35 => MGT_Data(08).gt3_rxdata_out,
206 36 => MGT_Data(09).gt0_rxdata_out, 37 => MGT_Data(09).gt1_rxdata_out, 38 => MGT_Data(09).gt2_rxdata_out, 39 => MGT_Data(09).gt3_rxdata_out,
207 40 => MGT_Data(10).gt0_rxdata_out, 41 => MGT_Data(10).gt1_rxdata_out, 42 => MGT_Data(10).gt2_rxdata_out, 43 => MGT_Data(10).gt3_rxdata_out,
208 44 => MGT_Data(11).gt0_rxdata_out, 45 => MGT_Data(11).gt1_rxdata_out, 46 => MGT_Data(11).gt2_rxdata_out, 47 => MGT_Data(11).gt3_rxdata_out,
209 48 => MGT_Data(12).gt0_rxdata_out, 49 => MGT_Data(12).gt1_rxdata_out, 50 => MGT_Data(12).gt2_rxdata_out, 51 => MGT_Data(12).gt3_rxdata_out,
210 52 => MGT_Data(13).gt0_rxdata_out, 53 => MGT_Data(13).gt1_rxdata_out, 54 => MGT_Data(13).gt2_rxdata_out, 55 => MGT_Data(13).gt3_rxdata_out,
211 56 => MGT_Data(14).gt0_rxdata_out, 57 => MGT_Data(14).gt1_rxdata_out, 58 => MGT_Data(14).gt2_rxdata_out, 59 => MGT_Data(14).gt3_rxdata_out,
212 60 => MGT_Data(15).gt0_rxdata_out, 61 => MGT_Data(15).gt1_rxdata_out, 62 => MGT_Data(15).gt2_rxdata_out, 63 => MGT_Data(15).gt3_rxdata_out);
215 ram_data_int <= (00 => ram_data_mgt0(227 downto 0 ), 01 => ram_data_mgt1(227 downto 0), 02 => ram_data_mgt2(227 downto 0), 03 => ram_data_mgt3(227 downto 0),
216 04 => ram_data_mgt0(455 downto 228) , 05 => ram_data_mgt1(455 downto 228), 06 => ram_data_mgt2(455 downto 228), 07 => ram_data_mgt3(455 downto 228),
217 08 => ram_data_mgt0(683 downto 456) , 09 => ram_data_mgt1(683 downto 456), 10 => ram_data_mgt2(683 downto 456), 11 => ram_data_mgt3(683 downto 456),
218 12 => ram_data_mgt0(911 downto 684) , 13 => ram_data_mgt1(911 downto 684), 14 => ram_data_mgt2(911 downto 684), 15 => ram_data_mgt3(911 downto 684),
219 16 => ram_data_mgt0(1139 downto 912) ,17 => ram_data_mgt1(1139 downto 912), 18 => ram_data_mgt2(1139 downto 912), 19 => ram_data_mgt3(1139 downto 912),
220 20 => ram_data_mgt0(1367 downto 1140),21 => ram_data_mgt1(1367 downto 1140), 22 => ram_data_mgt2(1367 downto 1140), 23 => ram_data_mgt3(1367 downto 1140),
221 24 => ram_data_mgt0(1595 downto 1368),25 => ram_data_mgt1(1595 downto 1368), 26 => ram_data_mgt2(1595 downto 1368), 27 => ram_data_mgt3(1595 downto 1368),
222 28 => ram_data_mgt0(1823 downto 1596),29 => ram_data_mgt1(1823 downto 1596), 30 => ram_data_mgt2(1823 downto 1596), 31 => ram_data_mgt3(1823 downto 1596),
223 32 => ram_data_mgt0(2051 downto 1824),33 => ram_data_mgt1(2051 downto 1824), 34 => ram_data_mgt2(2051 downto 1824), 35 => ram_data_mgt3(2051 downto 1824),
224 36 => ram_data_mgt0(2279 downto 2052),37 => ram_data_mgt1(2279 downto 2052), 38 => ram_data_mgt2(2279 downto 2052), 39 => ram_data_mgt3(2279 downto 2052),
225 40 => ram_data_mgt0(2507 downto 2280),41 => ram_data_mgt1(2507 downto 2280), 42 => ram_data_mgt2(2507 downto 2280), 43 => ram_data_mgt3(2507 downto 2280),
226 44 => ram_data_mgt0(2735 downto 2508),45 => ram_data_mgt1(2735 downto 2508), 46 => ram_data_mgt2(2735 downto 2508), 47 => ram_data_mgt3(2735 downto 2508),
227 48 => ram_data_mgt0(2963 downto 2736),49 => ram_data_mgt1(2963 downto 2736), 50 => ram_data_mgt2(2963 downto 2736), 51 => ram_data_mgt3(2963 downto 2736),
228 52 => ram_data_mgt0(3191 downto 2964),53 => ram_data_mgt1(3191 downto 2964), 54 => ram_data_mgt2(3191 downto 2964), 55 => ram_data_mgt3(3191 downto 2964),
229 56 => ram_data_mgt0(3419 downto 3192),57 => ram_data_mgt1(3419 downto 3192), 58 => ram_data_mgt2(3419 downto 3192), 59 => ram_data_mgt3(3419 downto 3192),
230 60 => ram_data_mgt0(3647 downto 3420),61 => ram_data_mgt1(3647 downto 3420), 62 => ram_data_mgt2(3647 downto 3420), 63 => ram_data_mgt3(3647 downto 3420));
234 generic map(n_channels => n_channels,
235 FPGA_NUMBER => FPGA_NUMBER
)
240 MGT_Commadet => MGT_Commadet,
247 start_pulse_rst => start_pulse_rst,
250 DataToAlgo => algo_in,
252 bc_cntr_0 => bc_cntr_0,
253 bc_cntr_1 => bc_cntr_1,
254 bc_cntr_2 => bc_cntr_2,
255 bc_cntr_3 => bc_cntr_3,
256 bc_mux_cntr_0 => bc_mux_cntr_0,
257 bc_mux_cntr_1 => bc_mux_cntr_1,
258 bc_mux_cntr_2 => bc_mux_cntr_2,
259 bc_mux_cntr_3 => bc_mux_cntr_3,
260 bcn_synch => bcn_synch,
261 crc_error_chan => crc_error_chan,
262 data_readout_0 => data_readout_0,
263 data_readout_1 => data_readout_1,
264 data_readout_2 => data_readout_2,
265 data_readout_3 => data_readout_3,
266 delay_num => delay_num,
267 Reg224_latch => Reg224_latch,
268 ttc_pipe => ttc_pipe,
269 delay_latch => delay_latch,
271 sel_data_in => sel_data_in,
272 ram_data => ram_data_int,
273 MGT_data => mgt_data_int,
274 align_frame => align_frame,
275 disperr_error => disperr_error,
276 notable_error => notable_error
284 generic map(ENCODING_MODE => ENCODING_MODE,
285 USE_INPUT_RAM => ENABLE_INPUT_RAM,
286 EFEX_POSITION => EFEX_POSITION,
287 USE_OUTPUT_RAMS => ENABLE_OUTPUT_RAMS,
289 EG_ALGO_VERSION => EG_ALGO_VERSION,
290 TAU_ALGO_VERSION => TAU_ALGO_VERSION
)
304 IN_BCN => bcn_cntr_i,
310 OUT_eg_Sync_XTOB => eg_XSync,
311 OUT_tau_Sync_XTOB => tau_XSync,
334 USE_INPUT_RAM => ENABLE_SORTING_INPUT_RAM,
335 USE_OUTPUT_RAM => ENABLE_SORTING_OUTPUT_RAM
)
338 IN_eg_Data => eg_TOB,
339 IN_tau_Data => tau_TOB,
346 OUT_BCN => sorted_TOB_BCN_i,
381 orbit_length => ttc_orbit_length_reg,
382 bcmux_value_sync => bcmuxvalue_sych_reg,
383 bcn_cntr => bcn_cntr_i
External data-types and functions.
( OUTPUT_TOBS- 1 downto 0) AlgoTriggerObject AlgoOutput
Algorithm OUTPUT port.
( INPUT_COLUMNS- 1 downto 0) AlgoColumn AlgoInput
Algorithm INPUT port.
std_logic_vector( OUT_TOB_WIDTH- 1 downto 0) AlgoTriggerObject
Algorithm Trigger Object TOB.
( OUTPUT_TOBS- 1 downto 0) AlgoXTriggerObject AlgoXOutput
Algorithm XOUTPUT port.
Top feature extracting algorithm module with IPBus interface.
in ipb_rst std_logic
IPBus reset.
out OUT_eg_Valid std_logic_vector( OUTPUT_TOBS- 1 downto 0)
Output data valid, high when correspondent output data are valid.
out OUT_eg_Valid_XTOB std_logic_vector( OUTPUT_TOBS- 1 downto 0)
Output data valid, high when correspondent output data are valid.
out OUT_BCN_TOB std_logic_vector( 11 downto 0)
Delayed crossing number as decoded from input data.
in CLK280 std_logic
280 MHz clock, used in the output stage
out OUT_tau_TOB AlgoOutput
Algorithm external data structure, defined in AlgoDataTypes.vhd.
out OUT_tau_XTOB AlgoXOutput
Algorithm external XTOB data structure, defined in AlgoDataTypes.vhd.
out OUT_eg_XTOB AlgoXOutput
Algorithm external XTOB data structure, defined in AlgoDataTypes.vhd.
out OUT_eg_Sync std_logic
Output sync, high on the first clock cycle of the BC.
out OUT_tau_Valid std_logic_vector( OUTPUT_TOBS- 1 downto 0)
Output data valid, high when correspondent output data are valid.
in IN_Data AlgoInput
Algorithm external data structure, defined in AlgoDataTypes.vhd.
out OUT_tau_Sync std_logic
Output sync, high on the first clock cycle of the BC.
in ipb_clk std_logic
IPBus clk.
out ipb_out ipb_rbus
IPBus read bus.
out OUT_eg_TOB AlgoOutput
Algorithm external data structure, defined in AlgoDataTypes.vhd.
in ipb_in ipb_wbus
IPBus write bus.
out OUT_eFEXPosition std_logic_vector( 31 downto 0)
Geographic position of eFEX Module, to be used in the mapping logic.
out OUT_BCN_XTOB std_logic_vector( 11 downto 0)
Delayed crossing number as decoded from input data.
out OUT_tau_Valid_XTOB std_logic_vector( OUTPUT_TOBS- 1 downto 0)
Output data valid, high when correspondent output data are valid.
Top of TOB sorting module with IPBus interface.
in eFEXPosition std_logic_vector( 31 downto 0)
Geographical position of eFEX module for dynamic mapping.
std_logic_vector( 31 downto 0) eFEXPosition
Geographic position of eFEX Module, for the mapping logic.
in in_load std_logic
clk 40MHz, 20% duty cycle
in ttc_clk std_logic
40 MHz clk
out OUT_sorted_eg_TOB AlgoTriggerObject
Sorted eg TOB 32bit.
out RAW_data RAW_data_227_type
RAW data to Readout.
in reset std_logic
syncronous reset used in data_alignment
in ipb_rst std_logic
ipbus reset
out OUT_TOB_BCN std_logic_vector( 11 downto 0)
BCN @280 MHZ referring to 7 TOBS in the BC.
out OUT_eg_Valid std_logic_vector( OUTPUT_TOBS- 1 downto 0)
Valid signal for eg XTOBS @200MHz.
in rx_clk280 std_logic_vector( n_channels- 1 downto 0)
MGT clocks.
out OUT_sorted_eg_Valid std_logic
Sorted TOB valid @280.
out OUT_sorted_tau_Valid std_logic
Sorted TOB valid @280.
in BC_Reg_sel std_logic_vector( 255 downto 0)
16-b BC MUX select for 16 Quads
out OUT_XTOB_BCN std_logic_vector( 11 downto 0)
XTOB BCN @200 MHZ referring to 5 TOBS in the BC.
out OUT_sorted_tau_Sync std_logic
Sorted TOB synch @280 marking first TOB of 7.
out OUT_sorted_tau_TOB AlgoTriggerObject
Sorted eg TOB 32bit.
in ipb_in_algo ipb_wbus
ipbus connection for algorithm
out ipb_out_algo ipb_rbus
ipbus connection for algorithm
out OUT_tau_XTOB AlgoXOutput
tau XTOBS 8 x 64bit @200MHz
in mux_sel std_logic_vector( 255 downto 0)
16-b 1st stage MUX select for 16 Quads
out OUT_eg_XTOB AlgoXOutput
eg XTOBS 8 x 64bit @200MHz
out OUT_eg_Sync std_logic
Sync signal for XTOBS @200MHz marking the first XTOB of 5.
in ipb_in_sorting ipb_wbus
ipbus connection for local TOB sorting
out OUT_tau_Valid std_logic_vector( OUTPUT_TOBS- 1 downto 0)
Valid signal for eg XTOBS @200MHz.
out OUT_tau_Sync std_logic
Sync signal for XTOBS @200MHz marking the first XTOB of 5.
in clk280 std_logic
Used in the output stage of the algorithm.
in rx_resetdone std_logic_vector( n_channels- 1 downto 0)
reset done from GMTs
in ipb_clk std_logic
ipbus clock
out ipb_out_sorting ipb_rbus
ipbus connection for local TOB sorting
out OUT_sorted_eg_Sync std_logic
Sorted TOB synch @280 marking first TOB of 7.
in sel_bcn_or_bc_cnt std_logic
selects between real data BC value (1) and BC delay counter (0) to ipbus
in enable_mgt std_logic_vector( n_channels- 1 downto 0)
MGT enable.
out pseudo_orbit std_logic
Pulse generated when 5-bit BCN is 00000.