eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
Readout_logic_top.vhd
Go to the documentation of this file.
1 
87 
88 
89 library IEEE;
90 use IEEE.STD_LOGIC_1164.ALL;
91 use IEEE.NUMERIC_STD.ALL;
92 
93 Library UNISIM;
94 use UNISIM.vcomponents.all;
95 
96 Library UNIMACRO;
97 use UNIMACRO.vcomponents.all;
98 
99 library TOB_rdout_lib;
100 use TOB_rdout_lib.data_type_pkg.all;
101 use TOB_rdout_lib.TOB_rdout_ip_pkg.all;
102 
103 library ipbus_lib;
104 use ipbus_lib.ipbus.all;
105 
106 library algolib;
107 use algolib.AlgoDataTypes.all;
108 
109 library infrastructure_lib;
110 
113  Generic
114  (
116  FPGA_NUMBER : integer := 1
117  ) ;
118  Port (
120  RST : in std_logic ;
122  hw_addr : in STD_LOGIC_VECTOR(1 downto 0) ;
124  ipb_rst : in std_logic ;
126  ipb_clk : in std_logic ;
128  IPb_in : in ipb_wbus;
130  IPb_out : out ipb_rbus;
132  clk_load_in : in STD_LOGIC;
134  clk_40M_rdout : in STD_LOGIC;
136  clk_200M_in : in STD_LOGIC;
138  clk_280M_in : in STD_LOGIC;
140  clk_40M_in : in STD_LOGIC;
142  shelf_number : in STD_LOGIC_VECTOR (3 downto 0);
144  efex_slot_num : in STD_LOGIC_VECTOR (3 downto 0);
146  TOB_TXOUTCLK : in STD_LOGIC;
148  RAW_TXOUTCLK : in STD_LOGIC;
149  -- eXtended TOB data readout signals
151  XTOB_eg_in : in AlgoXOutput; -- array 8 x 64b words XTOB e/g
153  XTOB_eg_Valid_flg_in : in STD_LOGIC_VECTOR (7 downto 0);
155  XTOB_eg_sync_in : in STD_LOGIC;
157  XTOB_tau_in : in AlgoXOutput; -- array 8 x 64b words XTOB tau
159  XTOB_tau_Valid_flg_in : in STD_LOGIC_VECTOR (7 downto 0);
161  XTOB_tau_sync_in : in STD_LOGIC;
163  OUT_XTOB_BCN : in std_logic_vector(6 downto 0);
165  T_TOB_32b_in : in STD_LOGIC_VECTOR (31 downto 0);
167  T_TOB_sync_in : in STD_LOGIC;
169  T_TOB_valid_in : in STD_LOGIC;
171  OUT_TOB_BCN : in std_logic_vector(6 downto 0);
173  L1A_in : in STD_LOGIC;
175  ECR_in : in STD_LOGIC;
177  BCR_in : in STD_LOGIC;
179  TTC_read_all_in : in STD_LOGIC;
181  local_BCN_out : out STD_LOGIC_VECTOR (11 downto 0);
183  TTC_L1A_ID_EXT_in : in STD_LOGIC_VECTOR (7 downto 0);
185  TTC_L1A_ID_in : in STD_LOGIC_VECTOR (23 downto 0);
187  TTC_parity_in : in STD_LOGIC;
189  TOB_ready_in : in std_logic ;
191  RAW_ready_in : in std_logic ;
193  busy_raw : out std_logic;
195  busy_tob : out std_logic;
197  TOB_out_is_char : out STD_LOGIC;
199  TOB_out : out STD_LOGIC_VECTOR (31 downto 0);
202  mgt_enable_in : in STD_LOGIC_VECTOR (48 downto 0) ;
204  RAW_data_in : in RAW_data_227_type;
206  RAW_out_is_char : out STD_LOGIC;
208  RAW_data_out : out STD_LOGIC_VECTOR (31 downto 0)
209  );
211 
213 architecture Behavioral of Readout_logic_top is
214 
215 --************************** Register Declarations ****************************
216 
217  -- number of DRP locations (Slices) to read 1 to 5
218  signal DPR_locations_to_rd_i : STD_LOGIC_VECTOR (2 downto 0) := "001" ; -- number of slices to read
219  signal trigger_slice_i : std_logic_vector(3 downto 0) := "0000" ; -- tigger slice number - on L1A
220 
221  signal pre_ld_RAW_wr_addr_i : STD_LOGIC_VECTOR (9 downto 0) ; -- The write address offset pre load for Circular DRPAM of RAW data
222  signal pre_ld_TOB_wr_addr_i : STD_LOGIC_VECTOR (8 downto 0) ;
223  signal pre_ld_XTOB_eg_wr_addr_i : STD_LOGIC_VECTOR (8 downto 0) ;
224  signal pre_ld_XTOB_tau_wr_addr_i : STD_LOGIC_VECTOR (8 downto 0) ;
225  signal RAW_data_tmp : RAW_data_228_type; -- array 49 x 228b input frames
226 -- signal link_error_flags_i : link_error_type; -- array 49 x 4 bit per link
227 
228  signal L1A_ID_i : STD_LOGIC_VECTOR (23 downto 0);
229  signal L1A_ID_EXT_i : STD_LOGIC_VECTOR (7 downto 0);
230  signal RST_i, BCR_1dly : STD_LOGIC ;
231  signal TTC_read_all_1dly : STD_LOGIC := '0' ;
232  signal rst_ECR_dbg_cntr_i : STD_LOGIC := '0' ;
233  signal rst_L1A_dbg_cntr_i : STD_LOGIC := '0' ;
234 
235  signal XTOB_eg_FIFO_pFULL_THRESH_assert_i : STD_LOGIC_VECTOR (8 downto 0) ; -- XTOB_eg__FIFO
236  signal XTOB_eg_FIFO_pFULL_THRESH_negate_i : STD_LOGIC_VECTOR (8 downto 0) ; -- XTOB_eg__FIFO
237  signal XTOB_eg_FIFO_data_count_i : STD_LOGIC_VECTOR (8 downto 0) ; -- XTOB_eg__FIFO
238  signal XTOB_tau_FIFO_pFULL_THRESH_assert_i : STD_LOGIC_VECTOR (8 downto 0) ; -- XTOB_tau_FIFO
239  signal XTOB_tau_FIFO_pFULL_THRESH_negate_i : STD_LOGIC_VECTOR (8 downto 0) ; -- XTOB_tau_FIFO
240  signal XTOB_tau_FIFO_data_count_i : STD_LOGIC_VECTOR (8 downto 0) ; -- XTOB_tau_FIFO
241 
242  signal TOB_FIFO_pFULL_THRESH_assert_i : STD_LOGIC_VECTOR (8 downto 0) ; -- sorted TOBs_FIFO
243  signal TOB_FIFO_pFULL_THRESH_negate_i : STD_LOGIC_VECTOR (8 downto 0) ; -- sorted TOBs_FIFO
244  signal TOB_FIFO_data_count_i : STD_LOGIC_VECTOR (8 downto 0) ; -- sorted TOBs_FIFO
245  signal tob_busy_thresh_assert_i : STD_LOGIC_VECTOR (8 downto 0) ; -- sorted TOBs_FIFO
246  signal tob_busy_thresh_negate_i : STD_LOGIC_VECTOR (8 downto 0) ; -- sorted TOBs_FIFO
247  signal TOB_Link_outpout_FIFO_pFULL_THRESH_assert_i : STD_LOGIC_VECTOR (12 downto 0) ; -- TOB Link o/p FIFO
248  signal TOB_Link_outpout_FIFO_pFULL_THRESH_negate_i : STD_LOGIC_VECTOR (12 downto 0) ; -- TOB Link o/p FIFO
249  signal TOB_Link_outpout_FIFO_rd_data_count_i : STD_LOGIC_VECTOR (12 downto 0) ; -- TOB Link o/p FIFO
250 
251  signal RAW_FIFO_pFULL_THRESH_ASSERT_i : STD_LOGIC_VECTOR (8 downto 0) ; -- RAW input FIFOFIFO
252  signal RAW_FIFO_pFULL_THRESH_NEGATE_i : STD_LOGIC_VECTOR (8 downto 0) ; -- RAW input FIFOFIFO
253 
254  signal BCN_FIFO_TOB_pFULL_THRESH_assert_i : STD_LOGIC_VECTOR (8 downto 0) ; -- BCN FIFO
255  signal BCN_FIFO_TOB_pFULL_THRESH_negate_i : STD_LOGIC_VECTOR (8 downto 0) ; -- BCN FIFO
256  signal BCN_FIFO_TOB_rd_data_count_i : STD_LOGIC_VECTOR (8 downto 0) ; -- BCN FIFO
257  signal BCN_FIFO_RAW_pFULL_THRESH_assert_i : STD_LOGIC_VECTOR (8 downto 0) ; -- BCN FIFO
258  signal BCN_FIFO_RAW_pFULL_THRESH_negate_i : STD_LOGIC_VECTOR (8 downto 0) ; -- BCN FIFO
259  signal BCN_FIFO_RAW_rd_data_count_i : STD_LOGIC_VECTOR (8 downto 0) ; -- BCN FIFO
260 
261  signal Link_output_FIFO_RAW_rd_data_count_i : STD_LOGIC_VECTOR (12 downto 0) ; -- occupancy of RAW output link MGT FIFO
262  signal Link_output_FIFO_RAW_pfull_thresh_assert_i : STD_LOGIC_VECTOR (12 downto 0) ; -- link o/p FIFO
263  signal Link_output_FIFO_RAW_pfull_thresh_negate_i : STD_LOGIC_VECTOR (12 downto 0) ; -- link o/p FIFO
264 
265  signal RAW_frame_count_i : STD_LOGIC_VECTOR (31 downto 0) ; -- calo data Frame counter
266  signal RDOUT_PULSE_REG_i : STD_LOGIC_VECTOR (31 downto 0) ; -- pulse register in Readout block
267  signal SPY_mem_wr_addr_i : STD_LOGIC_VECTOR (10 downto 0) ; -- calo data SPY memory wr addr pointer
268 
269  signal SPY_TOB_mem_wr_addr_i : STD_LOGIC_VECTOR (10 downto 0) ; -- TOB data SPY memory wr addr pointer
270 
271  signal reg1 , reg2 : std_logic := '0' ;
272  signal reg3 , reg4 : std_logic := '0' ;
273  signal reg5 , reg6 : std_logic := '0' ;
274  signal reg7 , reg8 : std_logic := '0' ;
275  signal reg9 , reg10 : std_logic := '0' ;
276  signal reg11 , reg12 : std_logic := '0' ;
277  signal reg13 , reg14 : std_logic := '0' ;
278  signal reg15 , reg16 : std_logic := '0' ;
279  signal reg17 , reg18 : std_logic := '0' ;
280  signal reg19 , reg20 : std_logic := '0' ;
281  signal L1A_in_int : std_logic := '0';
282  signal TOB_err_4b_in_i : STD_LOGIC_VECTOR (3 downto 0); -- 4b error flags CT + BN2 + TIE + EIE
283  signal TEST_CONTROL_REG_i : std_logic_VECTOR (31 downto 0); -- control register for test purposes
284 
285  signal RAW_data_FIFO_flags_i : STD_LOGIC_VECTOR (31 downto 0);
286  signal TOB_data_FIFO_flags_i : STD_LOGIC_VECTOR (31 downto 0);
287  signal RAW_FIFO_sw_rst_i : STD_LOGIC ;
288  signal TOB_FIFO_sw_rst_i : STD_LOGIC ;
289  signal SPY_RAM_wr_addr_rst_i : STD_LOGIC ;
290 
291  signal XTOB_eg_512b_in_i : AlgoXOutput; -- i/p TOBs e/g 64b * 8
292  signal XTOB_eg_Valid_flg_in_i : STD_LOGIC_VECTOR (7 downto 0) ; -- i/p 8b TOB e/g has valid data
293  signal XTOB_eg_sync_in_i : STD_LOGIC ; -- i/p TOB e/g sync signal
294  -- XTOBs tau 64b * 8
295  signal XTOB_tau_512b_in_i : AlgoXOutput; -- i/p TOBs tau 32b * 8
296  signal XTOB_tau_Valid_flg_in_i : STD_LOGIC_VECTOR (7 downto 0) ; -- i/p 8b TOB tau has valid data
297  signal XTOB_tau_sync_in_i : STD_LOGIC ;-- i/p TOB tau sync signal
298  -- Topo TOB data readout signals
299  -- F1 reads e/g TOBs and F2 reads tau TOBs
300  -- so same firmware in both FPGAs, use hw addr to differentiate
301  signal T_TOB_32b_in_i : STD_LOGIC_VECTOR (31 downto 0); -- i/p sorted TOBs e/g 32b * 7 is series
302  signal T_TOB_sync_in_i : STD_LOGIC ; -- i/p sorted TOB e/g start signal
303  signal T_TOB_valid_in_i : STD_LOGIC ; -- i/p sorted TOB e/g write signal
304  signal TOB_type_i : STD_LOGIC ; -- TOB Type 0 = e/g for pFPGA U1, TOB Type U1 = tau for pFPGA 2, also Zero for U3 & U4
305 
306  signal OUT_TOB_BCN_i : std_logic_vector (6 downto 0); -- sorted TOB BC_ID with delay through ALGO/sorting block
307  signal OUT_XTOB_BCN_i : std_logic_vector (6 downto 0); -- sorted XTOB BC_ID with delay through ALGO/sorting block
308 
309  signal ECR_1dly : std_logic ; -- ECR signal delayed by 1 clk
310  signal raw_rd_all_i : std_logic ; -- readout all raw data
311  signal read_on_err_i : std_logic ; -- readout raw data on error
312 
313  signal TOB_ready_in_i : std_logic ; -- Control FPGA Ready signal internal
314  signal RAW_ready_in_i : std_logic ; -- Control FPGA Ready signal internal
315  signal RAW_FIFO_FULL_THRESH_ASSERT_i : STD_LOGIC_VECTOR(8 downto 0); -- threshold to asser full flag for RAW FIFO
316  signal RAW_FIFO_FULL_THRESH_NEGATE_i : STD_LOGIC_VECTOR(8 downto 0); -- threshold to remove full flag for RAW FIFO
317  signal RAW_FIFO_data_count_i : STD_LOGIC_VECTOR(8 downto 0); -- count data RAW FIFO
318  signal raw_busy_thresh_assert_i : STD_LOGIC_VECTOR(8 downto 0); -- count data RAW FIFO
319  signal raw_busy_thresh_negate_i : STD_LOGIC_VECTOR(8 downto 0); -- count data RAW FIFO
320 
321  signal TOB_out_is_char_i : std_logic ;
322  signal TOB_out_i : STD_LOGIC_VECTOR(31 downto 0);
323 
324  signal RAW_out_is_char_i : std_logic ;
325  signal RAW_data_out_i : STD_LOGIC_VECTOR(31 downto 0);
326 
327  signal L1A_ID_int : STD_LOGIC_VECTOR(31 downto 0);
328  signal L1A_ID_Event_i : STD_LOGIC_VECTOR(31 downto 0);
329  signal local_BCN_i : std_logic_vector(11 downto 0);
330  signal FIFO_error_flags_54b_i : STD_LOGIC_VECTOR (53 downto 0);
331  signal busy_raw_counter_i : STD_LOGIC_VECTOR (31 downto 0);
332  signal busy_tob_counter_i : STD_LOGIC_VECTOR (31 downto 0);
333  signal real_time_40m_counter_i : std_logic_vector( 31 downto 0);
334  signal busy_raw_duration_counter_i : std_logic_vector( 31 downto 0);
335  signal busy_tob_duration_counter_i : std_logic_vector( 31 downto 0);
336 
337  signal ipbus_out_raw_dpram_i : ipb_rbus; -- signal going to RAW SPY DPRAM
338  signal ipbus_in_raw_dpram_i : ipb_wbus; -- signal coming from RAW SPY DPRAM
339  signal ipbus_out_tob_dpram_i : ipb_rbus; -- signal going to TOB SPY DPRAM
340  signal ipbus_in_tob_dpram_i : ipb_wbus; -- signal coming from TOB SPY DPRAM
341 
342  signal busy_tob_i, busy_raw_i : std_logic ;
343  signal busy_tob_tmp, busy_raw_tmp : std_logic ;
344  signal busy_tob_1dly, busy_raw_1dly : std_logic ;
345  signal busy_counter_rst_i : std_logic ;
346  signal ECR_debug_counter_i : std_logic_vector( 31 downto 0);
347  signal L1A_debug_counter_i : std_logic_vector( 31 downto 0);
348  signal raw_fsm_monitor_i : std_logic_vector( 31 downto 0);
349  signal tob_fsm_monitor_i : std_logic_vector( 39 downto 0);
350  signal sync_280m_i : std_logic;
351  signal busy_cntr_latch_i : std_logic;
352  signal busy_reg_1, busy_reg_2 : std_logic;
353  signal tob_double_word_en_i : std_logic;
354  signal tob_double_word_counter_i : std_logic_vector( 31 downto 0);
355 
356  signal TOB_BCN_FIFO_tidemark_i : std_logic_vector(15 downto 0);
357  signal TOB_data_FIFO_tidemark_i : std_logic_vector(15 downto 0);
358  signal XTOB_data_FIFO_tidemark_i : std_logic_vector(15 downto 0);
359  signal TOB_LO_FIFO_tidemark_i : std_logic_vector(15 downto 0);
360 
361  signal RAW_BCN_FIFO_tidemark_i : std_logic_vector(15 downto 0);
362  signal RAW_data_FIFO_tidemark_i : std_logic_vector(15 downto 0);
363  signal RAW_LO_FIFO_tidemark_i : std_logic_vector(15 downto 0);
364 
365  signal ttc_parity_int : std_logic := '0';
366 
367  signal ttc_err_history_debug: std_logic_vector(31 downto 0) := (others => '0');
368  signal l1a_id_good_debug: std_logic_vector(31 downto 0) := (others => '0');
369  signal l1a_id_err_debug: std_logic_vector(31 downto 0) := (others => '0');
370  signal l1a_id_expected_debug: std_logic_vector(31 downto 0) := (others => '0');
371  signal bcn_err_expected_debug: std_logic_vector(31 downto 0) := (others => '0');
372  signal l1id_parity_err_cntr_debug: std_logic_vector(31 downto 0) := (others => '0');
373  signal l1id_mismatch_cntr_debug: std_logic_vector(31 downto 0) := (others => '0');
374  signal bcn_parity_err_cntr_debug: std_logic_vector(31 downto 0) := (others => '0');
375  signal bcn_mismatch_cntr_debug: std_logic_vector(31 downto 0) := (others => '0');
376 
377 -- ####### attributes ########
378  attribute TIG : string ;
379  attribute TIG of busy_tob_i : signal is "true" ;
380  attribute TIG of busy_tob_1dly : signal is "true" ;
381  attribute TIG of busy_tob_tmp : signal is "true" ;
382  attribute TIG of busy_raw_i : signal is "true" ;
383  attribute TIG of busy_raw_1dly : signal is "true" ;
384  attribute TIG of busy_raw_tmp : signal is "true" ;
385 
386  attribute keep : string ;
387  attribute max_fanout : integer;
388  attribute keep of L1A_ID_i : signal is "true" ;
389  attribute max_fanout of L1A_ID_i : signal is 40;
390 
391 -- attribute equivalent_register_removal: string;
392 -- attribute equivalent_register_removal of Behavioral : architecture is "no";
393 
394 -- #######################################
395 
396 begin
397 
398  RST_i <= RST; -- from 40MHz MMCM lock signal
399 
400  busy_tob <= busy_tob_i; -- TOB busy out to control FPGA
401  busy_raw <= busy_raw_i; -- TOB busy out to control FPGA
402 
403  local_BCN_out <= local_BCN_i;
404 
405 -- Register data out to MGT...
406 tob_out_reg: process(TOB_TXOUTCLK)
407 Begin
408  if rising_edge (TOB_TXOUTCLK) then
409  TOB_out_is_char <= TOB_out_is_char_i ;
410  TOB_out <= TOB_out_i ; -- o/p
411  end if;
412 end process tob_out_reg;
413 
414 raw_out_reg: process(RAW_TXOUTCLK)
415 Begin
416  if rising_edge (RAW_TXOUTCLK) then
417  RAW_out_is_char <= RAW_out_is_char_i ; -- Raw data valid to MGT
418  RAW_data_out <= RAW_data_out_i ; -- raw data 32b data to MGT
419  end if;
420 end process raw_out_reg;
421 
422 -- TOB Type 0 = e/g for pFPGA U1, TOB Type 1 = tau for pFPGA U2.
423 -- It is also Zero for pFPGA U3 and U4
424 TOB_type_gen : if FPGA_NUMBER = 2 generate
425  TOB_type_i <= '1' ;
426  else generate
427  TOB_type_i <= '0';
428  end generate TOB_type_gen;
429 
430 -- Pipeline the TOBs and cFPGA Ready input signals by one 280 MHz clock
431 proc2 : process (clk_280M_in)
432 begin
433  if rising_edge (clk_280M_in) then
434  -- register the signals
435  RAW_ready_in_i <= RAW_ready_in ;
436  TOB_ready_in_i <= TOB_ready_in ;
437  -- register the TOB data by one clock to move away from the real time circuit
438  T_TOB_32b_in_i <= T_TOB_32b_in ;
439  T_TOB_sync_in_i <= T_TOB_sync_in ;
440  T_TOB_valid_in_i <= T_TOB_valid_in ;
441  OUT_TOB_BCN_i <= OUT_TOB_BCN; -- sorted TOB BC_ID with delay through ALGO/sorting block
442 
443  busy_tob_1dly <= busy_tob_i; -- TOB busy out to control FPGA
444  if busy_tob_1dly = '0' AND busy_tob_i = '1' then
445  busy_tob_tmp <= '1'; -- count number of BUSY assertions
446  else
447  busy_tob_tmp <= '0';
448  end if;
449 
450  busy_raw_1dly <= busy_raw_i; -- RAW busy out to control FPGA
451  if busy_raw_1dly = '0' AND busy_raw_i = '1' then
452  busy_raw_tmp <= '1'; -- count number of BUSY assertions
453  else
454  busy_raw_tmp <= '0';
455  end if;
456  end if;
457  end process;
458 
459 U0_ECR_debug_counter : entity TOB_rdout_lib.cntr_generic
460  generic map (
461  width => 32
462  )
463  port map (
464  CE => ECR_1dly, -- if a valid data, then increment
465  CLK => clk_40M_in,
466  RST => RST_i OR rst_ECR_dbg_cntr_i ,
467  Q => ECR_debug_counter_i
468  );
469 
470 U0_L1A_debug_counter : entity TOB_rdout_lib.cntr_generic
471  generic map (
472  width => 32
473  )
474  port map (
475  CE => L1A_in_int, -- if a valid data, then increment
476  CLK => clk_40M_in,
477  RST => RST_i OR rst_L1A_dbg_cntr_i ,
478  Q => L1A_debug_counter_i
479  );
480 
481 U0_TOB_busy : entity TOB_rdout_lib.cntr_generic
482  generic map (
483  width => 32
484  )
485  port map (
486  CE => busy_tob_tmp, -- if a valid data, then increment
487  CLK => clk_280M_in,
488  RST => RST_i OR busy_counter_rst_i ,
489  Q => busy_tob_counter_i
490  );
491 
492 U0_RAW_busy : entity TOB_rdout_lib.cntr_generic
493  generic map (
494  width => 32
495  )
496  port map (
497  CE => busy_raw_tmp, -- if a valid data, then increment
498  CLK => clk_280M_in,
499  RST => RST_i OR busy_counter_rst_i ,
500  Q => busy_raw_counter_i
501  );
502 
503 U0_busy_tob_duration_counter : entity TOB_rdout_lib.cntr_generic
504  generic map (
505  width => 32
506  )
507  port map (
508  CE => (busy_tob_i AND sync_280m_i), -- if a valid data, then increment
509  CLK => clk_280M_in,
510  RST => RST_i OR busy_counter_rst_i ,
511  Q => busy_tob_duration_counter_i
512  );
513 
514 U0_busy_raw_duration_counter : entity TOB_rdout_lib.cntr_generic
515  generic map (
516  width => 32
517  )
518  port map (
519  CE => (busy_raw_i AND sync_280m_i), -- if a valid data, then increment
520  CLK => clk_280M_in,
521  RST => RST_i OR busy_counter_rst_i ,
522  Q => busy_raw_duration_counter_i
523  );
524 
525 U0_real_time_40m_counter : entity TOB_rdout_lib.cntr_generic
526  generic map (
527  width => 32
528  )
529  port map (
530  CE => '1', -- if a valid data, then increment
531  CLK => clk_40M_rdout,
532  RST => RST_i OR busy_counter_rst_i ,
533  Q => real_time_40m_counter_i
534  );
535 
536 U0_tob_double_word_counter : entity TOB_rdout_lib.cntr_generic
537  generic map (
538  width => 32
539  )
540  port map (
541  CE => tob_double_word_en_i, -- if a valid data, then increment
542  CLK => clk_280M_in,
543  RST => RST_i OR SPY_RAM_wr_addr_rst_i ,
544  Q => tob_double_word_counter_i
545  );
546 
547 -- TideMark Counters for BCN FIFO inside TOB/XTOB Readout
548 U0_tob_bcn_tidemark : entity TOB_rdout_lib.tide_mark_block
549  generic map (
550  width => 16
551  )
552  port map (
553  rst_in => RST_i OR busy_counter_rst_i ,
554  CLK_in => clk_280M_in,
555  value_bus => "0000000" & BCN_FIFO_TOB_rd_data_count_i ,
556  tide_mark_out => TOB_BCN_FIFO_tidemark_i
557  );
558 
559 -- TideMark Counters for TOB Data FIFO inside TOB/XTOB Readout
560 U0_tob_data_tidemark : entity TOB_rdout_lib.tide_mark_block
561  generic map (
562  width => 16
563  )
564  port map (
565  rst_in => RST_i OR busy_counter_rst_i ,
566  CLK_in => clk_280M_in,
567  value_bus => "0000000" & TOB_FIFO_data_count_i ,
568  tide_mark_out => TOB_data_FIFO_tidemark_i
569  );
570 
571 -- TideMark Counters for XTOB Data FIFO inside TOB/XTOB Readout
572 U0_xtob_data_tidemark : entity TOB_rdout_lib.tide_mark_block
573  generic map (
574  width => 16
575  )
576  port map (
577  rst_in => RST_i OR busy_counter_rst_i , -- if a valid data, then increment
578  CLK_in => clk_280M_in,
579  value_bus => "0000000" & XTOB_eg_FIFO_data_count_i , -- TOB & XTOB data counts are the same, use XTOB for U3 & U4
580  tide_mark_out => XTOB_data_FIFO_tidemark_i
581  );
582 
583 -- TideMark Counters for TOB LO FIFO inside TOB/XTOB Readout
584 U0_TOB_LO_fifo_tidemark : entity TOB_rdout_lib.tide_mark_block
585  generic map (
586  width => 16
587  )
588  port map (
589  rst_in => RST_i OR busy_counter_rst_i , -- if a valid data, then increment
590  CLK_in => clk_280M_in,
591  value_bus => "000" & TOB_Link_outpout_FIFO_rd_data_count_i ,
592  tide_mark_out => TOB_LO_FIFO_tidemark_i
593  );
594 
595 -- Pipeline the XTOBs input signals by one 200 MHz clock
596 --proc3 : process (clk_200M_in)
597 --begin
598 
599  raw_rd_all_i <= TEST_CONTROL_REG_i(0) ; -- software/priviledge readout all raw data
600 
601 -- Pipeline the XTOBs input signals by one 200 MHz clock
602 --proc3 : process (clk_200M_in)
603 --begin
604 -- if rising_edge (clk_200M_in) then
605  -- register the XTOB data by one clock to move away from the real time circuit
606  XTOB_eg_512b_in_i <= XTOB_eg_in ;
607  XTOB_eg_Valid_flg_in_i <= XTOB_eg_Valid_flg_in ;
608  XTOB_eg_sync_in_i <= XTOB_eg_sync_in ;
609  XTOB_tau_512b_in_i <= XTOB_tau_in ;
610  XTOB_tau_Valid_flg_in_i <= XTOB_tau_Valid_flg_in ;
611  XTOB_tau_sync_in_i <= XTOB_tau_sync_in ;
612  OUT_XTOB_BCN_i <= OUT_XTOB_BCN; -- sorted XTOB BC_ID with delay through ALGO/sorting block
613 -- end if;
614 -- end process;
615 
616 -- clk reg the MUX to remove timing (L1A is seen as 8 clks instead of 7 clks)
617 U6_MUXF7 : process (clk_40M_in)
618  begin
619  if clk_40M_in'event and clk_40M_in = '1' then
620  L1A_in_int <= L1A_in ; -- TTC L1A
621  L1A_ID_EXT_i <= TTC_L1A_ID_EXT_in; -- delay ECR_ID by 1 clocks to match the L1A_in delay of 1 ticks
622  L1A_ID_i <= TTC_L1A_ID_in; -- delay L1ID by 1 clocks to match the L1A_in delay of 1 ticks
623  ttc_parity_int <= TTC_parity_in;
624  end if;
625  end process;
626 
627 -- i/p 8b Ext L1A ID from TTC input + 24b L1A ID of counter
628  L1A_ID_int <= L1A_ID_EXT_i & L1A_ID_i;
629 
630 -- TOBs_Readout Module is responsible for reading the sorted TOBs and XTOBS from outputs of Algo Block,
631 U0_TOBs_readout : entity TOB_rdout_lib.TOBs_rdout
632  generic map(FPGA_NUMBER => FPGA_NUMBER)
633  Port map (
634  RST => RST_i, -- i/p
635  hw_addr => hw_addr , -- i/p
636  RST_spy_mem_wr_addr => SPY_RAM_wr_addr_rst_i , -- i/p SPY memory read address reset to ZERO
637  TOB_FIFO_sw_rst => TOB_FIFO_sw_rst_i, -- i/p TOB Readout FIFO reset Pulse under s/w control
638  -- XTOBs e/g 64b * 8 as input data is 32, we have 32b * 16
639  XTOB_eg_512b_in => XTOB_eg_512b_in_i , -- i/p array 8 * 64b TOBs e/g
640  XTOB_eg_Valid_flg_in => XTOB_eg_Valid_flg_in_i , -- i/p 8b TOB e/g has valid data
641  XTOB_eg_sync_in => XTOB_eg_sync_in_i , -- i/p TOB e/g sync signal
642  -- XTOBs tau 64b * 8
643  XTOB_tau_512b_in => XTOB_tau_512b_in_i , -- i/p array 8 * 64b TOBs tau
644  XTOB_tau_Valid_flg_in => XTOB_tau_Valid_flg_in_i , -- i/p 8b TOB tau has valid data
645  XTOB_tau_sync_in => XTOB_tau_sync_in_i , -- i/p TOB tau sync signal
646  OUT_XTOB_BCN => OUT_XTOB_BCN_i, -- sorted XTOB BCN with delay through ALGO/sorting block
647  -- TOBs data readout signals
648  -- F1 reads e/g TOBs and F2 reads tau TOBs
649  -- so same firmware in both FPGAs, use hw addr to differentiate
650  TOBs_32b_in => T_TOB_32b_in_i, -- i/p sorted TOBs e/g 32b * 7 is series
651  TOBS_sync_in => T_TOB_sync_in_i, -- i/p sorted TOB e/g start signal
652  TOBs_valid_flg_in => T_TOB_valid_in_i, -- i/p sorted TOB e/g write signal
653  OUT_TOB_BCN => OUT_TOB_BCN_i, -- sorted TOB BC_ID with delay through ALGO/sorting block
654  TOB_type_in => TOB_type_i ,
655  read_on_err_in => read_on_err_i,
656  clk_40M_in => clk_40M_in , -- i/p
657  clk_200M_in => clk_200M_in , -- i/p
658  clk_280M_in => clk_280M_in , -- i/p
659  shelf_number => shelf_number, -- i/p shelf address
660  efex_slot_num => efex_slot_num, -- i/p slot address
661  ipb_clk => ipb_clk , -- i/p
662  TOB_TXOUTCLK => TOB_TXOUTCLK , -- i/p
663  L1A_in => L1A_in_int , -- input from TTC_L1A or SW_L1A
664  BCN_ID_in => local_BCN_i, -- i/p
665  L1A_ID_in => L1A_ID_int, -- i/p 8b Ext L1A ID from TTC input + 24b L1A ID of counter
666  TOB_ready_in => TOB_ready_in_i , -- i/p
667 
668  TOB_out_to_MGT_is_char => TOB_out_is_char_i , -- o/p
669  TOB_out_to_MGT => TOB_out_i , -- o/p
670  L1A_ID_Event_out => L1A_ID_Event_i, -- o/p 8b L1A ID Extended + 24b L1A ID of the current event
671 
672  pre_ld_TOB_wr_addr => pre_ld_TOB_wr_addr_i , -- i/p latency pre load for TOB DRP wr address
673  pre_ld_eg_XTOB_wr_addr => pre_ld_XTOB_eg_wr_addr_i , -- i/p latency pre load for e/g XTOB DRP wr address
674  pre_ld_tau_XTOB_wr_addr => pre_ld_XTOB_tau_wr_addr_i , -- i/p latency pre load for tau XTOB DRP wr address
675  cntr_load_en => '0', -- was cntr_load_en_i ,
676  DPR_locations_to_rd => DPR_locations_to_rd_i , -- i/p number of DRP locations to read 1 to 5
677  trigger_slice_in => trigger_slice_i , -- i/p Trigger slice number - on L1A
678  TOB_data_FIFO_flags => TOB_data_FIFO_flags_i , -- TOB block FIFO Flags
679  -- XTOBs
680  XTOB_eg_FIFO_rd_data_count => XTOB_eg_FIFO_data_count_i, -- o/p
681  XTOB_eg_FIFO_pFULL_THRESH_assert => XTOB_eg_FIFO_pFULL_THRESH_assert_i , -- i/p add correct register
682  XTOB_eg_FIFO_pFULL_THRESH_negate => XTOB_eg_FIFO_pFULL_THRESH_negate_i , -- i/p
683 
684  XTOB_tau_FIFO_rd_data_count => XTOB_tau_FIFO_data_count_i, -- o/p
685  XTOB_tau_FIFO_pFULL_THRESH_assert => XTOB_tau_FIFO_pFULL_THRESH_assert_i, -- i/p
686  XTOB_tau_FIFO_pFULL_THRESH_negate => XTOB_tau_FIFO_pFULL_THRESH_negate_i, -- i/p
687  -- sorted TOBs
688  T_TOB_FIFO_data_count => TOB_FIFO_data_count_i, -- o/p
689  T_TOBs_FIFO_pFULL_THRESH_assert => TOB_FIFO_pFULL_THRESH_assert_i, -- i/p
690  T_TOBs_FIFO_pFULL_THRESH_negate => TOB_FIFO_pFULL_THRESH_negate_i, -- i/p
691  tob_busy_thresh_assert => tob_busy_thresh_assert_i, -- i/p
692  tob_busy_thresh_negate => tob_busy_thresh_negate_i, -- i/p
693 
694  Link_output_FIFO_pFULL_THRESH_assert => TOB_Link_outpout_FIFO_pFULL_THRESH_assert_i , -- i/p
695  Link_output_FIFO_pFULL_THRESH_negate => TOB_Link_outpout_FIFO_pFULL_THRESH_negate_i , -- i/p
696  Link_output_FIFO_rd_data_count => TOB_Link_outpout_FIFO_rd_data_count_i, -- o/p
697 
698  BCN_FIFO_pFULL_THRESH_assert => BCN_FIFO_TOB_pFULL_THRESH_assert_i , -- i/p
699  BCN_FIFO_pFULL_THRESH_negate => BCN_FIFO_TOB_pFULL_THRESH_negate_i , -- i/p
700  BCN_FIFO_TOB_rd_data_count => BCN_FIFO_TOB_rd_data_count_i , -- o/p
701 
702  SPY_TOB_mem_wr_addr => SPY_TOB_mem_wr_addr_i , -- TOB/XTOB data SPY memory wr addr pointer
703  ipbus_out_tob_dpram => ipbus_out_tob_dpram_i , -- o/p signal going to TOB SPY DPRAM
704  ipbus_in_tob_dpram => ipbus_in_tob_dpram_i, -- i/p signal coming from TOB SPY DPRAM
705  busy_tob => busy_tob_i, -- TOB busy out to control FPGA
706  sync_280m_out => sync_280m_i, -- this is 1 in 7 sync'ed to 40M clk
707  tob_double_word_en => tob_double_word_en_i, -- TOB double word enable to increments double word counter
708  tob_fsm_monitor => tob_fsm_monitor_i
709  );
710 
711  raw_rd_all_i <= TEST_CONTROL_REG_i(0) ; -- software/priviledge readout all raw data
712 
713 -- TideMark Counters for BCN FIFO inside RAW Readout
714 U1_RAW_bcn_tidemark : entity TOB_rdout_lib.tide_mark_block
715  generic map (
716  width => 16
717  )
718  port map (
719  rst_in => RST_i OR busy_counter_rst_i , -- if a valid data, then increment
720  CLK_in => clk_280M_in,
721  value_bus => "0000000" & BCN_FIFO_RAW_rd_data_count_i ,
722  tide_mark_out => RAW_BCN_FIFO_tidemark_i
723  );
724 
725 -- TideMark Counters for RAW Data FIFO inside RAW Readout
726 U1_RAW_data_tidemark : entity TOB_rdout_lib.tide_mark_block
727  generic map (
728  width => 16
729  )
730  port map (
731  rst_in => RST_i OR busy_counter_rst_i , -- if a valid data, then increment
732  CLK_in => clk_280M_in,
733  value_bus => "0000000" & RAW_FIFO_data_count_i ,
734  tide_mark_out => RAW_data_FIFO_tidemark_i
735  );
736 
737 -- TideMark Counters for RAW LO FIFO inside RAW Readout
738 U1_RAW_LO_fifo_tidemark : entity TOB_rdout_lib.tide_mark_block
739  generic map (
740  width => 16
741  )
742  port map (
743  rst_in => RST_i OR busy_counter_rst_i , -- if a valid data, then increment
744  CLK_in => clk_280M_in,
745  value_bus => "000" & Link_output_FIFO_RAW_rd_data_count_i ,
746  tide_mark_out => RAW_LO_FIFO_tidemark_i
747  );
748 
749 -- RAW_data_Readout Module is responsible for reading the RAW calorimeter data from outputs synchronisation block.
750 U1_RAW_readout : entity TOB_rdout_lib.RAW_data_rdout
751  generic map(FPGA_NUMBER => FPGA_NUMBER)
752  Port map (
753  RST => RST_i,
754  hw_addr => hw_addr , -- i/p
755  RST_spy_mem_wr_addr => SPY_RAM_wr_addr_rst_i , -- i/p SPY memory read address reset to ZERO
756  RAW_FIFO_sw_rst => RAW_FIFO_sw_rst_i , -- i/p this is RAW Readout FIFO reset Pulse under s/w control
757  RAW_data_in => RAW_data_in , -- i/p array 49 x 227b input frames (7 x 32b)
758  clk_40M_rdout => clk_40M_in, -- 40MHz clock for RAW data capture only
761  ipb_clk => ipb_clk , -- i/p
762  RAW_ready_in => RAW_ready_in_i , -- i/p
764  L1A_in => L1A_in_int , -- input from TTC_L1A or SW_L1A
765  BCN_ID_in => local_BCN_i ,
766  L1A_ID_in => L1A_ID_int , -- i/p 8b Ext L1A ID from TTC input + 24b L1A ID of counter
767 -- link_error_flags_in => link_error_flags_i , -- array 49 x 4 bit error per link
768  raw_rd_all_in => raw_rd_all_i , -- i/p readout all raw data links
769  pre_ld_wr_addr => pre_ld_RAW_wr_addr_i, -- The write address offset pre load for Circular DRPAM-- latency pre load for DRP wr address
770  RAW_FIFO_FULL_THRESH_ASSERT => RAW_FIFO_FULL_THRESH_ASSERT_i,
771  RAW_FIFO_FULL_THRESH_NEGATE => RAW_FIFO_FULL_THRESH_NEGATE_i,
772  RAW_FIFO_data_count => RAW_FIFO_data_count_i,
773  raw_busy_thresh_assert => raw_busy_thresh_assert_i ,
774  raw_busy_thresh_negate => raw_busy_thresh_negate_i ,
775  cntr_load_en => '0', -- was cntr_load_en_i ,
776  RAW_data_FIFO_flags => RAW_data_FIFO_flags_i , -- RAW data FIFO flags
777  RAW_out_to_MGT_is_char => RAW_out_is_char_i , -- Raw data valid to MGT
778  RAW_data_out => RAW_data_out_i , -- raw data 32b data to MGT
779  mgt_enable_in => mgt_enable_in, -- MGT enable signals - use to enable/disable readout on error
780  frame_count => RAW_frame_count_i ,
781  read_on_err_out => read_on_err_i , -- Read RAW data on error flag
782  TTC_read_all_in => TTC_read_all_1dly, -- TTC_Privilege Read signal input (previledge read)
783  RAW_FIFO_pFULL_THRESH_ASSERT => RAW_FIFO_pFULL_THRESH_ASSERT_i, -- i/p
784  RAW_FIFO_pFULL_THRESH_NEGATE => RAW_FIFO_pFULL_THRESH_NEGATE_i, -- i/p
785 
786  BCN_FIFO_pFULL_THRESH_assert => BCN_FIFO_RAW_pFULL_THRESH_assert_i , -- i/p
787  BCN_FIFO_pFULL_THRESH_negate => BCN_FIFO_RAW_pFULL_THRESH_negate_i , -- i/p
788  BCN_FIFO_RAW_rd_data_count => BCN_FIFO_RAW_rd_data_count_i , -- o/p
789 
790  Link_output_FIFO_RAW_rd_data_count => Link_output_FIFO_RAW_rd_data_count_i , -- 0/p
791  Link_output_FIFO_RAW_pfull_thresh_assert => Link_output_FIFO_RAW_pfull_thresh_assert_i ,
792  Link_output_FIFO_RAW_pfull_thresh_negate => Link_output_FIFO_RAW_pfull_thresh_negate_i ,
793 
794  SPY_mem_wr_addr => SPY_mem_wr_addr_i , -- SPY memory wr_addr (read only)
795  ipbus_out_raw_dpram => ipbus_out_raw_dpram_i , -- (o/p) signal from RAW SPY DPRAM
796  ipbus_in_raw_dpram => ipbus_in_raw_dpram_i, -- (i/p) signal to RAW SPY DPRAM
797  link_error_flags => FIFO_error_flags_54b_i, -- (o/p) error flags from the ERROR Flag FIFO
798  busy_raw => busy_raw_i, -- (o/p) RAW busy out to control FPGA
799  raw_fsm_monitor => raw_fsm_monitor_i
800 );
801 
802 -- Readout_ipb_slave Module is responsible for communication with IPBus.
803 -- it has an interface to IPBus module, an interface to RAW Data IPBus Slave and an interface to TOB Data IPBus Slave.
804 U4_rdout_ipb_slave : entity TOB_rdout_lib.readout_ipb_slave
805  Port map (
806  ipb_rst => ipb_rst , -- i/p
807  ipb_clk => ipb_clk , -- i/p
808  IPb_in => IPb_in , -- i/p
809  IPb_out => IPb_out , -- o/p
810  L1A_ID_Event => L1A_ID_Event_i , -- i/p 32b L1A ID of current event
811  L1A_ID => L1A_ID_int , -- i/p 8b Ext L1A ID from TTC input + 24b L1A ID of counter
812  BCN_in => local_BCN_i , -- i/p
813  -- TOB/XTOB
814  TOB_WR_ADDR_OFFSET => pre_ld_TOB_wr_addr_i, -- o/p
815  XTOB_EG_WR_ADDR_OFFSET => pre_ld_XTOB_eg_wr_addr_i, -- o/p
816  XTOB_TAU_WR_ADDR_OFFSET => pre_ld_XTOB_tau_wr_addr_i, -- o/p
817  TOB_SLICES_TO_RD => DPR_locations_to_rd_i, -- o/p number of slices to read
818  trigger_slice => trigger_slice_i, -- o/p Trigger slice number - on L1A
819  BCN_FIFO_TOB_rd_data_count => TOB_BCN_FIFO_tidemark_i & "0000000" & BCN_FIFO_TOB_rd_data_count_i , -- i/p
820  BCN_FIFO_TOB_pFULL_THRESH_ASSERT => BCN_FIFO_TOB_pFULL_THRESH_assert_i, -- o/p
821  BCN_FIFO_TOB_pFULL_THRESH_NEGATE => BCN_FIFO_TOB_pFULL_THRESH_negate_i, -- o/p
822  TOB_FIFO_pFULL_THRESH_ASSERT => TOB_FIFO_pFULL_THRESH_assert_i, -- o/p
823  TOB_FIFO_pFULL_THRESH_NEGATE => TOB_FIFO_pFULL_THRESH_negate_i, -- o/p
824  TOB_FIFO_DATA_COUNT => XTOB_data_FIFO_tidemark_i & "0000000" & TOB_FIFO_data_count_i , -- i/p
825  tob_busy_thresh_assert => tob_busy_thresh_assert_i, -- i/p
826  tob_busy_thresh_negate => tob_busy_thresh_negate_i, -- i/p
827  XTOB_EG_FIFO_pFULL_THRESH_ASSERT => XTOB_eg_FIFO_pFULL_THRESH_assert_i, -- o/p
828  XTOB_EG_FIFO_pFULL_THRESH_NEGATE => XTOB_eg_FIFO_pFULL_THRESH_negate_i, -- o/p
829  XTOB_EG_FIFO_DATA_COUNT => XTOB_data_FIFO_tidemark_i & "0000000" & XTOB_eg_FIFO_data_count_i , -- i/p
830  XTOB_TAU_FIFO_pFULL_THRESH_ASSERT => XTOB_tau_FIFO_pFULL_THRESH_assert_i, -- o/p
831  XTOB_TAU_FIFO_pFULL_THRESH_NEGATE => XTOB_tau_FIFO_pFULL_THRESH_negate_i, -- o/p
832  XTOB_TAU_FIFO_DATA_COUNT => XTOB_data_FIFO_tidemark_i & "0000000" & XTOB_tau_FIFO_data_count_i , -- i/p
833  TOB_Link_output_FIFO_pFULL_THRESH_ASSERT => TOB_Link_outpout_FIFO_pFULL_THRESH_assert_i,-- o/p
834  TOB_Link_output_FIFO_pFULL_THRESH_NEGATE => TOB_Link_outpout_FIFO_pFULL_THRESH_negate_i,-- o/p
835  TOB_LINK_OUTPUT_FIFO_RD_DATA_COUNT => TOB_LO_FIFO_tidemark_i & "000" & TOB_Link_outpout_FIFO_rd_data_count_i , -- i/p
836  TOB_data_FIFO_flags => TOB_data_FIFO_flags_i , -- i/p 12 bits
837  tob_fsm_monitor => tob_fsm_monitor_i,
838 
839  -- RAW calorimeter data => ,
840  RAW_WR_ADDR_OFFSET => pre_ld_RAW_wr_addr_i, -- o/p
841  RAW_FIFO_pFULL_THRESH_ASSERT => RAW_FIFO_pFULL_THRESH_ASSERT_i, -- o/p
842  RAW_FIFO_pFULL_THRESH_NEGATE => RAW_FIFO_pFULL_THRESH_NEGATE_i, -- o/p
843 
844  BCN_FIFO_RAW_pFULL_THRESH_assert => BCN_FIFO_RAW_pFULL_THRESH_assert_i , -- o/p
845  BCN_FIFO_RAW_pFULL_THRESH_negate => BCN_FIFO_RAW_pFULL_THRESH_negate_i , -- o/p
846  BCN_FIFO_RAW_rd_data_count => RAW_BCN_FIFO_tidemark_i & "0000000" & BCN_FIFO_RAW_rd_data_count_i , -- i/p
847  Link_output_FIFO_RAW_pfull_thresh_assert => Link_output_FIFO_RAW_pfull_thresh_assert_i , -- o/p
848  Link_output_FIFO_RAW_pfull_thresh_negate => Link_output_FIFO_RAW_pfull_thresh_negate_i , -- o/p
849  Link_output_FIFO_RAW_rd_data_count => RAW_LO_FIFO_tidemark_i & "000" & Link_output_FIFO_RAW_rd_data_count_i , -- i/p
850  RAW_FIFO_FULL_THRESH_ASSERT => RAW_FIFO_FULL_THRESH_ASSERT_i, -- o/p
851  RAW_FIFO_FULL_THRESH_NEGATE => RAW_FIFO_FULL_THRESH_NEGATE_i, -- o/p
852  RAW_FIFO_data_count => RAW_data_FIFO_tidemark_i & "0000000" & RAW_FIFO_data_count_i , -- i/p
853  raw_busy_thresh_assert => raw_busy_thresh_assert_i ,
854  raw_busy_thresh_negate => raw_busy_thresh_negate_i ,
855  RAW_frame_count => RAW_frame_count_i ,
856  RAW_data_FIFO_flags => RAW_data_FIFO_flags_i , -- (i/p) 32 bits
857  raw_fsm_monitor => raw_fsm_monitor_i,
858  SPY_TOB_mem_wr_addr => SPY_TOB_mem_wr_addr_i , -- (i/p) TOB/XTOB data SPY memory wr addr pointer
859  ipbus_out_tob_dpram => ipbus_in_tob_dpram_i , -- (o/p) signal to TOB SPY DPRAM
860  ipbus_in_tob_dpram => ipbus_out_tob_dpram_i , -- (i/p) signal from TOB SPY DPRAM
861  RDOUT_PULSE_REG => RDOUT_PULSE_REG_i , -- (o/p) pulsed register
862  SPY_RAW_mem_wr_addr => SPY_mem_wr_addr_i , -- (o/p) RAW calo data SPY memory wr addr pointer
863  ipbus_out_raw_dpram => ipbus_in_raw_dpram_i , -- (o/p) signal to RAW SPY DPRAM
864  ipbus_in_raw_dpram => ipbus_out_raw_dpram_i , -- (i/p) signal from RAW SPY DPRAM
865  TEST_CONTROL_REG => TEST_CONTROL_REG_i, -- (o/p) control register for testing purposes
866  link_error_flags => FIFO_error_flags_54b_i, -- (i/p) error flags from the ERROR Flag FIFO
867  busy_raw_counter => busy_raw_counter_i, -- (i/p) Number of RAW Readout BUSY assertions
868  busy_tob_counter => busy_tob_counter_i, -- (i/p) Number of TOB Readout BUSY assertions
869  busy_raw_duration_counter => busy_raw_duration_counter_i, -- (i/p) Number of 40M clocks RAW Readout BUSY is asserted
870  busy_tob_duration_counter => busy_tob_duration_counter_i, -- (i/p) Number of 40M clocks TOB Readout BUSY is asserted
871  ECR_debug_counter => ECR_debug_counter_i, -- ECR_debug_counter
872  L1A_debug_counter => L1A_debug_counter_i, -- L1A_debug_counter
873  real_time_40m_counter => real_time_40m_counter_i, -- Number of 40M clocks
874  tob_double_word_counter => tob_double_word_counter_i, -- Number of identical TOB double words
875 
876  -- Parity error output
877  ttc_err_history_debug => ttc_err_history_debug,
878  l1a_id_good_debug => l1a_id_good_debug,
879  l1a_id_err_debug => l1a_id_err_debug,
880  l1a_id_expected_debug => l1a_id_expected_debug,
881  bcn_err_expected_debug => bcn_err_expected_debug,
882  l1id_parity_err_cntr_debug => l1id_parity_err_cntr_debug,
883  l1id_mismatch_cntr_debug => l1id_mismatch_cntr_debug,
884  bcn_parity_err_cntr_debug => bcn_parity_err_cntr_debug,
885  bcn_mismatch_cntr_debug => bcn_mismatch_cntr_debug
886  );
887 
888 -- U5_bcn_counter process is responsible for generating BCN = Bunch Crossing Number.
889 -- The orbit is 3564 long, from 0 to 3563.
890 -- Cunch Crossing counter is set to 1 upon receiving TTC BCR
891 U5_bcn_counter : process(clk_40M_in)
892  variable bcn_count : unsigned (11 downto 0) := (others => '0');
893  begin
894 
895  if rising_edge (clk_40M_in) then
896  -- register TTC input signals to keep them in synch
897  BCR_1dly <= BCR_in; -- delay by another clk to match the delay on L1A_i
898  ECR_1dly <= ECR_in; -- delay by 1 clk to match L1A delay
899  TTC_read_all_1dly <= TTC_read_all_in; -- delay by 1 clk to match L1A delay
900 
901  if BCR_in = '1' then
902  bcn_count := ("000000000000");
903  else
904  if bcn_count = 3563 then
905  bcn_count := (others => '0');
906  else
907  bcn_count := bcn_count + 1;
908  end if;
909  end if;
910  local_BCN_i <= std_logic_vector(bcn_count);
911  end if;
912  end process;
913 
914 -- RAW_FIFO_sw_rst process generates a Software Reset to 49 RAW FIFO blocks which store the input calorimeter data.
915 -- RAW FIFO Software Reset is selected when bit 2 of resister rdout_pulse_reg is set 1o 1
916 -- The rdout_pulse_reg register is pulsed, and after 1 clock cycle the contents are reset to all Zeros.
917 U9_RAW_FIFO_sw_rst : process (clk_40M_rdout)
918  begin
919  if clk_40M_rdout'event and clk_40M_rdout = '1' then
920  reg7 <= RDOUT_PULSE_REG_i(2) ; -- this is RAW Data FIFO Software Reset
921  reg8 <= reg7 ;
922  RAW_FIFO_sw_rst_i <= reg7 AND (NOT reg8) ;
923  end if;
924  end process;
925 
926 -- TOB_FIFO_sw_rst process generates a Software Reset to 3 FIFO blocks which store TOB and XTOB data.
927 -- TOB FIFO Software Reset is selected when bit 3 of resister rdout_pulse_reg is set 1o 1
928 -- The rdout_pulse_reg register is pulsed, and after 1 clock cycle the contents are reset to all Zeros.
929 U10_TOB_FIFO_sw_rst : process (clk_40M_rdout)
930  begin
931  if clk_40M_rdout'event and clk_40M_rdout = '1' then
932  reg9 <= RDOUT_PULSE_REG_i(3) ; -- this is TOB/XTOB Data FIFO Software Reset
933  reg10 <= reg9 ;
934  TOB_FIFO_sw_rst_i <= reg9 AND (NOT reg10) ;
935  end if;
936  end process;
937 
938 -- SPY_RAM_wr_addr_rst process generates a Software Reset to reset the write address of Spy Memoreis to ZERO.
939 -- This reset is applied to both RAW and TOB/XTOB Spy Memories.
940 -- SPY_RAM_wr_addr_rst is selected when bit 5 of resister rdout_pulse_reg is set 1o 1
941 -- The rdout_pulse_reg register is pulsed, and after 1 clock cycle the contents are reset to all Zeros.
942 U12_SPY_RAM_wr_addr_rst : process (clk_40M_rdout)
943  begin
944  if clk_40M_rdout'event and clk_40M_rdout = '1' then
945  reg11 <= RDOUT_PULSE_REG_i(5) ; -- this is SPY Memory Write Address Software Reset
946  reg12 <= reg11 ;
947  SPY_RAM_wr_addr_rst_i <= reg11 AND (NOT reg12) ;
948  end if;
949  end process;
950 
951 -- Reset signal to clear BUSY counters for RAW and TOB data readout
952 U13_busy_counter_rst : process (clk_40M_rdout)
953  begin
954  if clk_40M_rdout'event and clk_40M_rdout = '1' then
955  reg13 <= RDOUT_PULSE_REG_i(6) ; -- this is SPY Memory Write Address Software Reset
956  reg14 <= reg13 ;
957  busy_counter_rst_i <= reg13 AND (NOT reg14) ;
958  end if;
959  end process;
960 
961 U14_rst_ECR_dbg_cntr : process (clk_40M_rdout)
962  begin
963  if clk_40M_rdout'event and clk_40M_rdout = '1' then
964  reg15 <= RDOUT_PULSE_REG_i(7) ; -- Reset ECR Debug Counter
965  reg16 <= reg15 ;
966  rst_ECR_dbg_cntr_i <= reg15 AND (NOT reg16) ;
967  end if;
968  end process;
969 
970 -- Reset signal to clear BUSY counters for RAW and TOB data readout
971 U15_rst_L1A_dbg_cntr : process (clk_40M_rdout)
972  begin
973  if clk_40M_rdout'event and clk_40M_rdout = '1' then
974  reg17 <= RDOUT_PULSE_REG_i(8) ; -- Reset L1A Debug Counter
975  reg18 <= reg17 ;
976  rst_L1A_dbg_cntr_i <= reg17 AND (NOT reg18) ;
977  end if;
978  end process;
979 
980 -- Reset signal to clear BUSY counters for RAW and TOB data readout
981 U16_latch_busy_cntr : process (clk_40M_rdout)
982  begin
983  if clk_40M_rdout'event and clk_40M_rdout = '1' then
984  reg19 <= RDOUT_PULSE_REG_i(9) ; -- Reset L1A Debug Counter
985  reg20 <= reg19 ;
986  busy_cntr_latch_i <= reg19 AND (NOT reg20) ;
987  end if;
988  end process;
989 
990 U17_bcn_l1a_valid_checker : entity infrastructure_lib.bcn_l1a_valid_checker
991  Port map(
992  clk_40_i => clk_40M_in,
993  rst_i => rst_L1A_dbg_cntr_i,
994  l1a_id_ext_i => L1A_ID_int,
995  l1a_in_i => L1A_in_int,
996  ecr_in_i => ECR_1dly,
997  bcn_id_lcl_i => local_BCN_i,
998  ttc_parity_i => TTC_parity_int,
999 
1000  err_history_o => ttc_err_history_debug,
1001  l1a_id_good_o => l1a_id_good_debug,
1002  l1a_id_err_o => l1a_id_err_debug,
1003  l1a_id_expected_o => l1a_id_expected_debug,
1004  bcn_err_expected_o => bcn_err_expected_debug,
1005  l1id_parity_err_cntr_o => l1id_parity_err_cntr_debug,
1006  l1id_mismatch_cntr_o => l1id_mismatch_cntr_debug,
1007  bcn_parity_err_cntr_o => bcn_parity_err_cntr_debug,
1008  bcn_mismatch_cntr_o => bcn_mismatch_cntr_debug
1009  );
1010 end Behavioral;
External data-types and functions.
( OUTPUT_TOBS- 1 downto 0) AlgoXTriggerObject AlgoXOutput
Algorithm XOUTPUT port.
RAW Calorimeter Data Readout Logic for process FPGA.
in RAW_TXOUTCLK std_logic
Calorimeter TXOUTCLK to read Calorimeter data to MGT for transmission to control FPGA.
out RAW_data_out std_logic_vector( 31 downto 0)
calorimeter 32b data output to MGT & Control FPGA
in RAW_FIFO_FULL_THRESH_ASSERT std_logic_vector( 8 downto 0)
RAW FIFO full flag assert threshold.
out read_on_err_out STD_LOGIC
Read RAW data on error flag.
in raw_busy_thresh_negate STD_LOGIC_VECTOR( 8 downto 0)
raw BUSY flag threshold de-assert
out raw_fsm_monitor std_logic_vector( 31 downto 0)
Monitor RAW Readout state machines.
out ipbus_out_raw_dpram ipb_rbus
IPBus signal coming from RAW SPY DPRAM.
in TTC_read_all_in std_logic
Privilege Read signal input.
in RST_spy_mem_wr_addr std_logic
RST_spy_mem_wr_addr, counter reset Pulse by software command.
out RAW_data_FIFO_flags std_logic_vector( 31 downto 0)
RAW data block FIFO flags.
out SPY_mem_wr_addr std_logic_vector( 10 downto 0)
RAW Data SPY Memory write address register (read only)
out frame_count std_logic_vector( 31 downto 0)
numer of frames in the link output FIFO to be transmitted to MGT & Control FPGA
in clk_280M_in std_logic
280Mhz input signal
in RAW_FIFO_sw_rst std_logic
RAW Readout FIFO reset Pulse by software command.
in mgt_enable_in STD_LOGIC_VECTOR( 48 downto 0)
MGT enable signals - use to enable/disable readout on error.
in hw_addr std_logic_vector( 1 downto 0)
FPGA Hardware Address.
in pre_ld_wr_addr std_logic_vector( 9 downto 0)
latency pre-load for DPRAM write address
in cntr_load_en std_logic
latency pre-load enable signal for DRPAM write address
in raw_rd_all_in std_logic
readout all raw data links, when set all RAW data from 49 fibres are readout
in clk_40M_rdout std_logic
40Mhz input signal used only for RAW data readout
in L1A_ID_in std_logic_vector( 31 downto 0)
8b Extended L1A ID & 24b LIA_ID of the L1A Counter
in ipbus_in_raw_dpram ipb_wbus
IPBus signal going to RAW SPY DPRAM.
in RAW_FIFO_pFULL_THRESH_NEGATE std_logic_vector( 8 downto 0)
36b derandomisation FIFO partial full flag negate threshold
in Link_output_FIFO_RAW_pfull_thresh_negate std_logic_vector( 12 downto 0)
Link output FIFO (before MGT) partial full flag negate threshold.
in RAW_FIFO_FULL_THRESH_NEGATE std_logic_vector( 8 downto 0)
RAW FIFO full flag negate threshold.
out BCN_FIFO_RAW_rd_data_count STD_LOGIC_VECTOR( 8 downto 0)
BCN & L1A FIFO occupancy for RAW Readout.
in ipb_clk std_logic
ipb_clk signal is input from master to slaves
in RAW_FIFO_pFULL_THRESH_ASSERT std_logic_vector( 8 downto 0)
Derandomisation FIFO partial full flag assert threshold.
in BCN_FIFO_pFULL_THRESH_negate std_logic_vector( 8 downto 0)
BCN FIFO partial full flag negate threshold.
in BCN_ID_in std_logic_vector( 11 downto 0)
Bunch Crossing ID 12 bits.
FPGA_NUMBER integer := 1
Integer used to distinguish different FPGAs having a slightly different firmware.
in Link_output_FIFO_RAW_pfull_thresh_assert std_logic_vector( 12 downto 0)
Link output FIFO (before MGT) partial full flag assert threshold.
in clk_load_in std_logic
40Mhz input signal at 20% duty cycle
out busy_raw std_logic
raw data busy out to control FPGA
in RAW_ready_in std_logic
Ready signal from control FPGA to receive RAW calorimeter data.
out Link_output_FIFO_RAW_rd_data_count std_logic_vector( 12 downto 0)
Link output FIFO (before MGT) occupancy data count.
out link_error_flags std_logic_vector( 53 downto 0)
54-b error flags from the Error Flag FIFO to IPBUS register
in L1A_in std_logic
L1A input signal.
in BCN_FIFO_pFULL_THRESH_assert std_logic_vector( 8 downto 0)
BCN FIFO partial full flag assert threshold.
in RAW_data_in RAW_data_227_type
Calorimeter data array 49 x 227b input frames.
out RAW_out_to_MGT_is_char std_logic
calorimeter data is CHAR signal to MGT & Control FPGA
out RAW_FIFO_data_count std_logic_vector( 8 downto 0)
RAW FIFO occupancy data count.
in raw_busy_thresh_assert STD_LOGIC_VECTOR( 8 downto 0)
raw BUSY flag threshold assert
Top Level of Readout Logic for process FPGA.
Top Level of Readout Logic for process FPGA.
out RAW_data_out STD_LOGIC_VECTOR( 31 downto 0)
calorimeter data 32b out to MGT
in RST std_logic
Reset from 40MHz MMCM lock signal.
in TOB_TXOUTCLK STD_LOGIC
TOB TXOUTCLK to read XTOB/TOB data to MGT for transmission to control FPGA.
in ipb_rst std_logic
ipb_rst signal is input from master to slaves
in XTOB_tau_in AlgoXOutput
XTOBs tau 64b.
in TOB_ready_in std_logic
Ready signal from control FPGA to receive TOBs data.
in BCR_in STD_LOGIC
BCR signal input.
in XTOB_tau_Valid_flg_in STD_LOGIC_VECTOR( 7 downto 0)
8b XTOB tau has valid d
in mgt_enable_in STD_LOGIC_VECTOR( 48 downto 0)
out busy_tob std_logic
tob data busy out
in XTOB_eg_Valid_flg_in STD_LOGIC_VECTOR( 7 downto 0)
8b XTOB e/g has valid d
out IPb_out ipb_rbus
IPb_out signal going from slaves to master.
in XTOB_tau_sync_in STD_LOGIC
XTOB tau sync sig.
in TTC_L1A_ID_EXT_in STD_LOGIC_VECTOR( 7 downto 0)
Extended L1A ID provided by TTC - ECRID.
out TOB_out STD_LOGIC_VECTOR( 31 downto 0)
32b sorted XTOB/TOB out to MGT
in clk_load_in STD_LOGIC
40Mhz input signal at 20% duty cycle
in T_TOB_32b_in STD_LOGIC_VECTOR( 31 downto 0)
Sorted TOB data readout 32b * 7 in series, only 6 is used - F1 reads e/g TOBs and F2 reads tau TOBs.
in TTC_parity_in STD_LOGIC
Odd parity over ECR ID and L1A ID provided by TTC.
in T_TOB_sync_in STD_LOGIC
sorted TOB start signal
in L1A_in STD_LOGIC
L1A signal input.
in OUT_TOB_BCN std_logic_vector( 6 downto 0)
sorted TOB BC_ID with delay through ALGO/sorting block
in shelf_number STD_LOGIC_VECTOR( 3 downto 0)
shelf number input
out local_BCN_out STD_LOGIC_VECTOR( 11 downto 0)
Local BCN generated in Process FPGA.
in IPb_in ipb_wbus
IPb_in signal going from master to slaves.
in efex_slot_num STD_LOGIC_VECTOR( 3 downto 0)
eFEX slot number input
in ipb_clk std_logic
ipb_clk signal is input from master to slaves
in XTOB_eg_in AlgoXOutput
XTOBs e/g 64b * 8.
in TTC_L1A_ID_in STD_LOGIC_VECTOR( 23 downto 0)
L1A ID provided by TTC.
in clk_200M_in STD_LOGIC
200Mhz input signal
in OUT_XTOB_BCN std_logic_vector( 6 downto 0)
XTOB BC_ID with delay through ALGO/sorting block.
FPGA_NUMBER integer := 1
Integer used to distinguish different FPGAs having a slightly different firmware.
in TTC_read_all_in STD_LOGIC
Privilege Read signal input (previledge read)
out busy_raw std_logic
raw data busy out
in ECR_in STD_LOGIC
ECR signal input.
in RAW_ready_in std_logic
Ready signal from control FPGA to receive RAW calorimeter data.
in clk_40M_in STD_LOGIC
40Mhz input signal
in RAW_TXOUTCLK STD_LOGIC
Calorimeter TXOUTCLK to read Calorimeter data to MGT for transmission to control FPGA.
in hw_addr STD_LOGIC_VECTOR( 1 downto 0)
FPGA Hardware Address.
out TOB_out_is_char STD_LOGIC
32b data out to MGT is CHAR
in T_TOB_valid_in STD_LOGIC
sorted TOB valid signal
in RAW_data_in RAW_data_227_type
calorimeter data array 49 x 224b input frames
out RAW_out_is_char STD_LOGIC
calorimeter data 32b out to MGT is CHAR
in XTOB_eg_sync_in STD_LOGIC
XTOB e/g sync sig.
in clk_280M_in STD_LOGIC
280Mhz input signal
in clk_40M_rdout STD_LOGIC
40Mhz input signal used only for RAW data readout
Merged Sorted TOB and Local XTOB Readout Logic for process FPGA.
Definition: TOBs_rdout.vhd:149
out T_TOB_FIFO_data_count STD_LOGIC_VECTOR( 8 downto 0)
sorted TOBs FIFO occupancy data count
Definition: TOBs_rdout.vhd:242
in Link_output_FIFO_pFULL_THRESH_negate STD_LOGIC_VECTOR( 12 downto 0)
Link output FIFO (before MGT) partial full flag negate threshold.
Definition: TOBs_rdout.vhd:260
in TOB_type_in STD_LOGIC
TOB Type 0 = e/g for pFPGA U1, TOB Type U1 = tau for pFPGA 2, also Zero for U3 & U4.
Definition: TOBs_rdout.vhd:186
out tob_double_word_en STD_LOGIC
TOB double word enable to increments double word counter,.
Definition: TOBs_rdout.vhd:276
in T_TOBs_FIFO_pFULL_THRESH_assert STD_LOGIC_VECTOR( 8 downto 0)
sorted TOBs FIFO prog FULL threshold assert
Definition: TOBs_rdout.vhd:244
out Link_output_FIFO_rd_data_count STD_LOGIC_VECTOR( 12 downto 0)
Link output FIFO (before MGT) occupancy read data count.
Definition: TOBs_rdout.vhd:262
out SPY_TOB_mem_wr_addr STD_LOGIC_VECTOR( 10 downto 0)
TOB/XTOB Readout SPY Memory register (read only)
Definition: TOBs_rdout.vhd:264
in trigger_slice_in STD_LOGIC_VECTOR( 3 downto 0)
Trigger slice number - on L1A.
Definition: TOBs_rdout.vhd:226
in tob_busy_thresh_assert STD_LOGIC_VECTOR( 8 downto 0)
sorted TOB BUSY flag threshold assert
Definition: TOBs_rdout.vhd:248
in pre_ld_TOB_wr_addr STD_LOGIC_VECTOR( 8 downto 0)
latency pre load for TOB DRP wr address
Definition: TOBs_rdout.vhd:216
in TOB_TXOUTCLK STD_LOGIC
280Mhz clk to read data into MGT
Definition: TOBs_rdout.vhd:196
in DPR_locations_to_rd STD_LOGIC_VECTOR( 2 downto 0)
number of slices (DRP locations) to read 1 or 2 or 3
Definition: TOBs_rdout.vhd:224
in RST_spy_mem_wr_addr std_logic
spy memory write address counter reset Pulse by software command
Definition: TOBs_rdout.vhd:160
in TOBs_32b_in STD_LOGIC_VECTOR( 31 downto 0)
Sorted TOB data 32b * 7 in series, F1 reads e/g TOBs and F2 reads tau TOBs. Same firmware in both FPG...
Definition: TOBs_rdout.vhd:178
in tob_busy_thresh_negate STD_LOGIC_VECTOR( 8 downto 0)
sorted TOB BUSY flag threshold de-assert
Definition: TOBs_rdout.vhd:250
in TOBs_valid_flg_in STD_LOGIC
sorted TOB write signal
Definition: TOBs_rdout.vhd:182
in XTOB_eg_FIFO_pFULL_THRESH_assert STD_LOGIC_VECTOR( 8 downto 0)
e/g XTOB FIFO prog FULL threshold assert
Definition: TOBs_rdout.vhd:232
in cntr_load_en STD_LOGIC
latency pre-load enable for DRPAM write address
Definition: TOBs_rdout.vhd:222
in XTOB_eg_FIFO_pFULL_THRESH_negate STD_LOGIC_VECTOR( 8 downto 0)
e/g XTOB FIFO prog FULL threshold de-assert
Definition: TOBs_rdout.vhd:234
in ipbus_in_tob_dpram ipb_wbus
IPBus signal going to RAW SPY DPRAM.
Definition: TOBs_rdout.vhd:270
in TOB_ready_in std_logic
Ready signal from control FPGA to receive TOBs data.
Definition: TOBs_rdout.vhd:208
out tob_fsm_monitor std_logic_vector( 39 downto 0)
Monitor TOB Readout state machines.
Definition: TOBs_rdout.vhd:279
in XTOB_tau_Valid_flg_in STD_LOGIC_VECTOR( 7 downto 0)
8b XTOB tau has valid data
Definition: TOBs_rdout.vhd:172
out busy_tob std_logic
tob data busy out to control FPGA
Definition: TOBs_rdout.vhd:272
in XTOB_eg_512b_in AlgoXOutput
array 8 x 64b words XTOB e/g
Definition: TOBs_rdout.vhd:164
in XTOB_eg_Valid_flg_in STD_LOGIC_VECTOR( 7 downto 0)
8b XTOB e/g has valid data
Definition: TOBs_rdout.vhd:166
in XTOB_tau_sync_in STD_LOGIC
XTOB tau sync signal.
Definition: TOBs_rdout.vhd:174
out TOB_out_to_MGT STD_LOGIC_VECTOR( 31 downto 0)
Event TOBs 32b out to MGT.
Definition: TOBs_rdout.vhd:212
in L1A_in STD_LOGIC
L1A signal input.
Definition: TOBs_rdout.vhd:202
in XTOB_tau_FIFO_pFULL_THRESH_assert STD_LOGIC_VECTOR( 8 downto 0)
tau XTOB FIFO prog FULL threshold assert
Definition: TOBs_rdout.vhd:238
in OUT_TOB_BCN std_logic_vector( 6 downto 0)
sorted TOB BCN with delay through ALGO/sorting block
Definition: TOBs_rdout.vhd:184
out sync_280m_out STD_LOGIC
280MHz synch signal output
Definition: TOBs_rdout.vhd:274
in shelf_number STD_LOGIC_VECTOR( 3 downto 0)
shelf number input
Definition: TOBs_rdout.vhd:198
out ipbus_out_tob_dpram ipb_rbus
IPBus signal coming from RAW SPY DPRAM to IPBus.
Definition: TOBs_rdout.vhd:268
out TOB_data_FIFO_flags STD_LOGIC_VECTOR( 31 downto 0)
TOB data block FIFO flags.
Definition: TOBs_rdout.vhd:228
out TOB_out_to_MGT_is_char STD_LOGIC
data is char to MGT
Definition: TOBs_rdout.vhd:210
in efex_slot_num STD_LOGIC_VECTOR( 3 downto 0)
eFEX slot number input
Definition: TOBs_rdout.vhd:200
in ipb_clk std_logic
ipb_clk signal is input from master to slaves
Definition: TOBs_rdout.vhd:266
in BCN_FIFO_pFULL_THRESH_negate std_logic_vector( 8 downto 0)
BCN FIFO partial full flag negate threshold.
Definition: TOBs_rdout.vhd:254
out XTOB_eg_FIFO_rd_data_count STD_LOGIC_VECTOR( 8 downto 0)
occupancy counter of e/g XTOB FIFO - read clock
Definition: TOBs_rdout.vhd:230
in T_TOBs_FIFO_pFULL_THRESH_negate STD_LOGIC_VECTOR( 8 downto 0)
sorted TOBs FIFO prog FULL threshold de-assert
Definition: TOBs_rdout.vhd:246
in clk_200M_in STD_LOGIC
200Mhz input signal
Definition: TOBs_rdout.vhd:192
in XTOB_tau_FIFO_pFULL_THRESH_negate STD_LOGIC_VECTOR( 8 downto 0)
tau XTOB FIFO prog FULL threshold de-assert
Definition: TOBs_rdout.vhd:240
in BCN_ID_in STD_LOGIC_VECTOR( 11 downto 0)
BC Counter.
Definition: TOBs_rdout.vhd:204
in OUT_XTOB_BCN std_logic_vector( 6 downto 0)
XTOB BCN with delay through ALGO/sorting block.
Definition: TOBs_rdout.vhd:176
FPGA_NUMBER integer := 1
Integer used to distinguish different FPGAs having a slightly different firmware.
Definition: TOBs_rdout.vhd:154
in L1A_ID_in STD_LOGIC_VECTOR( 31 downto 0)
8b Extended L1A ID & 24b LIA_ID of the L1A Counter
Definition: TOBs_rdout.vhd:206
out L1A_ID_Event_out STD_LOGIC_VECTOR( 31 downto 0)
8b Ext L1A ID from TTC input + 24b L1A ID of counter from TTC FIFO - inserted in the event header
Definition: TOBs_rdout.vhd:214
in clk_40M_in STD_LOGIC
40MHz clock input signal
Definition: TOBs_rdout.vhd:190
in pre_ld_tau_XTOB_wr_addr STD_LOGIC_VECTOR( 8 downto 0)
latency pre load for tau XTOB DRP wr address
Definition: TOBs_rdout.vhd:220
out BCN_FIFO_TOB_rd_data_count STD_LOGIC_VECTOR( 8 downto 0)
BCN & L1A FIFO occupancy for TOB Readout.
Definition: TOBs_rdout.vhd:256
in Link_output_FIFO_pFULL_THRESH_assert STD_LOGIC_VECTOR( 12 downto 0)
Link output FIFO (before MGT) partial full flag assert threshold.
Definition: TOBs_rdout.vhd:258
in hw_addr STD_LOGIC_VECTOR( 1 downto 0)
FPGA Hardware Address.
Definition: TOBs_rdout.vhd:158
in pre_ld_eg_XTOB_wr_addr STD_LOGIC_VECTOR( 8 downto 0)
latency pre load for e/g XTOB DRP wr address
Definition: TOBs_rdout.vhd:218
in BCN_FIFO_pFULL_THRESH_assert std_logic_vector( 8 downto 0)
BCN FIFO partial full flag assert threshold.
Definition: TOBs_rdout.vhd:252
in TOB_FIFO_sw_rst std_logic
TOB Readout FIFO reset Pulse by software command.
Definition: TOBs_rdout.vhd:162
in XTOB_eg_sync_in STD_LOGIC
XTOB e/g sync signal.
Definition: TOBs_rdout.vhd:168
in read_on_err_in STD_LOGIC
Read RAW data on error flag.
Definition: TOBs_rdout.vhd:188
in clk_280M_in STD_LOGIC
280MHz clock input signal
Definition: TOBs_rdout.vhd:194
in XTOB_tau_512b_in AlgoXOutput
array 8 x 64b words XTOB tau
Definition: TOBs_rdout.vhd:170
out XTOB_tau_FIFO_rd_data_count STD_LOGIC_VECTOR( 8 downto 0)
tau XTOBs FIFO occupancy data count - read clock
Definition: TOBs_rdout.vhd:236
Observes BCN ID, L1A ID, and parity bits.
Generic Counter for process FPGA.
in CLK STD_LOGIC
Clock signal input.
in CE STD_LOGIC
Enable signal input.
out Q STD_LOGIC_VECTOR( width- 1 downto 0)
Counter Output signal.
in RST STD_LOGIC
Reset signal input.
IPBUS readout slave definitions of registers used in the Top Level Readout Block.
in RAW_data_FIFO_flags STD_LOGIC_VECTOR( 31 downto 0)
Full and Empty flags for all FIFOs in the RAW Readout Logic.
in ipbus_in_tob_dpram ipb_rbus
IPBus access bus signal coming from TOB SPY DPRAM.
out TOB_Link_output_FIFO_pFULL_THRESH_NEGATE STD_LOGIC_VECTOR( 12 downto 0)
Prog Full flag negate threshold for Link Output FIFO of TOBs Readout.
out RAW_FIFO_FULL_THRESH_ASSERT STD_LOGIC_VECTOR( 8 downto 0)
Full flag assert threshold for de-randomisation FIFO of RAW Data Readout.
out raw_fsm_monitor std_logic_vector( 31 downto 0)
Monitor RAW Readout state machines.
out TOB_WR_ADDR_OFFSET STD_LOGIC_VECTOR( 8 downto 0)
Write Address Offset for TOB circular DPRAM.
out trigger_slice STD_LOGIC_VECTOR( 3 downto 0)
Trigger slice number - on L1A.
in BCN_FIFO_RAW_rd_data_count STD_LOGIC_VECTOR( 31 downto 0)
BCN & L1A FIFO occupancy for RAW Readout.
in ipb_rst std_logic
IPBus Reset input.
out TOB_SLICES_TO_RD STD_LOGIC_VECTOR( 2 downto 0)
Number of cosecutive Slices to read from TOBs circular DPRAM.
in SPY_RAW_mem_wr_addr STD_LOGIC_VECTOR( 10 downto 0)
Current write address of RAW SPY Memory - used for IPBus access and to calculate occupancy.
in busy_tob_duration_counter STD_LOGIC_VECTOR( 31 downto 0)
Busy counter for TOB BUSY duration.
in tob_double_word_counter STD_LOGIC_VECTOR( 31 downto 0)
Number of identical TOB double words counter.
out TEST_CONTROL_REG STD_LOGIC_VECTOR( 31 downto 0)
Test Control Register at Top Level Readout Firmware.
in bcn_mismatch_cntr_debug std_logic_vector( 31 downto 0)
Mismatch error count on BCN.
out tob_busy_thresh_assert STD_LOGIC_VECTOR( 8 downto 0)
sorted TOB BUSY flag threshold assert
out BCN_FIFO_RAW_pFULL_THRESH_assert STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag assert threshold for TTC FIFO.
in RAW_FIFO_data_count STD_LOGIC_VECTOR( 31 downto 0)
Occupancy level ofde-randomisation FIFO of RAW Data Readout.
in TOB_data_FIFO_flags STD_LOGIC_VECTOR( 31 downto 0)
Full and Empty flags for all FIFOs in the TOBs Readout Logic.
out raw_busy_thresh_assert STD_LOGIC_VECTOR( 8 downto 0)
raw BUSY flag threshold assert
in busy_raw_counter STD_LOGIC_VECTOR( 31 downto 0)
Busy counter for RAW data buffers.
out XTOB_TAU_WR_ADDR_OFFSET STD_LOGIC_VECTOR( 8 downto 0)
Write Address Offset for XTOB tau circular DPRAM.
out BCN_FIFO_RAW_pFULL_THRESH_negate STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag negate threshold for TTC FIFO.
in l1id_parity_err_cntr_debug std_logic_vector( 31 downto 0)
Parity error count on L1A.
out tob_fsm_monitor std_logic_vector( 39 downto 0)
Monitor TOB Readout state machines.
out XTOB_TAU_FIFO_pFULL_THRESH_ASSERT STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag assert threshold for de-randomisation FIFO of XTOBs tau Readout.
out RDOUT_PULSE_REG STD_LOGIC_VECTOR( 31 downto 0)
Control Pulse Register for RAW Readout, all values are set to ZERO following a write to this register...
in XTOB_TAU_FIFO_DATA_COUNT STD_LOGIC_VECTOR( 31 downto 0)
Occupancy level of de-randomisation FIFO of XTOBs tau Readout.
out IPb_out ipb_rbus
IPBus output bus going from slaves to master.
out RAW_FIFO_pFULL_THRESH_ASSERT STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag assert threshold for de-randomisation FIFO of RAW Data Readout.
in RAW_frame_count STD_LOGIC_VECTOR( 31 downto 0)
Number of complete RAW Frames in Link Output FIFO to be transmitted to cFPGA.
in ttc_err_history_debug std_logic_vector( 31 downto 0)
History of last 8 TTC errors.
in SPY_TOB_mem_wr_addr STD_LOGIC_VECTOR( 10 downto 0)
Current write address of TOBs SPY Memory - used for IPBus access and to calculate occupancy.
out RAW_FIFO_pFULL_THRESH_NEGATE STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag negate threshold for de-randomisation FIFO of RAW Data Readout.
in L1A_ID STD_LOGIC_VECTOR( 31 downto 0)
8b Extended L1A ID + 24b L1A ID of L1A counter
out XTOB_EG_WR_ADDR_OFFSET STD_LOGIC_VECTOR( 8 downto 0)
Write Address Offset for XTOB e/g circular DPRAM.
out raw_busy_thresh_negate STD_LOGIC_VECTOR( 8 downto 0)
raw BUSY flag threshold de-assert
in l1a_id_err_debug std_logic_vector( 31 downto 0)
Shows last corrupt L1A ID.
in bcn_err_expected_debug std_logic_vector( 31 downto 0)
Error, bad BCN and expected BCN on BCN error.
in IPb_in ipb_wbus
IPBus input bus going from master to slaves.
in link_error_flags STD_LOGIC_VECTOR( 53 downto 0)
54-b error flags from the Error Flag FIFO to IPBUS register
in ipb_clk std_logic
IPBus Clock input.
in XTOB_EG_FIFO_DATA_COUNT STD_LOGIC_VECTOR( 31 downto 0)
Occupancy level of de-randomisation FIFO of XTOBs e/g Readout.
out XTOB_TAU_FIFO_pFULL_THRESH_NEGATE STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag negate threshold for de-randomisation FIFO of XTOBs tau Readout.
in l1a_id_good_debug std_logic_vector( 31 downto 0)
Shows last good L1A ID.
in TOB_FIFO_DATA_COUNT STD_LOGIC_VECTOR( 31 downto 0)
Occupancy level of de-randomisation FIFO of TOBs Readout.
out RAW_FIFO_FULL_THRESH_NEGATE STD_LOGIC_VECTOR( 8 downto 0)
Full flag negate threshold for de-randomisation FIFO of RAW Data Readout.
in busy_tob_counter STD_LOGIC_VECTOR( 31 downto 0)
Busy counter for TOB data buffers.
in real_time_40m_counter STD_LOGIC_VECTOR( 31 downto 0)
Real time 40MHz counter, counting number of 40MHz ticks.
out ipbus_out_tob_dpram ipb_wbus
IPBus access bus signal going to TOB SPY DPRAM.
in busy_raw_duration_counter STD_LOGIC_VECTOR( 31 downto 0)
Busy counter for RAW BUSY Duration.
in L1A_ID_Event STD_LOGIC_VECTOR( 31 downto 0)
8b Ext L1A ID from TTC input + 24b L1A ID of counter from TTC FIFO - inserted in the event header
in Link_output_FIFO_RAW_rd_data_count STD_LOGIC_VECTOR( 31 downto 0)
Occupancy level of Link Output FIFO of RAW Data Readout.
in BCN_FIFO_TOB_rd_data_count STD_LOGIC_VECTOR( 31 downto 0)
BCN & L1A FIFO occupancy for TOB Readout.
in bcn_parity_err_cntr_debug std_logic_vector( 31 downto 0)
Parity error count on BCN.
out Link_output_FIFO_RAW_pfull_thresh_assert STD_LOGIC_VECTOR( 12 downto 0)
Prog Full flag assert threshold for Link Output FIFO of RAW Data Readout.
out RAW_WR_ADDR_OFFSET STD_LOGIC_VECTOR( 9 downto 0)
Write Address Offset for RAW circular DPRAM.
out tob_busy_thresh_negate STD_LOGIC_VECTOR( 8 downto 0)
sorted TOB BUSY flag threshold de-assert
in l1a_id_expected_debug std_logic_vector( 31 downto 0)
Shows last expected L1A ID on error.
out TOB_FIFO_pFULL_THRESH_NEGATE STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag negate threshold for de-randomisation FIFO of TOBs Readout.
out Link_output_FIFO_RAW_pfull_thresh_negate STD_LOGIC_VECTOR( 12 downto 0)
Prog Full flag negate threshold for Link Output FIFO of RAW Data Readout.
out TOB_FIFO_pFULL_THRESH_ASSERT STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag assert threshold for de-randomisation FIFO of TOBs Readout.
out XTOB_EG_FIFO_pFULL_THRESH_ASSERT STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag assert threshold for de-randomisation FIFO of XTOBs e/g Readout.
in l1id_mismatch_cntr_debug std_logic_vector( 31 downto 0)
Mismatch error count on L1A.
out TOB_Link_output_FIFO_pFULL_THRESH_ASSERT STD_LOGIC_VECTOR( 12 downto 0)
Prog Full flag assert threshold for Link Output FIFO of TOBs Readout.
out ipbus_out_raw_dpram ipb_wbus
IPBus access bus signal going to RAW SPY DPRAM.
in TOB_LINK_OUTPUT_FIFO_RD_DATA_COUNT STD_LOGIC_VECTOR( 31 downto 0)
Occupancy level of Link Output FIFO of TOBs Readout.
in ipbus_in_raw_dpram ipb_rbus
IPBus access bus signal coming from RAW SPY DPRAM.
in BCN_in STD_LOGIC_VECTOR( 11 downto 0)
Bunch Crossing Number.
in L1A_debug_counter STD_LOGIC_VECTOR( 31 downto 0)
L1A_debug_counter.
in ECR_debug_counter STD_LOGIC_VECTOR( 31 downto 0)
ECR_debug_counter.
out XTOB_EG_FIFO_pFULL_THRESH_NEGATE STD_LOGIC_VECTOR( 8 downto 0)
Prog Full flag negate threshold for de-randomisation FIFO of XTOBs e/g Readout.
Instantiate tide mark calculation for a 16 bit data input.