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

Back to eFEX documentation
TOBs_rdout.vhd
Go to the documentation of this file.
1 
127 
128 library ieee;
129 use ieee.std_logic_1164.all;
130 use ieee.numeric_std.all;
131 
132 library ipbus_lib;
133 use ipbus_lib.ipbus.all;
134 
135 Library UNISIM;
136 use UNISIM.vcomponents.all;
137 
138 Library UNIMACRO;
139 use UNIMACRO.vcomponents.all;
140 
141 library TOB_rdout_lib;
142 use TOB_rdout_lib.TOB_rdout_ip_pkg.ALL;
143 use TOB_rdout_lib.data_type_pkg.all;
144 
145 library algolib;
146 use algolib.AlgoDataTypes.all;
147 
149 entity TOBs_rdout is
150  Generic
151  (
153  FPGA_NUMBER : integer := 1
154  ) ;
155  Port (
156  RST : in std_logic ;
158  hw_addr : in STD_LOGIC_VECTOR(1 downto 0) ;
160  RST_spy_mem_wr_addr : in std_logic ;
162  TOB_FIFO_sw_rst : in std_logic ;
164  XTOB_eg_512b_in : in AlgoXOutput; -- array 8 x 64b words XTOB e/g
166  XTOB_eg_Valid_flg_in : in STD_LOGIC_VECTOR (7 downto 0);
168  XTOB_eg_sync_in : in STD_LOGIC;
170  XTOB_tau_512b_in : in AlgoXOutput; -- array 8 x 64b words XTOB tau
172  XTOB_tau_Valid_flg_in : in STD_LOGIC_VECTOR (7 downto 0);
174  XTOB_tau_sync_in : in STD_LOGIC;
176  OUT_XTOB_BCN : in std_logic_vector(6 downto 0);
178  TOBs_32b_in : in STD_LOGIC_VECTOR (31 downto 0);
180  TOBs_sync_in : in STD_LOGIC;
182  TOBs_valid_flg_in : in STD_LOGIC;
184  OUT_TOB_BCN : in std_logic_vector(6 downto 0);
186  TOB_type_in : in STD_LOGIC;
188  read_on_err_in : in STD_LOGIC;
190  clk_40M_in : in STD_LOGIC;
192  clk_200M_in : in STD_LOGIC;
194  clk_280M_in : in STD_LOGIC;
196  TOB_TXOUTCLK : in STD_LOGIC;
198  shelf_number : in STD_LOGIC_VECTOR (3 downto 0);
200  efex_slot_num : in STD_LOGIC_VECTOR (3 downto 0);
202  L1A_in : in STD_LOGIC;
204  BCN_ID_in : in STD_LOGIC_VECTOR (11 downto 0);
206  L1A_ID_in : in STD_LOGIC_VECTOR (31 downto 0);
208  TOB_ready_in : in std_logic ;
210  TOB_out_to_MGT_is_char : out STD_LOGIC;
212  TOB_out_to_MGT : out STD_LOGIC_VECTOR (31 downto 0);
214  L1A_ID_Event_out : out STD_LOGIC_VECTOR (31 downto 0); -- L1A ID of current event
216  pre_ld_TOB_wr_addr : in STD_LOGIC_VECTOR (8 downto 0) ;
218  pre_ld_eg_XTOB_wr_addr : in STD_LOGIC_VECTOR (8 downto 0) ;
220  pre_ld_tau_XTOB_wr_addr : in STD_LOGIC_VECTOR (8 downto 0) ;
222  cntr_load_en : in STD_LOGIC;
224  DPR_locations_to_rd : in STD_LOGIC_VECTOR (2 downto 0) ;
226  trigger_slice_in : in STD_LOGIC_VECTOR(3 downto 0) ;
228  TOB_data_FIFO_flags : out STD_LOGIC_VECTOR (31 downto 0);
230  XTOB_eg_FIFO_rd_data_count : out STD_LOGIC_VECTOR (8 downto 0);
232  XTOB_eg_FIFO_pFULL_THRESH_assert : in STD_LOGIC_VECTOR (8 downto 0);
234  XTOB_eg_FIFO_pFULL_THRESH_negate : in STD_LOGIC_VECTOR (8 downto 0);
236  XTOB_tau_FIFO_rd_data_count : out STD_LOGIC_VECTOR (8 downto 0); -- occupancy of tau XTOB FIFO
238  XTOB_tau_FIFO_pFULL_THRESH_assert : in STD_LOGIC_VECTOR (8 downto 0); -- tau XTOB FIFO
240  XTOB_tau_FIFO_pFULL_THRESH_negate : in STD_LOGIC_VECTOR (8 downto 0); -- tau XTOB FIFO
242  T_TOB_FIFO_data_count : out STD_LOGIC_VECTOR (8 downto 0); -- sorted TOBs FIFO occupancy count
244  T_TOBs_FIFO_pFULL_THRESH_assert : in STD_LOGIC_VECTOR (8 downto 0); -- TOBs FIFO
246  T_TOBs_FIFO_pFULL_THRESH_negate : in STD_LOGIC_VECTOR (8 downto 0); -- TOBs FIFO
248  tob_busy_thresh_assert : in STD_LOGIC_VECTOR (8 downto 0); -- TOBs FIFO
250  tob_busy_thresh_negate : in STD_LOGIC_VECTOR (8 downto 0); -- TOBs FIFO
252  BCN_FIFO_pFULL_THRESH_assert : in std_logic_vector(8 downto 0);
254  BCN_FIFO_pFULL_THRESH_negate : in std_logic_vector(8 downto 0);
256  BCN_FIFO_TOB_rd_data_count : out STD_LOGIC_VECTOR (8 downto 0); -- occupancy of BCN & L1A FIFO for RAW Readout
258  Link_output_FIFO_pFULL_THRESH_assert : in STD_LOGIC_VECTOR (12 downto 0); -- Link_output_FIFO
260  Link_output_FIFO_pFULL_THRESH_negate : in STD_LOGIC_VECTOR (12 downto 0); -- Link_output_FIFO
262  Link_output_FIFO_rd_data_count : out STD_LOGIC_VECTOR (12 downto 0); -- occupancy of TOB output link MGT FIFO
264  SPY_TOB_mem_wr_addr : out STD_LOGIC_VECTOR (10 downto 0); -- SPY memory wr_addr (read only)
266  ipb_clk : in std_logic ;
268  ipbus_out_tob_dpram : out ipb_rbus;
270  ipbus_in_tob_dpram : in ipb_wbus;
272  busy_tob : out std_logic;
274  sync_280m_out : out STD_LOGIC;
276  tob_double_word_en : out STD_LOGIC;
278  tob_fsm_monitor : out std_logic_vector (39 downto 0)
279  );
280  end TOBs_rdout;
281 
283 architecture RTL of TOBs_rdout is
284 
285 --************************** Register Declarations ****************************
286  signal RST_i : STD_LOGIC;
287  signal TOB_FIFO_sw_rst_i : STD_LOGIC ;
288  signal clk_in_280M_i : STD_LOGIC;
289  signal rdout_T_TOB_209b_i : STD_LOGIC_VECTOR (208 downto 0); -- T_TOBs 209b = 7b TOB_BCN +4b error+6b valid +192b TOB data
290 
291  signal T_TOB_full_i : STD_LOGIC;
292  signal T_TOB_empty_i : STD_LOGIC;
293  signal T_TOB_valid_i : STD_LOGIC;
294  signal T_TOB_prog_full_i : STD_LOGIC;
295  signal T_TOB_FIFO_data_count_i : STD_LOGIC_VECTOR (8 downto 0); -- occupancy of sorted TOB FIFO
296  signal XTOB_eg_FIFO_rd_data_count_i : STD_LOGIC_VECTOR (8 downto 0); -- occupancy of sorted TOB FIFO
297  signal tob_data_mgt_fsm_i, tob_data_mux_fsm_i, tob_data_dpram_fsm_i : STD_LOGIC_VECTOR (7 downto 0);
298  signal xtob_eg_data_dpram_fsm_i, xtob_tau_data_dpram_fsm_i : STD_LOGIC_VECTOR (7 downto 0);
299 
300  signal DPR_XTOBs_eg_in_i : array_8_of_252b; -- XTOBs {array 8 of [(5*48b) + 5b valid] + XTOB_BCN}
301  signal DPR_XTOBs_eg_out_i : array_8_of_252b; -- XTOBs {array 8 of [(5*48b) + 5b valid] + XTOB_BCN}
302 
303  signal DPR_XTOBs_tau_in_i : array_8_of_252b; -- XTOBs {array 8 of [(5*48b) + 5b valid] + XTOB_BCN}
304  signal DPR_XTOBs_tau_out_i : array_8_of_252b; -- XTOBs {array 8 of [(5*48b) + 5b valid] + XTOB_BCN}
305 
306  signal TOB_ready_i : std_logic ;
307 
308  signal L1A_rd_en_i : std_logic ;
309 
310  signal pre_ld_wr_addr_TOB_i : STD_LOGIC_VECTOR (8 downto 0);
311  signal DPR_locations_to_rd_i : STD_LOGIC_VECTOR (2 downto 0);
312 
313  signal FIFO_rd_en_i : std_logic := '0' ;
314  signal rdout_XTOB_eg_i : array_8_of_252b; -- XTOBs {array 8 of [(5*48b) + 5b valid] + XTOB_BCN}
315  signal rdout_XTOB_tau_i : array_8_of_252b; -- XTOBs {array 8 of [(5*48b) + 5b valid] + XTOB_BCN}
316  signal valid_XTOBs_eg_i : STD_LOGIC;
317  signal valid_XTOBs_tau_i : STD_LOGIC;
318  signal frame_cntr_en_i : std_logic;
319  signal frame_cntr_en_ii : std_logic;
320  signal pre_ld_wr_addr_XTOB_eg_i : STD_LOGIC_VECTOR (8 downto 0);
321  signal pre_ld_wr_addr_XTOB_tau_i : STD_LOGIC_VECTOR (8 downto 0);
322 
323  signal XTOB_eg_full_i : std_logic;
324  signal XTOB_eg_empty_i : std_logic;
325  signal XTOB_eg_prog_full_i : std_logic;
326 
327  signal XTOB_tau_full_i : std_logic;
328  signal XTOB_tau_empty_i : std_logic;
329  signal XTOB_tau_prog_full_i : std_logic;
330 
331  signal TOB_empty_flag_i : std_logic;
332  signal TOB_pfull_flag_i : std_logic;
333  signal TOB_out_valid_i : STD_LOGIC;
334  signal TOB_out_is_char_i : STD_LOGIC;
335  signal TOBs_out_i : STD_LOGIC_VECTOR (31 downto 0); -- TOBs 32b out to FIFO
336  signal FIFO_TOBs_in_i : STD_LOGIC_VECTOR (32 downto 0);
337  signal Link_output_FIFO_TOBs_out_i : STD_LOGIC_VECTOR (32 downto 0);
338  signal TOB_out_to_MGT_i : STD_LOGIC_VECTOR (31 downto 0); -- TOBs 32b out to MGT
339  signal TOB_out_to_MGT_1dly : STD_LOGIC_VECTOR (31 downto 0); -- TOBs 32b out to MGT
340  signal TOB_data_out_MGT_i : STD_LOGIC_VECTOR (31 downto 0); -- TOBs 32b out to MGT
341  signal Link_output_FIFO_rd_en_i, TOB_out_to_MGT_is_char_i,TOB_out_to_MGT_is_char_1dly : STD_LOGIC;
342  signal Link_output_FIFO_TOB_valid_i : STD_LOGIC;
343  signal T_TOB_out_valid_i : STD_LOGIC;
344  signal T_TOB_out_valid_1dly : STD_LOGIC;
345  signal TOB_out_char_MGT_i : STD_LOGIC;
346 
347  signal Link_output_FIFO_full : std_logic;
348  signal Link_output_FIFO_empty : std_logic;
349  signal Link_output_FIFO_prog_full : std_logic;
350  signal Link_output_FIFO_prog_empty : std_logic;
351 
352  signal TOB_data_FIFO_flags_i : STD_LOGIC_VECTOR (31 downto 0);
353 
354  signal reg1, reg2 : std_logic := '0' ;
355  signal frame_cntr_dec_en_i : std_logic;
356  signal frame_counter_dec_en_i : std_logic := '0' ;
357  signal frame_count_i : STD_LOGIC_VECTOR (11 downto 0); -- Frame counter
358 
359  signal TOB_safe_mode_i : std_logic;
360  signal tob_busy_assert_i : std_logic;
361 
362  signal SPY_TOB_mem_wr_addr_i : STD_LOGIC_VECTOR (10 downto 0) ;
363  signal SPY_TOB_mem_wr_addr_en_i : STD_LOGIC ;
364  signal SPY_FIFO_TOB_in_i : STD_LOGIC_VECTOR (35 downto 0) ;
365  signal SPY_TOB_mem_rd_data_i : STD_LOGIC_VECTOR (35 downto 0) ;
366  signal enable_tob_spy_mem_wr : std_logic ;
367  signal tst_fsm_cntr_i, q1_int : STD_LOGIC_VECTOR (31 downto 0) ;
368 
369  signal BCN_FIFO_rd_en_i : std_logic ;
370  signal BCN_FIFO_full_i : std_logic ;
371  signal BCN_FIFO_empty_i : std_logic ;
372  signal BCN_FIFO_valid_i : std_logic ;
373  signal BCN_FIFO_prog_full_i : std_logic ;
374  signal BCN_FIFO_Data_in_i : STD_LOGIC_VECTOR(46 downto 0) ;
375  signal BCN_FIFO_Data_in_1dly : STD_LOGIC_VECTOR(46 downto 0) ;
376  signal BCN_FIFO_Data_out_i : STD_LOGIC_VECTOR(46 downto 0) ;
377 
378  signal FIFO_BCN_in_i : STD_LOGIC_VECTOR(11 downto 0) ;
379  signal FIFO_L1A_ID_i : STD_LOGIC_VECTOR(23 downto 0) ;
380  signal FIFO_L1A_ID_EXT_i : STD_LOGIC_VECTOR(7 downto 0) ;
381  signal LO_FIFO_rd_data_count_i : STD_LOGIC_VECTOR(12 downto 0) ;
382  signal LO_FIFO_wr_data_count_i : STD_LOGIC_VECTOR(12 downto 0) ;
383  signal busy_tob_i : std_logic; -- tob data busy out to control FPGA
384  signal L1A_in_1dly, L1A_in_2dly, L1A_in_3dly : std_logic;
385  signal read_on_err_i : std_logic;
386  signal sync_280m_i : std_logic;
387  signal SPY_mem_wr_addr_tc_i : std_logic;
388 
389 --------------------------------
390 
391 -- ####### attributes ########
392  attribute TIG : string ;
393  attribute TIG of L1A_in_1dly : signal is "true" ;
394  attribute TIG of TOB_FIFO_sw_rst_i : signal is "true" ;
395 
396  attribute keep : string ;
397  attribute max_fanout : integer;
398  attribute keep of TOB_FIFO_sw_rst_i : signal is "true" ;
399  attribute max_fanout of TOB_FIFO_sw_rst_i : signal is 40;
400  attribute keep of FIFO_rd_en_i : signal is "true" ;
401  attribute max_fanout of FIFO_rd_en_i : signal is 40;
402  attribute keep of BCN_FIFO_empty_i : signal is "true" ;
403  attribute max_fanout of BCN_FIFO_empty_i : signal is 25;
404  attribute keep of BCN_FIFO_prog_full_i : signal is "true" ;
405  attribute max_fanout of BCN_FIFO_prog_full_i : signal is 25;
406  attribute keep of BCN_FIFO_full_i : signal is "true" ;
407  attribute max_fanout of BCN_FIFO_full_i : signal is 25;
408 
409 -- #######################################
410 
411 begin
412 
413  clk_in_280M_i <= clk_280M_in ;
414 
415  -- input signals
416 
417  RST_i <= RST ;
418  pre_ld_wr_addr_TOB_i <= pre_ld_TOB_wr_addr ; -- latency pre load for DRP wr address
419  DPR_locations_to_rd_i <= DPR_locations_to_rd ; -- number of DRP locations to wr into FIFO 1 to 5
420 
421  TOB_FIFO_sw_rst_i <= RST_i OR TOB_FIFO_sw_rst ; -- rst by s/w or RST
422 
423  busy_tob <= busy_tob_i ; -- tob data busy out to control FPGA
424 
425  -- output signals
426  -- FIFO flags assignments
427  TOB_data_FIFO_flags <= TOB_data_FIFO_flags_i;
428 
429  TOB_data_FIFO_flags_i(0) <= T_TOB_empty_i ;
430  TOB_data_FIFO_flags_i(1) <= T_TOB_prog_full_i ;
431  TOB_data_FIFO_flags_i(2) <= T_TOB_full_i ;
432 
433  TOB_data_FIFO_flags_i(3) <= XTOB_eg_empty_i ;
434  TOB_data_FIFO_flags_i(4) <= XTOB_eg_prog_full_i ;
435  TOB_data_FIFO_flags_i(5) <= XTOB_eg_full_i ;
436 
437  TOB_data_FIFO_flags_i(6) <= XTOB_tau_empty_i ;
438  TOB_data_FIFO_flags_i(7) <= XTOB_tau_prog_full_i ;
439  TOB_data_FIFO_flags_i(8) <= XTOB_tau_full_i ;
440 
441  TOB_data_FIFO_flags_i(9) <= Link_output_FIFO_empty ;
442  TOB_data_FIFO_flags_i(10) <= Link_output_FIFO_prog_full ;
443  TOB_data_FIFO_flags_i(11) <= Link_output_FIFO_full ;
444 
445  TOB_data_FIFO_flags_i(12) <= BCN_FIFO_empty_i ;
446  TOB_data_FIFO_flags_i(13) <= BCN_FIFO_prog_full_i ;
447  TOB_data_FIFO_flags_i(14) <= BCN_FIFO_full_i ;
448 
449  TOB_data_FIFO_flags_i(15) <= TOB_safe_mode_i ; -- Safe Mode operation flag for TOB readout
450  TOB_data_FIFO_flags_i(16) <= TOB_ready_i ; -- Ready signal from control FPGA for TOB readout
451  TOB_data_FIFO_flags_i(17) <= busy_tob_i ; -- BUSY signal from proc FPGA to stop L1A signal
452  TOB_data_FIFO_flags_i(31 downto 18) <= (others => '0');
453 
454  BCN_FIFO_Data_in_i <= "000" & BCN_ID_in & L1A_ID_in ; -- write L1A number and BC number into FIFO
455 
456  SPY_TOB_mem_wr_addr <= SPY_TOB_mem_wr_addr_i ; -- SPY memory address fo iPus Readout register
457 
458  T_TOB_FIFO_data_count <= T_TOB_FIFO_data_count_i;
459  XTOB_eg_FIFO_rd_data_count <= XTOB_eg_FIFO_rd_data_count_i;
460 
461  TOB_out_to_MGT <= TOB_data_out_MGT_i; -- event TOBs to MGT
462  TOB_out_to_MGT_is_char <= TOB_out_char_MGT_i; -- TOB data is char
463  L1A_ID_Event_out <= FIFO_L1A_ID_EXT_i & FIFO_L1A_ID_i ; -- 8b L1A ID Extended + 24b L1A ID of the current event
464  sync_280m_out <= sync_280m_i; -- this is 1 in 7 sync'ed to 40M clk
465 
466  tob_fsm_monitor <= tob_data_mgt_fsm_i & tob_data_mux_fsm_i & xtob_tau_data_dpram_fsm_i & xtob_eg_data_dpram_fsm_i & tob_data_dpram_fsm_i ;
467 
468 
469 -- This module generates a synch signal synchronised to 40MHz and 280MHz clocks
470 -- one synch pulse is generated - this is 1 in 7 sync'ed to 40M clock
471  U1_gen_sync_280 : entity TOB_rdout_lib.gen_sync_280M
472  port map(
473  RST => RST_i, -- RST from 40MHz MMCM lock signal
474  clk_40M => clk_40M_in, -- Clock 40MHz
475  clk_280M => clk_in_280M_i,
476  sync_280m_out => sync_280m_i -- this is 1 in 7 sync'ed to 40M clk
477  );
478 
479 -- This FDCE regitsters the cFPGA Ready input signal to receive TOB/XTOB Event Data.
480 U0_FDCE_xoff : FDCE
481  generic map (
482  INIT => '0') -- Initial value of register ('0' or '1')
483  port map (
484  Q => TOB_ready_i, -- Data output
485  C => clk_in_280M_i, -- Clock input
486  CE => '1', -- Clock enable input
487  CLR => '0' ,
488  D => TOB_ready_in -- Ready signal from control FPGA
489  );
490 
491 -- the FSM regitsters occupancy of XTOB data FIFO to send TOB BUSY signal to cFPGA
492 U0_busy_flag_fsm : entity TOB_rdout_lib.busy_flag_fsm
493  generic map (
494  width => 9
495  )
496  port map (
497  clk => clk_in_280M_i,
498  rst => TOB_FIFO_sw_rst_i,
499  busy_flag_assert => tob_busy_thresh_assert,
500  busy_flag_negate => tob_busy_thresh_negate,
501  fifo_data_count => XTOB_eg_FIFO_rd_data_count_i, -- use XTOBs FIFO Data instead of TOBs so U3 & U4 can assert BUSY as well
502  busy_flag => busy_tob_i
503  );
504 
505 
506 ---- Pipelines process
507 --U0_proc1 : process (clk_40M_in)
508 -- begin
509 -- if rising_edge (clk_40M_in) then
510 -- BCN_FIFO_Data_in_i <= "000" & BCN_ID_in & L1A_ID_in ; -- write L1A number and BC number into FIFO
511 -- L1A_in_1dly <= L1A_in; -- delay by 1 clock to aligh with read_on_err_in
512 -- end if;
513 -- end process;
514 
515 ---- Pipelines process
516 --U0_proc2 : process (clk_in_280M_i)
517 -- begin
518 -- if rising_edge (clk_in_280M_i) then
519 -- BCN_FIFO_Data_in_1dly <= "00" & read_on_err_in & BCN_FIFO_Data_in_i(43 downto 0); -- delay by 1 clock to aligh with read_on_err_in
520 -- L1A_in_2dly <= L1A_in_1dly AND sync_280m_i; -- delay by 1 clock to aligh with read_on_err_in
521 -- L1A_in_3dly <= L1A_in_2dly; -- delay by 1 clock to aligh with read_on_err_in
522 -- end if;
523 -- end process;
524 
525 
526 -- This is TTC FIFO for TOB/XTOB Readour, which stores the following values:.
527 -- bits 46:44 = not used
528 -- bits 43:32 = Bunch Crossing Number - generated in pFPGA
529 -- bits 31:24 = Extended L1A - received from CFPGA
530 -- bits 23:0 = L1A_ID - received from cFPGA
531 --
532 U0_FIFO_BCN_L1A : FIFO_47b_512 -- the flags from this FIFO is used
533  PORT MAP (
534  rst => TOB_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
535  wr_clk => clk_40M_in, -- clk_40M_in,
536  rd_clk => clk_in_280M_i,
537  din => BCN_FIFO_Data_in_i ,
538  wr_en => L1A_in, -- write only on rising edge of L1A
539  rd_en => BCN_FIFO_rd_en_i,
540  dout => BCN_FIFO_Data_out_i, -- BCN + EXT_L1A_ID + L1A_ID 44b = 12b + 8b + 24b
541  valid => BCN_FIFO_valid_i ,
542  rd_data_count => BCN_FIFO_TOB_rd_data_count,
543  prog_full_thresh_assert => BCN_FIFO_pFULL_THRESH_assert, -- 9b
544  prog_full_thresh_negate => BCN_FIFO_pFULL_THRESH_negate,
545  prog_full => BCN_FIFO_prog_full_i,
546  full => BCN_FIFO_full_i,
547  empty => BCN_FIFO_empty_i
548  );
549 
550  FIFO_L1A_ID_i <= BCN_FIFO_Data_out_i(23 downto 0) ; -- 24b L1A ID
551  FIFO_L1A_ID_EXT_i <= BCN_FIFO_Data_out_i(31 downto 24) ; -- 8b L1A ID Extended
552  FIFO_BCN_in_i <= BCN_FIFO_Data_out_i(43 downto 32) ; -- 12b BCN ID
553  read_on_err_i <= BCN_FIFO_Data_out_i(44); -- Read RAW data on error flag
554 
555 -- This T_TOBs_sorting module receives 7 x 32-bit TOBs together with 7 valid signals in series,
556 -- and sorts them into a 6 x 32-bit parallel word and 6 bit valid word to store in Circular DPRAM.
557 -- The 7th TOB is ignored as a trailer is added to transfer the data to TOPO.
558 -- In order to be able to read multi-slices, the TOBs and XTOBs must be converted into long parallel data words.
559 --
560 -- This module is only instanstiated for Process FPGA 1 and 2, and is disabled for Process FPGA 3 and 4.
561 -- Only Process FPGA 1 and 2 transmit e/g and tau events to TOPO, and the off-line Readout,
562 -- but Process FPGA 3 and 4 do not transmit to TOPO instead they send their TOBs to Process FPGA 1 and 2.
563 -- Process FPGA 3 and 4 transmit XTOB only events to the Control FPGA.
564 --
565 -- output signals:
566 -- If Process FPGA 1 & 2, then assign the outputs to TOBs data
567 -- If Process FPGA 3 & 4, then assign the outputs to ZERO, no TOB data in these FPGAs
568 
569 U1_TOB_sorting_gen : if FPGA_NUMBER = 1 or FPGA_NUMBER = 2 generate
570 
571  U1_TOBs_sorting : entity TOB_rdout_lib.T_TOBs_sorting
572  generic map(FPGA_NUMBER => FPGA_NUMBER)
573  Port map (
574  L1A_in => L1A_in,
575  TOB_FIFO_sw_rst => TOB_FIFO_sw_rst_i , -- RST OR TOB_FIFO_sw_rst
576  TOBs_32b_in => TOBs_32b_in , -- sorted TOBs 32b * 7 is series
577  TOBs_sync_in => TOBs_sync_in , -- sorted TOB start signal
578  TOBs_valid_flg_in => TOBs_valid_flg_in, -- sorted TOB write signal
579  ALGO_TOB_BCN_in => OUT_TOB_BCN, -- sorted TOB BC_ID with delay through ALGO/sorting block
580  FIFO_rd_en => FIFO_rd_en_i ,
581  clk_280M_in => clk_in_280M_i,
582  pre_ld_wr_addr_TOB => pre_ld_wr_addr_TOB_i,
583  DPR_locations_to_rd => DPR_locations_to_rd_i, -- number of DRP locations to read 1 to 5
584  trigger_slice_in => trigger_slice_in , -- i/p Trigger slice number - on L1A
585  TOBs_FIFO_pFULL_THRESH_assert => T_TOBs_FIFO_pFULL_THRESH_assert, -- connect to relevant register
586  TOBs_FIFO_pFULL_THRESH_negate => T_TOBs_FIFO_pFULL_THRESH_negate, -- connect to relevant register
587  rdout_T_TOB_209b => rdout_T_TOB_209b_i, -- sorted TOBs FIFO o/p 209b = 7b TOB_BCN +4b error+6b valid +192b TOB data
588  TOBs_FIFO_data_count => T_TOB_FIFO_data_count_i , -- sorted TOBs FIFO occupancy count
589  TOBs_data_valid => T_TOB_valid_i,
590  TOBs_data_full => T_TOB_full_i,
591  TOBs_data_empty => T_TOB_empty_i,
592  TOBs_data_prog_full => T_TOB_prog_full_i,
593  tob_data_dpram_fsm => tob_data_dpram_fsm_i
594  );
595  else generate
596  rdout_T_TOB_209b_i <= (others => '0');
597  T_TOB_FIFO_data_count_i <= (others => '0') ;
598  T_TOB_full_i <= '0';
599  T_TOB_empty_i <= '1'; -- show emppty flag
600  T_TOB_valid_i <= '0';
601  T_TOB_prog_full_i <= '0';
602  tob_data_dpram_fsm_i <= (others => '0');
603  end generate U1_TOB_sorting_gen;
604 
605 
606  pre_ld_wr_addr_XTOB_eg_i <= pre_ld_eg_XTOB_wr_addr ; -- set correct value register in XML
607 
608 -- This is the XTOB e/g sorting module.
609 -- It receives 20 x 64-bit TOBs together with 40 valid signal in series,
610 -- and sorts them into a 80 x 32-bit parallel word and 40 bit valid word to store in Circular DPRAM.
611 
612 U2_XTOBs_eg_sorting : entity TOB_rdout_lib.XTOBs_sorting
613  generic map(FPGA_NUMBER => FPGA_NUMBER)
614  Port map (
615  L1A_in => L1A_in,
616  XTOB_FIFO_sw_rst => TOB_FIFO_sw_rst_i, -- RST OR TOB_FIFO_sw_rst
617  XTOB_512b_in => XTOB_eg_512b_in, -- XTOB e/g data in 64b * 8
618  XTOB_Valid_flg_in => XTOB_eg_Valid_flg_in, -- 8b XTOB e/g has valid data
619  XTOB_sync_in => XTOB_eg_sync_in, -- XTOB e/g sync signal
620  ALGO_XTOB_BCN_in => OUT_XTOB_BCN, -- sorted TOB BCN with delay through ALGO/sorting block
621  pre_ld_wr_addr_XTOB => pre_ld_wr_addr_XTOB_eg_i,
622  DPR_locations_to_rd => DPR_locations_to_rd_i, -- number of DRP locations to read 1 to 5
623  trigger_slice_in => trigger_slice_in , -- i/p Trigger slice number - on L1A
624  FIFO_rd_en => FIFO_rd_en_i ,
625  clk_200M_in => clk_200M_in , -- i/p
626  clk_280M_in => clk_in_280M_i,
629  FIFO_XTOB_data_out => rdout_XTOB_eg_i, -- e/g XTOBs output of fifo - XTOBs (5*48b) + 5b valid + 7b XTOB_BCN
630  XTOB_FIFO_rd_data_count => XTOB_eg_FIFO_rd_data_count_i , -- occupancy of e/g XTOB FIFO - RD clk
631  XTOB_FIFO_valid => valid_XTOBs_eg_i,
632  XTOB_FIFO_full => XTOB_eg_full_i,
633  XTOB_FIFO_empty => XTOB_eg_empty_i,
634  XTOB_FIFO_prog_full => XTOB_eg_prog_full_i,
635  xtob_data_dpram_fsm => xtob_eg_data_dpram_fsm_i
636  );
637 
638  pre_ld_wr_addr_XTOB_tau_i <= pre_ld_tau_XTOB_wr_addr ; -- set correct value register in XML
639 
640 -- This is the XTOB tau sorting module.
641 -- It receives 20 x 64-bit TOBs together with 40 valid signal in series,
642 -- and sorts them into a 80 x 32-bit parallel word and 40 bit valid word to store in Circular DPRAM.
643 
644 U3_XTOBs_tau_sorting : entity TOB_rdout_lib.XTOBs_sorting
645  generic map(FPGA_NUMBER => FPGA_NUMBER)
646  Port map (
647  L1A_in => L1A_in,
648  XTOB_FIFO_sw_rst => TOB_FIFO_sw_rst_i, -- RST OR TOB_FIFO_sw_rst
649  XTOB_512b_in => XTOB_tau_512b_in, -- XTOB e/g data in 64b * 8
650  XTOB_Valid_flg_in => XTOB_tau_Valid_flg_in, -- 8b XTOB e/g has valid data (x 5)
651  XTOB_sync_in => XTOB_tau_sync_in, -- XTOB e/g sync signal
652  ALGO_XTOB_BCN_in => OUT_XTOB_BCN, -- sorted TOB BCN with delay through ALGO/sorting block
653  pre_ld_wr_addr_XTOB => pre_ld_wr_addr_XTOB_tau_i,
654  DPR_locations_to_rd => DPR_locations_to_rd_i, -- number of DRP locations to read 1 to 5
655  trigger_slice_in => trigger_slice_in , -- i/p Trigger slice number - on L1A
656  FIFO_rd_en => FIFO_rd_en_i ,
657  clk_200M_in => clk_200M_in , -- i/p
658  clk_280M_in => clk_in_280M_i,
661  FIFO_XTOB_data_out => rdout_XTOB_tau_i , -- XTOBs tau output of fifo - XTOBs (5*48b) + 5b valid + 7b XTOB_BCN
662  XTOB_FIFO_rd_data_count => XTOB_tau_FIFO_rd_data_count , -- occupancy of tau XTOB FIFO - RD clk
663  XTOB_FIFO_valid => valid_XTOBs_tau_i,
664  XTOB_FIFO_full => XTOB_tau_full_i,
665  XTOB_FIFO_empty => XTOB_tau_empty_i,
666  XTOB_FIFO_prog_full => XTOB_tau_prog_full_i,
667  xtob_data_dpram_fsm => xtob_tau_data_dpram_fsm_i
668  );
669 
670 --gen_empty_flags : if (FPGA_NUMBER = 1 OR FPGA_NUMBER = 2) generate
671 -- TOB_empty_flag_i <= XTOB_eg_empty_i OR XTOB_tau_empty_i OR T_TOB_empty_i OR BCN_FIFO_empty_i ; -- all must not be empty to prevent a read from empty FIFO
672 -- TOB_pfull_flag_i <= XTOB_eg_prog_full_i OR XTOB_tau_prog_full_i OR T_TOB_prog_full_i ; -- one flag can be pFULL
673 -- else generate
674  TOB_empty_flag_i <= XTOB_eg_empty_i OR XTOB_tau_empty_i OR BCN_FIFO_empty_i ; -- all must not be empty to prevent a read from empty FIFO
675  TOB_pfull_flag_i <= XTOB_eg_prog_full_i OR XTOB_tau_prog_full_i ; -- one flag can be pFULL
676 --end generate gen_empty_flags;
677 
678 
679 -- Generate FSM to write TOBs and XTOBS into an event packet for pFPGA 1 and 2
680 -- Else Generate FSM to write only XTOBS into an event packet for pFPGA 3 and 4
681 
682  U6_rd_mux_fsm : entity TOB_rdout_lib.fsm_TOBs_to_muxPISO
683  generic map(FPGA_NUMBER => FPGA_NUMBER)
684  PORT map (
685  TOB_FIFO_sw_rst => TOB_FIFO_sw_rst_i, -- RST OR TOB_FIFO_sw_rst
686  hw_addr => hw_addr , -- FPGA number
687  trigger_slice_in => trigger_slice_in , -- Trigger slice number - on L1A
688  rdout_T_TOB_209b_in => rdout_T_TOB_209b_i, -- sorted TOBs FIFO o/p 209b = 7b TOB_BCN +4b error+6b valid +192b TOB data
689  valid_T_TOB_in => T_TOB_valid_i , -- indicated input sorted TOB data is valid
690  TOB_type_in => TOB_type_in , -- TOB Type 0 = e/g, 1 = tau
691  XTOBs_eg_in => rdout_XTOB_eg_i , -- XTOBs (5*48b) + 5b valid + 7b XTOB_BCN
692  valid_XTOBs_eg_in => valid_XTOBs_eg_i,
693  XTOBs_tau_in => rdout_XTOB_tau_i , -- XTOBs (5*48b) + 5b valid + 7b XTOB_BCN
694  valid_XTOBs_tau_in => valid_XTOBs_tau_i ,
695  clk_280M_in => clk_in_280M_i ,
696  shelf_number => shelf_number, -- i/p shelf address
697  efex_slot_num => efex_slot_num, -- i/p slot address
698  TOB_FIFO_empty_in => TOB_empty_flag_i ,
699  DPR_locations_to_rd => DPR_locations_to_rd_i , -- number of DRP locations to read 1 to 5
700  TOB_prog_full_flag_in => TOB_pfull_flag_i,
701  read_on_err_in => read_on_err_i , -- RAW readout expected upon Error flag
702  FIFO_BCN_in => FIFO_BCN_in_i , -- 12b BCN ID from counter
703  FIFO_L1A_ID => FIFO_L1A_ID_i , -- 24b L1A ID from TTC info
704  FIFO_L1A_ID_EXT => FIFO_L1A_ID_EXT_i , -- 8b L1A ID Extended from TTC info
705  BCN_FIFO_valid_in => BCN_FIFO_valid_i , -- data from TTC FIFO is valid
706  BCN_FIFO_prog_full_in => BCN_FIFO_prog_full_i,
707  LO_FIFO_prog_full_in => Link_output_FIFO_prog_full,
708  LO_FIFO_data_count_in => LO_FIFO_wr_data_count_i, -- uses the 280 MHz wr clock of LO FIFO
709  frame_cntr_en => frame_cntr_en_i , -- enable frame counter count up
710  BCN_FIFO_rd_en_out => BCN_FIFO_rd_en_i , -- rd enabto BCN & L1A FIFO
711  TOB_rdout_fifo_rd_en_out => FIFO_rd_en_i , -- rd enable to TOB & XTOB FIFOs
712  TOB_out_valid => TOB_out_valid_i , -- sorted TOBs data valid to U7_Link_output_FIFO
713  TOB_out_is_char => TOB_out_is_char_i, -- sorted TOBs is CHAR to U7_Link_output_FIFO
714  TOBs_out => TOBs_out_i, -- sorted TOBs valid to U7_Link_output_FIFO
715  TOB_safe_mode_out => TOB_safe_mode_i, -- Safe Mode operation flag for TOB readout
716  tob_data_mux_fsm => tob_data_mux_fsm_i
717  );
718 
719  FIFO_TOBs_in_i <= TOB_out_is_char_i & TOBs_out_i; -- 1b char and 32b data
720 
721 -- This is TOB/XTOB Link Output FIFO, which stores complete TOB/XTOB events (frames) ready to be transmitted to cFPGA via an MGT link at 11.2Gbps.
722 -- The output of FIFO is 32-bit data word, and 1-bit data is CHAR, which goes directly to MGT under FSM control.
723 --
724 -- The Frames are only transmitted when cFPGA indicates it is ready to receive data by setting ctrl_TOB_ready signal to 1.
725 -- If ctrl_TOB_ready signal is set to 0 by cFPGA, this indicates cFPGA is not ready to receive data,
726 -- in this case events accumulate in Link Output FIFO until occupancy reaches a pre-define level of prog_FULL,
727 -- at this time, Link Output FIFO stops receiving data.
728 --
729 -- Writing to LO FIFO is controlled by fsm_TOBs_to_muxPISO (OR fsm_XTOBs_to_muxPISO) FSM
730 -- Reading from LO FIFO is controlled by FIFO_to_MGT_TOB_FSM FSM
731 
732 U7_Link_output_FIFO : FIFO_33b_8192
733  PORT MAP (
734  wr_rst => TOB_FIFO_sw_rst_i, -- RST OR TOB_FIFO_sw_rst
735  wr_clk => clk_in_280M_i,
736  din => FIFO_TOBs_in_i,
737  wr_en => TOB_out_valid_i,
738  rd_rst => TOB_FIFO_sw_rst_i, -- RST OR TOB_FIFO_sw_rst
739  rd_clk => TOB_TXOUTCLK, -- 280M clk to rd data to cntl FPGA
740  rd_en => Link_output_FIFO_rd_en_i,
741  dout => Link_output_FIFO_TOBs_out_i,
742  full => Link_output_FIFO_full, -- on wr clk 280MHz
743  empty => Link_output_FIFO_empty, -- on rd clk TXOUTCLK
744  prog_full => Link_output_FIFO_prog_full,
745  valid => Link_output_FIFO_TOB_valid_i,
746  prog_full_thresh_assert => Link_output_FIFO_pFULL_THRESH_assert ,
747  prog_full_thresh_negate => Link_output_FIFO_pFULL_THRESH_negate ,
748  wr_data_count => LO_FIFO_wr_data_count_i , -- wr data on wr clk 280MHz
749  rd_data_count => LO_FIFO_rd_data_count_i -- rd data on rd clk TXOUTCLK
750  );
751 
752  Link_output_FIFO_rd_data_count <= LO_FIFO_rd_data_count_i;
753 
754 -- This FSM reads TOB/XTOB frames from Link Output FIFO and writes into MGT to transmit to cFPGA.
755 -- This FSM handles one full frame at a time without pausing.
756 -- It monitors the TOB frame counter to find out if there are Frames waiting to be transmitted to cFPGA.
757 -- The Frames are only transmitted when cFPGA indicates it is ready to receive data by setting ctrl_TOB_ready signal to 1.
758 -- If ctrl_TOB_ready signal is set to 0 by cFPGA, this indicates cFPGA is not ready to receive data,
759 -- in this case events accumulate in Link Output FIFO until occupancy reaches a pre-define prog_FULL level,
760 -- at this time, Link Output FIFO stops receiving data.
761 
762 U8_TOB_Link_output_FIFO_FSM : entity TOB_rdout_lib.FIFO_to_MGT_TOB_FSM
763  Port map (
764  TOB_FIFO_sw_rst => TOB_FIFO_sw_rst_i, -- RST OR TOB_FIFO_sw_rst
765  clk_in_280M => TOB_TXOUTCLK, -- 280MHz
767  frame_counter => frame_count_i,
768  FIFO_MGT_TOBs => Link_output_FIFO_TOBs_out_i,
769  FIFO_MGT_TOB_valid => Link_output_FIFO_TOB_valid_i ,
770  MGT_FIFO_empty => Link_output_FIFO_empty,
771  FIFO_MGT_rd_en => Link_output_FIFO_rd_en_i, -- output
772  frame_counter_dec_en => frame_cntr_dec_en_i,
773  T_TOBs_out => TOB_out_to_MGT_i, -- event TOBs to MGT
774  T_TOB_is_char => TOB_out_to_MGT_is_char_i, -- TOB data is char
775  T_TOB_out_valid => T_TOB_out_valid_i,
776  tob_data_mgt_fsm => tob_data_mgt_fsm_i
777  );
778 
779 -- If the counter is ZERO, no data is available to be send to cFPGA.
780 
781 U9_clk_closs_pulse : entity TOB_rdout_lib.clk_closs_pulse_fsm
782  Port map (
783  clk_src => clk_in_280M_i ,
784  rst_src => TOB_FIFO_sw_rst_i , -- RST OR TOB_FIFO_sw_rst
785  pulse_src => frame_cntr_en_i, -- input from fsm_TOBs_to_muxPISO
786  clk_dest => TOB_TXOUTCLK ,
787  pulse_dest => frame_cntr_en_ii
788  );
789 
790 -- The TOB_frame_counter is a 12-bit generic up/down counter to count the number of complete Frames in Link Output FIFO to be transmitted to cFPGA.
791 -- When one complete Frame (event) is written to LO FIFO, this counter is incremented.
792 -- When one complete Frame (event) is read out LO FIFO, this counter is decremented.
793 -- If the counter is ZERO, no data is available to be send to cFPGA.
794 
795 U9_frame_counter : entity TOB_rdout_lib.cntr_up_dn_generic
796  generic map (
797  width => 12
798  )
799  Port map (
800  CE => '1' ,
801  CLK => TOB_TXOUTCLK ,
802  RST => TOB_FIFO_sw_rst_i , -- RST OR TOB_FIFO_sw_rst
803  UP => frame_cntr_en_ii ,
804  DOWN => frame_cntr_dec_en_i , -- this is a 280 MHz signal
805  Q => frame_count_i
806  );
807 
808 -- delay data to SPY RAM
809 U10_dec_frm_cntr : process (TOB_TXOUTCLK)
810  begin
811  if TOB_TXOUTCLK'event and TOB_TXOUTCLK = '1' then
812  TOB_out_to_MGT_1dly <= TOB_out_to_MGT_i;
813  TOB_data_out_MGT_i <= TOB_out_to_MGT_1dly; -- data to MGT
814  TOB_out_to_MGT_is_char_1dly <= TOB_out_to_MGT_is_char_i;
815  TOB_out_char_MGT_i <= TOB_out_to_MGT_is_char_1dly;
816  T_TOB_out_valid_1dly <= T_TOB_out_valid_i;
817  end if;
818  end process;
819 
820  SPY_TOB_mem_wr_addr_en_i <= (T_TOB_out_valid_1dly AND enable_tob_spy_mem_wr);
821 
822 -- The TOB_SPY_mem is a Dual Port Memory with IPBus interface.
823 -- It is possible to read/write to/from DPRAM using the IPBus interface.
824 -- The SPY Memory captures the data that is read out of Link Output FIFO to MGT.
825 -- The SPY Memory is designed to fill up and then stops accepting new data,
826 -- therefore the old data is not written over.
827 
828 U12_TOB_SPY_mem : entity ipbus_lib.ipbus_dpram
829  generic map(
830  ADDR_WIDTH => 11 -- DPRAM 512 locations
831  )
832  port map(
833  clk => ipb_clk,
834  rst => RST_spy_mem_wr_addr OR RST_i , -- was '0' ,
835  ipb_in => ipbus_in_tob_dpram , -- i/p signal going to TOB SPY DPRAM
836  ipb_out => ipbus_out_tob_dpram , -- o/p signal coming from TOB SPY DPRAM
837  rclk => TOB_TXOUTCLK ,
838  we => SPY_TOB_mem_wr_addr_en_i , -- wr addr en
839  d => TOB_out_to_MGT_1dly , -- wr data
840  q => q1_int ,
841  addr => SPY_TOB_mem_wr_addr_i -- wr addr
842  );
843 
844 -- The spy_mem_wr_addr is a generic counter that provides the write address to RAW SPY Memory.
845 -- The spy memory address is 11-bits wide, so the depth of memory is 2048.
846 -- The write address of the TOB_SPY_mem is reset to ZERO by asserting RST_spy_mem_wr_addr or system RST signals.
847 -- The signal RST_spy_mem_wr_addr is bit 5 of register rdout_pulse_reg.
848 -- The rdout_pulse_reg register is pulsed, and after 1 clock cycle all bits are reset to Zeros.
849 
850 U13_spy_mem_wr_addr : entity TOB_rdout_lib.cntr_generic
851  generic map (
852  width => 11
853  )
854  Port map (
855  CE => SPY_TOB_mem_wr_addr_en_i , -- if a valid data, then increment the address
856  CLK => TOB_TXOUTCLK ,
857  RST => RST_spy_mem_wr_addr OR RST_i ,
858  Q => SPY_TOB_mem_wr_addr_i
859  );
860 
861 -- Process U14_stop_wr disables the write enable signal to Spy Memory when it is full.
862 
863 U14_stop_tob_wr : process (TOB_TXOUTCLK)
864  begin
865  if rising_edge (TOB_TXOUTCLK) then
866  if (RST_spy_mem_wr_addr = '1') then
867  enable_tob_spy_mem_wr <= '1'; -- if not full, en data wr
868  else
869  if SPY_TOB_mem_wr_addr_i = "11111111111" then -- if terminal count -1 to prevent wrap round to ZERO
870  enable_tob_spy_mem_wr <= '0'; -- disable memory wr to prevent data corruption
871  end if;
872  end if;
873  end if;
874  end process U14_stop_tob_wr;
875 
876 --U14_stop_tob_wr : entity TOB_rdout_lib.fsm_TOB_double_word
877 -- Port map (
878 -- CLK_IN => TOB_TXOUTCLK ,
879 -- RST_IN => RST_spy_mem_wr_addr OR RST_i,
880 -- TOB_data_in => TOB_out_to_MGT_1dly,
881 -- double_counter_en => tob_double_word_en, -- enable TOB double word counter
882 -- DPR_wr_enable => enable_tob_spy_mem_wr
883 -- );
884 
885 end RTL;
External data-types and functions.
( OUTPUT_TOBS- 1 downto 0) AlgoXTriggerObject AlgoXOutput
Algorithm XOUTPUT port.
FSM to read TOB/XTOB data from Link Output FIFO for process FPGA.
out tob_data_mgt_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
in frame_counter STD_LOGIC_VECTOR( 11 downto 0)
Frame counter register.
in FIFO_MGT_TOBs STD_LOGIC_VECTOR( 32 downto 0)
TOB/XTOBs from Link Output FIFO.
out FIFO_MGT_rd_en STD_LOGIC
Read enalbe singal to Link Output FIFO.
out T_TOB_out_valid STD_LOGIC
TOB/XTOB is valid signal to wr to SPY memory.
out T_TOBs_out STD_LOGIC_VECTOR( 31 downto 0)
32b TOB/XTOB to connect to output MGT to control FPGA
in ctrl_TOB_ready_in std_logic
Ready signal from control FPGA to receive data from process FPGA.
out frame_counter_dec_en STD_LOGIC
Decrement Frame Counter.
out T_TOB_is_char STD_LOGIC
TOB/XTOB is CHAR to connect to output MGT to control FPGA.
in MGT_FIFO_empty std_logic
Link Output FIFO Empty Flag.
in TOB_FIFO_sw_rst std_logic
TOB Readout FIFO reset Pulse by software command.
in FIFO_MGT_TOB_valid STD_LOGIC
TOB/XTOBs from Link Output FIFO valid signal.
Merged Sorted TOB and Local XTOB Readout Logic for process FPGA.
Definition: TOBs_rdout.vhd:283
std_logic TOB_ready_i
Control FPGA Ready signal internal.
Definition: TOBs_rdout.vhd:306
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 TOBs_sync_in STD_LOGIC
sorted TOB start signal
Definition: TOBs_rdout.vhd:180
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
Top of Sorting_TOBs module for process FPGA.
in TOBs_sync_in STD_LOGIC
Sorted TOB synch signal - indicating the start of the 7 TOB data words.
in pre_ld_wr_addr_TOB STD_LOGIC_VECTOR( 8 downto 0)
Latency pre-load for TOB Circular DRPAM write address.
out TOBs_data_prog_full STD_LOGIC
Sorted TOBs FIFO prog full flag.
in trigger_slice_in STD_LOGIC_VECTOR( 3 downto 0)
Trigger slice number - on L1A.
in DPR_locations_to_rd STD_LOGIC_VECTOR( 2 downto 0)
Number of multi-slice locations to read from DPRAM.
in TOBs_32b_in STD_LOGIC_VECTOR( 31 downto 0)
Sorted TOBs 32b * 7 in series.
in TOBs_valid_flg_in STD_LOGIC
Sorted TOB valid signal - used to write TOBs into de-randomisation TOB FIFO.
in L1A_in STD_LOGIC
L1A signal input.
out rdout_T_TOB_209b STD_LOGIC_VECTOR( 208 downto 0)
Sorted TOBs output of fifo 209b = 7b TOB_BCN +4b error+6b valid +192b TOB data.
out TOBs_data_valid STD_LOGIC
Sorted TOBs FIFO data valid signal.
in FIFO_rd_en STD_LOGIC
Read sorted TOB data from de-randomisation TOB FIFO into TOB Link Output FIFO.
out TOBs_FIFO_data_count STD_LOGIC_VECTOR( 8 downto 0)
Sorted TOBs FIFO occupancy count.
FPGA_NUMBER integer := 1
Integer used to distinguish different FPGAs having a slightly different firmware.
out TOBs_data_full STD_LOGIC
Sorted TOBs FIFO full flag.
in TOB_FIFO_sw_rst std_logic
TOB Readout FIFO reset Pulsed by software command.
out tob_data_dpram_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
out TOBs_data_empty STD_LOGIC
Sorted TOBs FIFO empty flag.
in clk_280M_in STD_LOGIC
280Mhz input signal
in ALGO_TOB_BCN_in std_logic_vector( 6 downto 0)
Sorted TOB BCN with delay through ALGO/sorting block.
in TOBs_FIFO_pFULL_THRESH_negate STD_LOGIC_VECTOR( 8 DOWNTO 0)
Threshold to de-assert FIFO prog full flag.
in TOBs_FIFO_pFULL_THRESH_assert STD_LOGIC_VECTOR( 8 DOWNTO 0)
Threshold to assert FIFO prog full flag.
Top of Sorting XTOBs module for process FPGA.
in XTOB_sync_in STD_LOGIC
XTOB sync signal.
out FIFO_XTOB_data_out array_8_of_252b
XTOBs output of fifo {array 8 of [(5*48b) + 5b valid] + 7b BCN}.
out XTOB_FIFO_empty STD_LOGIC
XTOBs FIFO empty flag.
in trigger_slice_in STD_LOGIC_VECTOR( 3 downto 0)
Trigger slice number - on L1A.
in DPR_locations_to_rd STD_LOGIC_VECTOR( 2 downto 0)
number of multi-slice locations to read from DPRAM
out XTOB_FIFO_prog_full STD_LOGIC
XTOBs FIFO prog full flag.
out XTOB_FIFO_valid STD_LOGIC
XTOBs FIFO data valid signal.
in XTOB_FIFO_pFULL_THRESH_negate STD_LOGIC_VECTOR( 8 downto 0)
Threshold to negate XTOB FIFO prog full flag.
out XTOB_FIFO_rd_data_count STD_LOGIC_VECTOR( 8 downto 0)
occupancy of XTOB derandomisation FIFO - read count
in XTOB_FIFO_sw_rst std_logic
TOB Readout FIFO reset Pulse by software command OR SYS_RST.
in L1A_in STD_LOGIC
L1A signal input.
in XTOB_512b_in AlgoXOutput
array 8 x 64b words XTOBs
in ALGO_XTOB_BCN_in std_logic_vector( 6 downto 0)
sorted XTOB BCN with delay through ALGO/sorting block
in FIFO_rd_en STD_LOGIC
read XTOB data into Shift Registers
in XTOB_FIFO_pFULL_THRESH_assert STD_LOGIC_VECTOR( 8 downto 0)
Threshold to assert XTOB FIFO prog full flag.
in clk_200M_in STD_LOGIC
200Mhz input signal
FPGA_NUMBER integer := 1
Integer used to distinguish different FPGAs having a slightly different firmware.
out XTOB_FIFO_full STD_LOGIC
XTOBs FIFO full flag.
in XTOB_Valid_flg_in STD_LOGIC_VECTOR( 7 downto 0)
8b XTOB has valid data
in pre_ld_wr_addr_XTOB STD_LOGIC_VECTOR( 8 downto 0)
latency pre-load for XTOB DRPAM write address
out xtob_data_dpram_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
in clk_280M_in STD_LOGIC
280Mhz input signal
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.
in CLK STD_LOGIC
Clock signal input.
in DOWN STD_LOGIC
Count DOWN 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.
in UP STD_LOGIC
Count UP signal input.
FSM to write Merged TOBs and Local XTOBs (tau & e/g) data to Link Output FIFO for process FPGA 1 and ...
in valid_XTOBs_eg_in STD_LOGIC
XTOBs e/g valid signal.
in TOB_type_in STD_LOGIC
Sorted TOB data readout 32b * 7 in series, only 6 is used - F1 reads e/g TOBs and F2 reads tau TOBs.
in trigger_slice_in STD_LOGIC_VECTOR( 3 downto 0)
Trigger slice number - on L1A.
in DPR_locations_to_rd STD_LOGIC_VECTOR( 2 downto 0)
number of DRPAM locations to read for multi-slice (1 to 5)
in TOB_prog_full_flag_in std_logic
Input prog Full flag of all TOB FIFOs TTC, TOB & XTOB FIFOs.
in BCN_FIFO_prog_full_in STD_LOGIC
BCN & L1A FIFO prog full flag.
out tob_data_mux_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
in rdout_T_TOB_209b_in STD_LOGIC_VECTOR( 208 downto 0)
sorted TOBs 209b = 7b+4b+6b+192b TOB_BCN+ERR+valid+TOBs
in FIFO_L1A_ID_EXT STD_LOGIC_VECTOR( 7 downto 0)
Extended L1A ID from TTC input.
in XTOBs_eg_in array_8_of_252b
XTOBs e/g {array 8 of [(5*64b) + 5b valid]}.
in LO_FIFO_data_count_in STD_LOGIC_VECTOR( 12 downto 0)
Link Output FIFO data count.
in TOB_FIFO_empty_in std_logic
Input empty flag of all TOB FIFOs TTC, TOB & XTOB FIFOs.
out BCN_FIFO_rd_en_out STD_LOGIC
read enable signal to BCN & L1A_ID FIFOs
in shelf_number STD_LOGIC_VECTOR( 3 downto 0)
shelf number input
in efex_slot_num STD_LOGIC_VECTOR( 3 downto 0)
eFEX slot number input
in FIFO_BCN_in STD_LOGIC_VECTOR( 11 downto 0)
Bunch Crossing ID from BCN counter.
out TOB_rdout_fifo_rd_en_out STD_LOGIC
read enable signal to all TOB/XTOB FIFOs
out TOB_out_valid STD_LOGIC
sorted TOBsXTOBs data valid signal to Link_outpout_FIFO
in FIFO_L1A_ID STD_LOGIC_VECTOR( 23 downto 0)
L1A ID from TTC input.
FPGA_NUMBER integer := 1
Integer used to distinguish different FPGAs having a slightly different firmware.
in BCN_FIFO_valid_in STD_LOGIC
Data from TTC FIFO is valid.
in hw_addr STD_LOGIC_VECTOR( 1 downto 0)
FPGA Hardware Address.
in valid_XTOBs_tau_in STD_LOGIC
XTOBs tau valid signal.
in LO_FIFO_prog_full_in std_logic
Link Output FIFO partial FULL flag to receive RAW calorimeter data.
in valid_T_TOB_in std_logic
sorted TOBs valid signal
out TOB_safe_mode_out STD_LOGIC
Safe Mode operation flag for TOB readout.
out TOB_out_is_char STD_LOGIC
sorted TOBsXTOBs data is CHAR signal to Link_outpout_FIFO
in TOB_FIFO_sw_rst std_logic
TOB Readout FIFO reset Pulse by software command ORed with SYS_RST.
out frame_cntr_en STD_LOGIC
enable frame counter to count up by 1
out TOBs_out STD_LOGIC_VECTOR( 31 downto 0)
sorted TOBsXTOBs 32b data to Link_outpout_FIFO
in read_on_err_in STD_LOGIC
Read RAW data on error flag.
in clk_280M_in STD_LOGIC
280MHz clock input signal
in XTOBs_tau_in array_8_of_252b
XTOBs tau {array 8 of [(5*64b) + 5b valid]}.
Generate Synch at 280MHz.
in clk_40M STD_LOGIC
Clock 40MHz in.
out sync_280m_out STD_LOGIC
280MHz synch signal output
in RST STD_LOGIC
Reset in.
in clk_280M STD_LOGIC
Clock 2800MHz in.