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

Back to eFEX documentation
RAW_data_rdout.vhd
Go to the documentation of this file.
1 
98 
99 
100 library ieee;
101 use ieee.std_logic_1164.all;
102 use ieee.numeric_std.all;
103 
104 library ipbus_lib;
105 use ipbus_lib.ipbus.all;
106 
107 Library UNISIM;
108 use UNISIM.vcomponents.all;
109 
110 Library UNIMACRO;
111 use UNIMACRO.vcomponents.all;
112 
113 library TOB_rdout_lib;
114 use TOB_rdout_lib.data_type_pkg.all;
115 use TOB_rdout_lib.TOB_rdout_ip_pkg.all;
116 
118 entity RAW_data_rdout is
119  generic
120  (
122  FPGA_NUMBER : integer := 1
123  );
124  port (
125  RST : in std_logic;
127  hw_addr : in std_logic_vector(1 downto 0);
129  RST_spy_mem_wr_addr : in std_logic;
131  RAW_FIFO_sw_rst : in std_logic;
133  RAW_data_in : in RAW_data_227_type;
135  clk_40M_rdout : in std_logic;
137  clk_280M_in : in std_logic;
139  clk_load_in : in std_logic;
141  ipb_clk : in std_logic;
143  RAW_ready_in : in std_logic;
145  RAW_TXOUTCLK : in std_logic;
147  L1A_in : in std_logic;
149  BCN_ID_in : in std_logic_vector (11 downto 0);
151  L1A_ID_in : in std_logic_vector (31 downto 0);
153  raw_rd_all_in : in std_logic;
155  pre_ld_wr_addr : in std_logic_vector (9 downto 0);
157  RAW_FIFO_FULL_THRESH_ASSERT : in std_logic_vector (8 downto 0);
159  RAW_FIFO_FULL_THRESH_NEGATE : in std_logic_vector (8 downto 0);
161  RAW_FIFO_data_count : out std_logic_vector(8 downto 0);
163  raw_busy_thresh_assert : in STD_LOGIC_VECTOR (8 downto 0); -- TOBs FIFO
165  raw_busy_thresh_negate : in STD_LOGIC_VECTOR (8 downto 0); -- TOBs FIFO
167  cntr_load_en : in std_logic;
169  RAW_data_FIFO_flags : out std_logic_vector (31 downto 0);
171  RAW_out_to_MGT_is_char : out std_logic;
173  RAW_data_out : out std_logic_vector (31 downto 0); -- TOBs 32b out to MGT
175  mgt_enable_in : in STD_LOGIC_VECTOR (48 downto 0) ;
177  frame_count : out std_logic_vector (31 downto 0);
179  read_on_err_out : out STD_LOGIC;
181  TTC_read_all_in : in std_logic;
183  RAW_FIFO_pFULL_THRESH_ASSERT : in std_logic_vector (8 downto 0); -- MGT_FIFO
185  RAW_FIFO_pFULL_THRESH_NEGATE : in std_logic_vector (8 downto 0); -- MGT_FIFO
187  BCN_FIFO_pFULL_THRESH_assert : in std_logic_vector(8 downto 0);
189  BCN_FIFO_pFULL_THRESH_negate : in std_logic_vector(8 downto 0);
191  BCN_FIFO_RAW_rd_data_count : out STD_LOGIC_VECTOR (8 downto 0); -- occupancy of BCN & L1A FIFO for RAW Readout
193  Link_output_FIFO_RAW_pfull_thresh_assert : in std_logic_vector (12 downto 0); -- Link_output_FIFO
195  Link_output_FIFO_RAW_pfull_thresh_negate : in std_logic_vector (12 downto 0); -- Link_output_FIFO
197  Link_output_FIFO_RAW_rd_data_count : out std_logic_vector (12 downto 0); -- occupancy of RAW output link MGT FIFO
199  SPY_mem_wr_addr : out std_logic_vector (10 downto 0); -- SPY memory wr_addr (read only)
201  ipbus_out_raw_dpram : out ipb_rbus;
203  ipbus_in_raw_dpram : in ipb_wbus;
205  link_error_flags : out std_logic_vector (53 downto 0);
207  busy_raw : out std_logic;
209  raw_fsm_monitor : out std_logic_vector (31 downto 0)
210  );
211 end RAW_data_rdout;
212 
214 architecture RTL of RAW_data_rdout is
215 
216 --***********************************Parameter Declarations********************
218  constant chan_no : integer := 49;
219 --************************** Register Declarations ****************************
220 
221  signal DPR_rd_addr_i : std_logic_vector (9 downto 0);
222  signal DPR_wr_addr_i : std_logic_vector (9 downto 0);
223  signal DPR_rd_addr_i_1dly : std_logic_vector (9 downto 0);
224  signal DPR_wr_addr_i_1dly : std_logic_vector (9 downto 0);
225 
226  signal FIFO_RAW_Data_dout_i : DPR_RAW_out_36_type; -- array 49 of 36b = err + data
227  signal FIFO_RAW_Data_dout_i_1dly : DPR_RAW_out_36_type; -- array 49 of 36b = err + data
228 
229  signal link_error_flags_tmp : link_error_type; -- array 49 x 4 bit per link
230  signal link_err_4b_in_i : std_logic_vector (3 downto 0); -- place holder for overall error flags of all optical link inputs.
231  signal channel_error_49b_i : std_logic_vector (48 downto 0);
232  signal link_error_flags_54b_i : std_logic_vector (53 downto 0);
233  signal FIFO_error_flags_54b_i : std_logic_vector (53 downto 0);
234  signal req_err_rd_raw_i : std_logic := '0'; -- flag to request RAW data read out upon error
235  signal FIFO_error_flags_valid_i : std_logic;
236 
237 
238  signal PISO_data_out_i : DPR_RAW_out_36_type; -- array 49 of 36b = err + data
239  signal DPR_RAW_out_i : DPR_RAW_out_36_type; -- array 49 of 36b = err + data
240  signal DPR_RAW_out_i_1dly : DPR_RAW_out_36_type; -- array 49 of 36b = err + data
241 
242  signal RST_i : std_logic;
243  signal Read_all_i : std_logic; -- privilege read All Flag
244  signal RAW_FIFO_sw_rst_i : std_logic;
245  signal clk_in_280M_i : std_logic;
246  signal PISO_sync_out_i : t_49_arr_1b; -- 49 sync signals for 49 links
247  signal PISO_data_out_valid_i : t_49_arr_1b; -- 49 sync signals for 49 links
248 
249  signal L1A_in_i, L1A_in_1dly : std_logic;
250  signal L1A_in_a : std_logic;
251  signal L1A_in_b : std_logic;
252  signal DRP_rd_en_i : std_logic;
253  signal DRP_rd_en_i_1dly : std_logic;
254 
255  signal FIFO_wr_en_i : std_logic;
256  signal FIFO_wr_en_i_1dly : std_logic;
257  signal FIFO_wr_en_i_2dly : t_49_arr_1b;
258  signal FIFO_rd_en_i : t_49_arr_1b;
259 
260  signal BCN_FIFO_rd_en_i : std_logic;
261  signal en_error_valid_i : std_logic;
262  signal en_error_valid_1dly, en_error_valid_2dly, en_error_valid_3dly : std_logic;
263  signal en_error_valid_4dly : std_logic;
264 
265  signal link_err_FIFO_empty_i : std_logic;
266  signal BCN_FIFO_full_i : std_logic;
267  signal BCN_FIFO_empty_i : std_logic;
268  signal BCN_FIFO_valid_i : std_logic;
269  signal BCN_FIFO_prog_full_i : std_logic;
270  signal BCN_FIFO_Data_in_i : std_logic_vector(46 downto 0);
271  signal BCN_FIFO_Data_out_i : std_logic_vector(46 downto 0);
272 
273  signal BCN_FIFO_pFULL_THRESH_assert_i : std_logic_vector(8 downto 0);
274  signal BCN_FIFO_pFULL_THRESH_negate_i : std_logic_vector(8 downto 0);
275 
276  signal Link_output_FIFO_RAW_pfull_thresh_assert_i : std_logic_vector(12 downto 0);
277  signal Link_output_FIFO_RAW_pfull_thresh_negate_i : std_logic_vector(12 downto 0);
278 
279  signal RAW_data_FIFO_pFULL_THRESH_assert_i : std_logic_vector(8 downto 0);
280  signal RAW_data_FIFO_pFULL_THRESH_negate_i : std_logic_vector(8 downto 0);
281  signal RAW_data_FIFO_count_i : std_logic_vector(8 downto 0);
282  signal FIFO_RAW_Data_prog_full_i : std_logic_vector(48 downto 0);
283  signal FIFO_RAW_Data_full_i : std_logic; -- RAW FIFO full flag based on occupancy
284  signal FIFO_RAW_Data_empty_i : std_logic_vector(48 downto 0);
285  signal FIFO_RAW_Data_valid_i : t_49_arr_1b; -- 49 sync signals for 49 links
286  signal FIFO_RAW_Data_valid_i_1dly : t_49_arr_1b; -- 49 sync signals for 49 links
287  signal sync_280m_i : t_49_arr_1b; -- 49 sync signals for 49 links
288 
289  signal FIFO_RAW_Data_prog_full_tmp : std_logic;
290  signal FIFO_RAW_Data_empty_tmp : std_logic;
291 
292  signal frame_cntr_dec_en_i : std_logic;
293  signal frame_counter_dec_en_i : std_logic;
294  signal op_fifo_frame_count_i : std_logic_vector (11 downto 0); -- Frame counter
295  signal frame_cntr_en_i, frame_cntr_en_ii : std_logic;
296  signal RAW_out_valid_i, RAW_data_out_valid_i, RAW_out_valid_1dly : std_logic;
297  signal RAW_out_char_MGT_i : std_logic;
298  signal RAW_data_out_MGT_i : std_logic_vector(31 downto 0);
299  signal RAW_out_is_char_i, RAW_out_to_MGT_is_char_i, RAW_out_char_MGT_1dly : std_logic;
300  signal RAW_out_i, q_int, RAW_data_out_i, RAW_data_out_1dly : std_logic_vector(31 downto 0);
301 
302  signal FIFO_RAW_in_i : std_logic_vector(32 downto 0);
303 
304  signal Link_output_FIFO_RAW_out_i : std_logic_vector (32 downto 0); -- TOBs 33b out to MGT
305  signal Link_output_FIFO_rd_en_i : std_logic;
306  signal Link_output_FIFO_RAW_valid_i : std_logic;
307 
308  signal Link_output_FIFO_full_i : std_logic;
309  signal Link_output_FIFO_empty_i : std_logic;
310  signal Link_output_FIFO_prog_full_i : std_logic;
311 
312  signal reg1, reg2 : std_logic := '0';
313  signal RAW_safe_mode_i : std_logic;
314  signal RAW_busy_assert_i : std_logic;
316  signal RAW_ready_in_i : std_logic;
317 
318  signal enable_raw_spy_mem_wr : std_logic;
319  signal SPY_mem_wr_addr_i : std_logic_vector (10 downto 0);
320  signal SPY_mem_wr_addr_en_i : std_logic;
321  signal SPY_mem_rd_data_i : std_logic_vector (35 downto 0);
322  signal RAW_data_FIFO_flags_i : std_logic_vector (31 downto 0);
323  signal delayed_crc_error_i : std_logic_vector (48 downto 0);
324  signal busy_raw_i : std_logic; -- raw data busy
325  signal SPY_mem_wr_addr_tc_i : std_logic; -- spy ram address terminal count
326 
327  -- this is the array of 49 x 32b
328  type DPRAM_addr_1b_type is array ((chan_no - 1) downto 0) of std_logic_vector (0 downto 0);
329  type RAW_fifo_d_count_type is array ((chan_no - 1) downto 0) of std_logic_vector (8 downto 0);
330  signal data_count_i : RAW_fifo_d_count_type;
331 
332  signal LO_FIFO_RAW_rd_data_count_i : std_logic_vector (12 downto 0); -- occupancy of RAW output link MGT FIFO - rd
333  signal LO_FIFO_RAW_wr_data_count_i : std_logic_vector (12 downto 0); -- occupancy of RAW output link MGT FIFO - wr
334  signal RAW_data_in_1dly : RAW_data_227_type; -- array 49 x 227b input frames
335  signal raw_data_dpram_fsm_i, raw_data_mux_fsm_i, raw_data_mgt_fsm_i : std_logic_vector (7 downto 0);
336 
337 -- ####### Attributes ########
338  attribute mark_debug : string;
339  attribute keep : string;
340  attribute max_fanout : integer;
341 
342  attribute keep of RAW_out_valid_i : signal is "true";
343  attribute max_fanout of RAW_out_valid_i : signal is 100;
344 
345  attribute keep of FIFO_RAW_in_i : signal is "true";
346 
347  attribute keep of RAW_FIFO_sw_rst_i : signal is "true";
348  attribute max_fanout of RAW_FIFO_sw_rst_i : signal is 100;
349 
350  attribute keep of FIFO_wr_en_i_2dly : signal is "true";
351  attribute max_fanout of FIFO_wr_en_i_2dly : signal is 30;
352 
353  attribute keep of FIFO_rd_en_i : signal is "true";
354  attribute max_fanout of FIFO_rd_en_i : signal is 30;
355 
356  attribute keep of FIFO_wr_en_i : signal is "true";
357  attribute max_fanout of FIFO_wr_en_i : signal is 30;
358 
359  attribute keep of SPY_mem_wr_addr_en_i : signal is "true";
360  attribute max_fanout of SPY_mem_wr_addr_en_i : signal is 30;
361 
362  attribute keep of BCN_FIFO_empty_i : signal is "true";
363  attribute max_fanout of BCN_FIFO_empty_i : signal is 30;
364  attribute keep of Link_output_FIFO_prog_full_i : signal is "true";
365  attribute max_fanout of Link_output_FIFO_prog_full_i : signal is 30;
366  attribute keep of FIFO_RAW_Data_prog_full_i : signal is "true";
367  attribute max_fanout of FIFO_RAW_Data_prog_full_i : signal is 30;
368 
369  attribute keep of DPR_wr_addr_i_1dly : signal is "true";
370  attribute max_fanout of DPR_wr_addr_i_1dly : signal is 30;
371 
372  attribute keep of RAW_data_out_1dly : signal is "true";
373  attribute keep of RAW_out_valid_1dly : signal is "true";
374  attribute keep of RAW_data_out_MGT_i : signal is "true";
375  attribute keep of RAW_out_char_MGT_i : signal is "true";
376  attribute keep of RAW_data_out_i : signal is "true";
377  attribute keep of RAW_data_out_valid_i : signal is "true";
378  attribute keep of BCN_FIFO_Data_in_i : signal is "true";
379  attribute keep of RAW_data_in : signal is "true";
380  attribute keep of RAW_data_in_1dly : signal is "true";
381  attribute keep of PISO_data_out_i : signal is "true";
382  attribute keep of FIFO_RAW_Data_dout_i : signal is "true";
383  attribute keep of delayed_crc_error_i : signal is "true";
384 -- #######################################
385 
386 begin
387 
388  clk_in_280M_i <= clk_280M_in;
389 
390  L1A_in_i <= L1A_in;
391  RST_i <= RST; -- from 40MHz MMCM lock signal
392 
393  RAW_FIFO_sw_rst_i <= RST_i or RAW_FIFO_sw_rst; -- rst by s/w or RST
394  RAW_data_FIFO_pFULL_THRESH_assert_i <= RAW_FIFO_pFULL_THRESH_ASSERT;
395  RAW_data_FIFO_pFULL_THRESH_negate_i <= RAW_FIFO_pFULL_THRESH_NEGATE;
396  BCN_FIFO_pFULL_THRESH_assert_i <= BCN_FIFO_pFULL_THRESH_assert;
397  BCN_FIFO_pFULL_THRESH_negate_i <= BCN_FIFO_pFULL_THRESH_negate;
398  Link_output_FIFO_RAW_pfull_thresh_assert_i <= Link_output_FIFO_RAW_pfull_thresh_assert;
399  Link_output_FIFO_RAW_pfull_thresh_negate_i <= Link_output_FIFO_RAW_pfull_thresh_negate;
400 
401  frame_count <= X"00000" & op_fifo_frame_count_i;
402  SPY_mem_wr_addr <= SPY_mem_wr_addr_i;
403 
404  RAW_data_out <= RAW_data_out_MGT_i; -- RAW event to MGT
405  RAW_out_to_MGT_is_char <= RAW_out_char_MGT_i; -- RAW data is char
406 
407  busy_raw <= busy_raw_i ;
408 
409  read_on_err_out <= req_err_rd_raw_i; -- flag requesting RAW data readout on error
410 
411  -- FIFO flags assignments
412  RAW_data_FIFO_flags <= RAW_data_FIFO_flags_i;
413 
414  RAW_data_FIFO_flags_i(0) <= FIFO_RAW_Data_empty_tmp;
415  RAW_data_FIFO_flags_i(1) <= FIFO_RAW_Data_prog_full_tmp;
416  RAW_data_FIFO_flags_i(2) <= FIFO_RAW_Data_full_i; -- use calculated full flag
417 
418  RAW_data_FIFO_flags_i(3) <= BCN_FIFO_empty_i;
419  RAW_data_FIFO_flags_i(4) <= BCN_FIFO_prog_full_i;
420  RAW_data_FIFO_flags_i(5) <= BCN_FIFO_full_i;
421 
422  RAW_data_FIFO_flags_i(6) <= Link_output_FIFO_empty_i;
423  RAW_data_FIFO_flags_i(7) <= Link_output_FIFO_prog_full_i;
424  RAW_data_FIFO_flags_i(8) <= Link_output_FIFO_full_i;
425 
426  RAW_data_FIFO_flags_i(9) <= RAW_safe_mode_i; -- Safe Mode operation flag for TOB readout
427  RAW_data_FIFO_flags_i(10) <= RAW_ready_in_i; -- Ready signal from control FPGA to receive RAW calorimeter data
428  RAW_data_FIFO_flags_i(11) <= busy_raw_i; -- BUSY signal from proc FPGA to stop L1A signal
429  RAW_data_FIFO_flags_i(31 downto 12) <= (others => '0');
430 
431  RAW_FIFO_data_count <= data_count_i(20); -- use a value in the middle of pFPGA for ease of use
432 
433  link_error_flags <= FIFO_error_flags_54b_i; -- error flags from the ERROR FLag FIFO
434 
435  raw_fsm_monitor <= X"00" & raw_data_mgt_fsm_i & raw_data_mux_fsm_i & raw_data_dpram_fsm_i ;
436 
437 U0_clk : process (clk_in_280M_i)
438  begin
439  if rising_edge (clk_in_280M_i) then
440  FIFO_RAW_Data_prog_full_tmp <= OR FIFO_RAW_Data_prog_full_i;
441  FIFO_RAW_Data_empty_tmp <= OR FIFO_RAW_Data_empty_i;
442  end if;
443  end process;
444 
445 -- this FDCE regitsters the cFPGA Ready input signal to receive RAW Data.
446  U0_FDCE_inst : FDCE
447  generic map (
448  INIT => '0') -- Initial value of register ('0' or '1')
449  port map (
450  Q => RAW_ready_in_i, -- Data output
451  C => clk_in_280M_i, -- Clock input
452  CE => '1', -- Clock enable input
453  CLR => '0',
454  D => RAW_ready_in -- Ready signal from control FPGA to receive RAW calorimeter data
455  );
456 
457 -- the FSM regitsters occupancy of RAW data FIFO to send RAW BUSY signal to cFPGA
458 U1_busy_flag_fsm : entity TOB_rdout_lib.busy_flag_fsm
459  generic map (
460  width => 9
461  )
462  port map (
463  clk => clk_in_280M_i,
464  rst => RAW_FIFO_sw_rst_i,
465  busy_flag_assert => raw_busy_thresh_assert,
466  busy_flag_negate => raw_busy_thresh_negate,
467  fifo_data_count => data_count_i(22), -- use fibre 22 to ease timing, may be different for different FPGAs
468  busy_flag => busy_raw_i
469  );
470 
471 -- The GEN_CHANNEL loop, generates 49 copies of the RAW data readout blocks within it,these are:
472 -- PISO unit - to convert data from 224b to 7 x 32b words
473 -- Dual Port RAM - scrolling memory to store data on every bunch crossing
474 -- This is circular Dual Port RAM. It stores 7x32b words per Bunch number.
475 -- the DPRAM is 36b wide, and bits 35 to 32 are used to store the 4b error flags for the corresponding MGT Channel.
476 -- The Read and Write address have the correct offset in order to read the actual RAW data
477 -- associated with the BCN at the time of arrival of L1A
478 -- Derandomisation FIFO - to store the correct data word upon receiving an L1A
479 -- This is Derandomisation FIFO. It stores 7x32b words per L1A, which are read out of Circular memory.
480 -- The FIFO is 36b wide, bits 35:32 are used to store the 4b error flags for the corresponding MGT Channel.
481 
482 GEN_CHANNEL : for i in 0 to chan_no-1 generate -- generate for 49 links (chan_no= 49)
483 
484 -- This module generates a synch signal synchronised to 40MHz and 280MHz clocks
485 -- one synch pulse is generated - this is 1 in 7 sync'ed to 40M clock
486  U1_gen_sync_280 : entity TOB_rdout_lib.gen_sync_280M
487  port map(
488  RST => RST_i, -- RST from 40MHz MMCM lock signal
489  clk_40M => clk_40M_rdout, -- Clock 40MHz
490  clk_280M => clk_in_280M_i,
491  sync_280m_out => sync_280m_i(i) -- this is 1 in 7 sync'ed to 40M clk
492  );
493 
494 -- Pipelines the input RAW data by one 40 MHz clock to move away from the real time circuit
495  proc1 : process (clk_40M_rdout)
496  begin
497  if rising_edge (clk_40M_rdout) then
498  RAW_data_in_1dly(i) <= RAW_data_in(i);
499 -- delayed_crc_error_i(i) <= RAW_data_in_1dly(i)(226) ;
500  end if;
501  end process;
502 
503 -- PISO unit - to convert data from 224b to 7 x 32b words
504  U2_PISO_RAW : entity TOB_rdout_lib.PISO_RAW_data -- convert 224b to 7 x 32b words for Circular DPR
505  port map (
506  RST => RAW_FIFO_sw_rst_i, -- rst by s/w or RST from 40MHz MMCM lock signal
507  RAW_link_data_in => RAW_data_in_1dly(i), -- 227b words for Circular DPR
508  data_sync_in => sync_280m_i(i), -- this is 1 in 7 sync'ed to 40M clk
509  clk_in_280M => clk_in_280M_i,
510  data_sync_out => PISO_sync_out_i(i),
511  data_out_valid => PISO_data_out_valid_i(i),
512  data_out => PISO_data_out_i(i) -- 7x36b RAW data to DPRAM + 4b error (use J)
513  );
514 
515 -- RAW Data Circular DPRAM input 36b = ORed 4-bit links error flags + 32-bit Raw Data
516  U3_DPRAM_RAW_Data : DPR_36b_1024 -- it is in the IP package
517  port map (
518  clka => clk_in_280M_i, -- runs at 200M but writes 1 in 5 clks
519  ena => '1', -- clk/rst en for DPRAM port A
520  wea => stdv(PISO_data_out_valid_i(i)), -- this is wr en using PISO_data_out_valid_i
521  addra => DPR_wr_addr_i_1dly, -- TD_LOGIC_VECTOR(8 DOWNTO 0)
522  dina => PISO_data_out_i(i), -- 7x32b RAW data from DPRAM into FIFO + 4b error
523  clkb => clk_in_280M_i,
524  enb => DRP_rd_en_i_1dly, -- clk/rst/addr en for DPRAM port B
525  addrb => DPR_rd_addr_i_1dly, --
526  doutb => DPR_RAW_out_i(i) -- 7x36b RAW data from DPRAM to FIFO array 49 of 36b = err + data to remove timing error
527  );
528 
529 -- RAW Data FIFO input 36b = ORed 4-bit links error flags + 32-bit Raw Data
530  U4_FIFO_RAW_Data : FIFO_36b_512 -- the flags from these 49 FIFOs are not used
531  port map ( -- if backpressure goes on we stop capturing data
532  srst => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
533  clk => clk_in_280M_i,
534  din => DPR_RAW_out_i_1dly(i), -- DPRAM register enabled
535  wr_en => FIFO_wr_en_i_2dly(i), -- i/p delayed version of FIFO_wr_en
536  rd_en => FIFO_rd_en_i(i),
537  dout => FIFO_RAW_Data_dout_i(i), -- array 49 of 36b = err + data
538  valid => FIFO_RAW_Data_valid_i(i), -- 49 sync signals for 49 links
539  prog_full_thresh_assert => RAW_data_FIFO_pFULL_THRESH_assert_i, -- 9b
540  prog_full_thresh_negate => RAW_data_FIFO_pFULL_THRESH_negate_i,
541  data_count => data_count_i(i),
542  prog_full => FIFO_RAW_Data_prog_full_i(i),
543  full => open,
544  empty => FIFO_RAW_Data_empty_i(i)
545  );
546 
547 -- AS there are too much path delay between DPRAM and FIFO untis on some input channels,
548 -- a register has been added to allow for the path delay, and remove timing error.
549  U5_1_clk : process (clk_in_280M_i)
550  begin
551  if rising_edge (clk_in_280M_i) then
552  -- register signals to meet timing
553  FIFO_RAW_Data_dout_i_1dly(i) <= FIFO_RAW_Data_dout_i(i); -- register the array 49 of 36b = err + data to remove timing error
554  FIFO_RAW_Data_valid_i_1dly(i) <= FIFO_RAW_Data_valid_i(i); -- register the 49 sync signals for 49 links
555 
556  DPR_RAW_out_i_1dly(i) <= DPR_RAW_out_i(i); -- register the array 49 of 36b = err + data to remove timing error
557  link_error_flags_tmp(i) <= DPR_RAW_out_i_1dly(i)(35 downto 32); -- array of 4 ERROR bits for each MGT input link
558 
559  FIFO_wr_en_i_2dly(i) <= FIFO_wr_en_i_1dly and (not(FIFO_RAW_Data_prog_full_i(i)));
560 
561  end if;
562  end process;
563 
564  end generate GEN_CHANNEL;
565 
566 
567 -- OR all the input error flags together to create the 4-bit error signal to be added to the event
568 -- Also check the 4-bit error flag to create 1-b flag to request data on error
569  U5_link_err : entity TOB_rdout_lib.link_errors_ORed
570  generic map
571  (N => 49)
572  port map
573  (clk_in => clk_in_280M_i,
574  rst_in => RAW_FIFO_sw_rst_i,
575  err_flag_in => link_error_flags_tmp, -- array of 4 ERROR bits for each MGT input (zero + input_crc + input_disparity + not_in_table)
576  en_error_valid_in => en_error_valid_3dly, -- Enable capture of error flags from last RAW input data
577  err_flag_out => link_err_4b_in_i, -- 4-bit link error ouput to RAW readout (zero + input_crc + input_disparity + not_in_table)
578  channel_error_map => channel_error_49b_i, -- 49-bit channel error map to input into RAW readout
579  req_err_rd_raw => req_err_rd_raw_i -- flag requesting RAW data readout on error
580  );
581 
582 
583 -- this FDCE regitsters the L1A_in signal to act as write signal for Link Errors FIFO
584  U5_FDCE_inst : FDCE
585  generic map (
586  INIT => '0') -- Initial value of register ('0' or '1')
587  port map (
588  Q => L1A_in_1dly, -- Data output
589  C => clk_40M_rdout, -- Clock input
590  CE => '1', -- Clock enable input
591  CLR => '0', -- async rst by s/w or RST from 40MHz MMCM lock signal
592  D => L1A_in_i -- Data input
593  );
594 
595  -- input to Link Error FIFO = requesting RAW data readout + ORed 4-bit link error + 49-bit channel error map
596  -- (errors = zero + input_crc + input_disparity + not_in_table)
597  link_error_flags_54b_i <= req_err_rd_raw_i & link_err_4b_in_i & channel_error_49b_i;
598 
599 -- This modules is the Link Errors FIFO..
600 -- It stores the following information for use in the construction of RAW Events:
601 -- Link Error FIFO input 54b = 1-bit RAW data readout on error + ORed 4-bit links error flags + 49-bit channel error map.
602  U5_FIFO_link_err : FIFO_54b_512
603  port map (
604  rst => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
605  wr_clk => clk_in_280M_i,
606  rd_clk => clk_in_280M_i,
607  din => link_error_flags_54b_i,
608  wr_en => en_error_valid_4dly,
609  rd_en => BCN_FIFO_rd_en_i,
610  dout => FIFO_error_flags_54b_i,
611  valid => FIFO_error_flags_valid_i,
612  full => open,
613  empty => link_err_FIFO_empty_i
614  );
615 
616 -- This FSM is responsible for transfering the correct RAW data values from the Circular DPRAMs to de-randomisation FIFOs.
617 -- The control signals ensure all 49 DPRAMs are read and written to 49 FIFOs in parallel.
618 -- The write address offset for SPRAM ensures the data associated with required BCN is read out.
619 -- When the prog_FULL flag of de-randomisation FIFO is set to 1, no more data is written to this FIFO
620  U5_RAW_fsm : entity TOB_rdout_lib.fsm_RAW_data_wr_to_DPR
621  port map (
622  CLK_280M => clk_in_280M_i,
623  RST => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
624  L1A_in => L1A_in_i,
626  DPR_rd_addr => DPR_rd_addr_i,
627  DPR_wr_addr => DPR_wr_addr_i,
628  DRP_rd_en => DRP_rd_en_i,
629  FIFO_wr_en => FIFO_wr_en_i, -- o/p
630  en_error_valid => en_error_valid_i, -- o/p Enable capture of error flags from last RAW word
631  raw_data_dpram_fsm => raw_data_dpram_fsm_i
632  );
633 
634 -- Module gen_full_flag monitors the occupancy level of one de-randomisation FIFO for channel 20.
635 -- Channel 20 has been chosen in order to be in the middle of the FPGA, but any other channel can be selected.
636 -- The programmable Assert and Negate registers control the occupancy levels at which the FULL Flag is asserted and negated.
637  U5b_gen_full_flag : entity TOB_rdout_lib.RAW_fifo_full_flag_gen
638  port map (
639  rst_in => RAW_FIFO_sw_rst_i,
640  clk_in => clk_in_280M_i,
641  fifo_data_count => data_count_i(20), -- use 20 to be in the middle of pFPGA
644  full_flag_out => FIFO_RAW_Data_full_i
645  );
646 
647 -- pipeline registers to meet timing
648  U5c_1_clk : process (clk_in_280M_i)
649  begin
650  if rising_edge (clk_in_280M_i) then
651  DPR_rd_addr_i_1dly <= DPR_rd_addr_i;
652  DPR_wr_addr_i_1dly <= DPR_wr_addr_i;
653  DRP_rd_en_i_1dly <= DRP_rd_en_i;
654  FIFO_wr_en_i_1dly <= FIFO_wr_en_i; -- register wr signals for 49 links
655 
656  en_error_valid_1dly <= en_error_valid_i; -- delay error flags valid by 1 clk
657  en_error_valid_2dly <= en_error_valid_1dly; -- delay error flags valid by 1 clk
658  en_error_valid_3dly <= en_error_valid_2dly; -- delay error flags valid by 1 clk
659  en_error_valid_4dly <= en_error_valid_3dly; -- delay error flags valid by 1 clk
660  end if;
661  end process;
662 
663  -- write L1A number and BC number into FIFO
664  -- 1b FIFO_RAW_Data_prog_full_i + 0 + 1b Privilege Read + 12b BCN_ID_in + 8b ECID + 24b L1A_ID_in
665  BCN_FIFO_Data_in_i <= FIFO_RAW_Data_prog_full_tmp & '0' & TTC_read_all_in & BCN_ID_in & L1A_ID_in;
666 
667 -- This is TTC FIFO for RAW Data Readout, which stores the following values:.
668 -- bit 46 = Safe Mode bit set by TTC FIFO full flag.
669 -- bit 45 = not used
670 -- bit 44 = privilege read flag
671 -- bits 43:32 = Bunch Crossing Number - generated in pFPGA
672 -- bits 31:24 = Extended L1A - received from CFPGA
673 -- bits 23:0 = L1A_ID - received from cFPGA
674  U6_FIFO_BCN_L1A : FIFO_47b_512 -- the flags from this FIFO is used
675  port map (
676  rst => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
677  wr_clk => clk_40M_rdout,
678  rd_clk => clk_in_280M_i,
679  din => BCN_FIFO_Data_in_i,
680  wr_en => L1A_in_i,
681  rd_en => BCN_FIFO_rd_en_i,
682  dout => BCN_FIFO_Data_out_i,
683  valid => BCN_FIFO_valid_i,
684  rd_data_count => BCN_FIFO_RAW_rd_data_count,
685  prog_full_thresh_assert => BCN_FIFO_pFULL_THRESH_assert_i,
686  prog_full_thresh_negate => BCN_FIFO_pFULL_THRESH_negate_i,
687  prog_full => BCN_FIFO_prog_full_i,
688  full => BCN_FIFO_full_i,
689  empty => BCN_FIFO_empty_i
690  );
691 
692 -- This is FSM to read RAW data from de-randomisation FIFOs and write into link output FIFO.
693 -- This FSM also handles Header and Trailer construction.
694 --
695 -- Under normal operation mode, only MGT channels with error flag set, are added to the RAW data event frame.
696 -- If there are no errors, then an event is generated with 2 header and 1 trailer words, and the payload is two 32-b words
697 -- containing the error flags of all 49 MGT channels.
698 --
699 -- If Privilege Read flag or Read_RAW_all flag is set, then the RAW data for all MGT channels are added to the RAW data event frame.
700 -- Read_RAW_all flag is bit 1 of Test_Contol_Reg register.
701 --
702 -- Under Safe Mode Operation, the occupancy of TTC FIFO are monitored.
703 -- If the occupancy reaches a programmable threshold, empty events are generated which consits of 2 header and 1 trailer words.
704 --
705 -- The output of this FSM is:
706 -- 32-bit data word
707 -- 1-bit data is CHAR
708 -- 1-bit valid which is the write enable to Link Ouput FIFO
709  U7_rd_RAW_mux_fsm : entity TOB_rdout_lib.fsm_RAW_to_muxPISO
710  port map (
711  RST => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
712  hw_addr => hw_addr,
713  rdout_RAW_36b_in => FIFO_RAW_Data_dout_i_1dly, -- raw data output of fifo -- array 49 of 36b = err + data
714  valid_RAW_in => FIFO_RAW_Data_valid_i_1dly, -- RAW data is valid -- 49 sync signals for 49 links
715  bcn_fifo_47b_in => BCN_FIFO_Data_out_i, -- BCN & L1A output of fifo
716  valid_BCN_in => BCN_FIFO_valid_i, -- BCN & L1A data is valid
717  FIFO_error_flags_54b => FIFO_error_flags_54b_i, -- 1-b request RAW data readout + ORed 4-bit link error + 49-bit channel error map
718  clk_280M_in => clk_in_280M_i,
719  RAW_FIFO_prog_full_in => FIFO_RAW_Data_prog_full_tmp, -- i/p derandomisation FIFO prog full flag channel 19
720  LO_FIFO_prog_full_in => Link_output_FIFO_prog_full_i, -- if link o/p FIFO pFULL discard i/p data
721  LO_FIFO_data_count_in => LO_FIFO_RAW_wr_data_count_i, -- link o/p FIFO wr data count
722  frame_cntr_en => frame_cntr_en_i, -- enable frame counter count up
723  raw_rd_all_in => raw_rd_all_in, -- readout all raw data links
724  RAW_rdout_fifo_rd_en_out => FIFO_rd_en_i, -- rd enable to RAW FIFOs
725  BCN_fifo_rd_en_out => BCN_FIFO_rd_en_i, -- rd enable to RAW data BCN FIFOs
726  mgt_enable_in => mgt_enable_in, -- MGT enable signals - use to enable/disable readout on error
727  BCN_FIFO_empty => BCN_FIFO_empty_i, -- input BCN L1A_ID FIFO empty flag
728  BCN_FIFO_prog_full_in => BCN_FIFO_prog_full_i, -- i/p BCN_L1A FIFO prog full flag
729  link_err_FIFO_empty => link_err_FIFO_empty_i, -- input link error FIFO empty flag
730  RAW_out_valid => RAW_out_valid_i, -- sorted TOBs data valid to U7_Link_output_FIFO
731  RAW_out_is_char => RAW_out_is_char_i, -- sorted TOBs is CHAR to U7_Link_output_FIFO
732  RAW_out => RAW_out_i, -- sorted TOBs valid to U7_Link_output_FIFO
733  RAW_safe_mode_out => RAW_safe_mode_i, -- Safe Mode operation flag for EAW readout
734  raw_data_mux_fsm => raw_data_mux_fsm_i
735  );
736 
737 
738  FIFO_RAW_in_i <= RAW_out_is_char_i & RAW_out_i; -- 1b char and 32b data
739 
740 -- This is RAW Link Output FIFO, which stores complete RAW events (frames) ready to be transmitted to cFPGA via an MGT link at 11.2Gbps.
741 -- The output of FIFO is 32-bit data word, and 1-bit data is CHAR, which goes directly to MGT under FSM control.
742 --
743 -- The Frames are only transmitted when cFPGA indicates it is ready to receive data by setting ctrl_RAW_ready signal to 1.
744 -- If ctrl_RAW_ready signal is set to 0 by cFPGA, this indicates cFPGA is not ready to receive data,
745 -- in this case events accumulate in Link Output FIFO until occupancy reaches a pre-define level of prog_FULL,
746 -- at this time, Link Output FIFO stops receiving data.
747 --
748 -- Writing to LO FIFO is controlled by fsm_RAW_to_muxPISO FSM
749 -- Reading from LO FIFO is controlled by FIFO_to_MGT_RAW_FSM FSM
750  U8_RAW_Link_output_FIFO : FIFO_33b_8192
751  port map (
752  wr_rst => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
753  wr_clk => clk_in_280M_i,
754  wr_en => RAW_out_valid_i,
755  din => FIFO_RAW_in_i,
756  rd_rst => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
757  rd_clk => RAW_TXOUTCLK,
758  rd_en => Link_output_FIFO_rd_en_i,
759  dout => Link_output_FIFO_RAW_out_i,
760  full => Link_output_FIFO_full_i,
761  empty => Link_output_FIFO_empty_i,
762  prog_full => Link_output_FIFO_prog_full_i,
763  valid => Link_output_FIFO_RAW_valid_i,
764  prog_full_thresh_assert => Link_output_FIFO_RAW_pfull_thresh_assert_i, -- 13b
765  prog_full_thresh_negate => Link_output_FIFO_RAW_pfull_thresh_negate_i, -- 13b
766  wr_data_count => LO_FIFO_RAW_wr_data_count_i,
767  rd_data_count => LO_FIFO_RAW_rd_data_count_i -- 13b occupancy of Link_output_FIFO_RAW link MGT FIFO
768  );
769 
770  Link_output_FIFO_RAW_rd_data_count <= LO_FIFO_RAW_rd_data_count_i;
771 
772 -- This FSM reads RAW frames from Link Output FIFO and writes into MGT to transmit to cFPGA.
773 -- This FSM handles one full frame at a time without pausing.
774 -- It monitors the RAW_frame_counter to find out if there are Frames waiting to be transmitted to cFPGA.
775 -- The Frames are only transmitted when cFPGA indicates it is ready to receive data by setting ctrl_RAW_ready signal to 1.
776 -- If ctrl_RAW_ready signal is set to 0 by cFPGA, this indicates cFPGA is not ready to receive data,
777 -- in this case events accumulate in Link Output FIFO until occupancy reaches a pre-define prog_FULL level,
778 -- at this time, Link Output FIFO stops receiving data.
779  U9_RAW_Link_output_FIFO_FSM : entity TOB_rdout_lib.FIFO_to_MGT_RAW_FSM
780  port map (
781  TOB_FIFO_sw_rst => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
782  clk_in_280M => RAW_TXOUTCLK,
784  frame_counter => op_fifo_frame_count_i,
785  FIFO_MGT_TOBs => Link_output_FIFO_RAW_out_i,
786  FIFO_MGT_TOB_valid => Link_output_FIFO_RAW_valid_i,
787  LO_FIFO_empty => Link_output_FIFO_empty_i, -- on rd clck
788  FIFO_MGT_rd_en => Link_output_FIFO_rd_en_i, -- output
789  frame_counter_dec_en => frame_cntr_dec_en_i,
790  RAW_data_out => RAW_data_out_i, -- RAW event to MGT
791  RAW_data_is_char => RAW_out_to_MGT_is_char_i, -- RAW data is char
792  RAW_data_out_valid => RAW_data_out_valid_i,
793  raw_data_mgt_fsm => raw_data_mgt_fsm_i
794  );
795 
796 -- If the counter is ZERO, no data is available to be send to cFPGA.
797 
798 U10_clk_closs_pulse : entity TOB_rdout_lib.clk_closs_pulse_fsm
799  Port map (
800  clk_src => clk_in_280M_i ,
801  rst_src => RAW_FIFO_sw_rst_i , -- RST OR TOB_FIFO_sw_rst
802  pulse_src => frame_cntr_en_i,
803  clk_dest => RAW_TXOUTCLK ,
804  pulse_dest => frame_cntr_en_ii
805  );
806 
807 -- The RAW_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.
808 -- When one complete Frame (event) is written to LO FIFO, this counter is incremented.
809 -- When one complete Frame (event) is read out LO FIFO, this counter is decremented.
810 -- If the counter is ZERO, no data is available to be send to cFPGA.
811 
812  U10_RAW_frame_counter : entity TOB_rdout_lib.cntr_up_dn_generic
813  generic map (
814  width => 12 -- count up to 4096 events in Link Output FIFO
815  )
816  port map (
817  CE => '1',
818  CLK => RAW_TXOUTCLK,
819  RST => RAW_FIFO_sw_rst_i, -- sys RST OR RAW_FIFO_sw_rst
820  UP => frame_cntr_en_ii, -- this is a fabric 280 MHz signal
821  DOWN => frame_cntr_dec_en_i, -- this is a TXOUTCLK 280 MHz signal
822  Q => op_fifo_frame_count_i
823  );
824 
825 -- delay data to SPY RAM
826  U11_clk_proc : process (RAW_TXOUTCLK)
827  begin
828  if RAW_TXOUTCLK'event and RAW_TXOUTCLK = '1' then
829  RAW_data_out_1dly <= RAW_data_out_i; -- data SPY RAM
830  RAW_data_out_MGT_i <= RAW_data_out_1dly; -- data to MGT
831  RAW_out_char_MGT_1dly <= RAW_out_to_MGT_is_char_i;
832  RAW_out_char_MGT_i <= RAW_out_char_MGT_1dly;
833  RAW_out_valid_1dly <= RAW_data_out_valid_i;
834  end if;
835  end process;
836 
837 -- SPY_FIFO_RAW_in_i <= "000" & Link_output_FIFO_RAW_out_i ;
838  SPY_mem_wr_addr_en_i <= (RAW_out_valid_1dly and enable_raw_spy_mem_wr);
839 
840 -- The RAW_SPY_mem is a Dual Port Memory with IPBus interface.
841 -- It is possible to read/write to/from DPRAM using the IPBus interface.
842 -- The SPY Memory captures the data that is read out of Link Output FIFO to MGT.
843 -- The SPY Memory is designed to fill up and then stops accepting new data,
844 -- therefore the old data is not written over.
845 
846  U12_RAW_SPY_mem : entity ipbus_lib.ipbus_dpram
847  generic map(
848  ADDR_WIDTH => 11 -- DPRAM 512 locations
849  )
850  port map(
851  clk => ipb_clk,
852  rst => RST_spy_mem_wr_addr, -- was '0',
853  ipb_in => ipbus_in_raw_dpram, -- i/p signal going to RAW SPY DPRAM
854  ipb_out => ipbus_out_raw_dpram, -- o/p signal coming from RAW SPY DPRAM
855  rclk => RAW_TXOUTCLK,
856  we => SPY_mem_wr_addr_en_i, -- wr addr en
857  d => RAW_data_out_1dly, -- wr data
858  q => q_int,
859  addr => SPY_mem_wr_addr_i -- wr addr
860  );
861 
862 -- The spy_mem_wr_addr is a generic counter that provides the write address to RAW SPY Memory.
863 -- The spy memory address is 11-bits wide, so the depth of memory is 2048.
864 -- This implies the RAW Spy Memory can hold just over 5 Full RAW Frames.
865 -- The write address of the RAW_SPY_mem is reset to ZERO by asserting RST_spy_mem_wr_addr or system RST signals.
866 -- The signal RST_spy_mem_wr_addr is bit 5 of register rdout_pulse_reg.
867 -- The rdout_pulse_reg register is pulsed, and after 1 clock cycle all bits are reset to Zeros.
868 
869  U13_spy_mem_wr_addr : entity TOB_rdout_lib.cntr_generic
870  generic map (
871  width => 11
872  )
873  port map (
874  CE => SPY_mem_wr_addr_en_i, -- if a valid data, then increment the address
875  CLK => RAW_TXOUTCLK,
877  Q => SPY_mem_wr_addr_i
878  );
879 
880 -- Process U14_stop_wr disables the write enable signal to Spy Memory when it is full.
881 
882  U14_stop_wr : process (RAW_TXOUTCLK)
883  begin
884  if rising_edge (RAW_TXOUTCLK) then
885  if (RST_spy_mem_wr_addr = '1') then
886  enable_raw_spy_mem_wr <= '1'; -- if not full, en data wr
887  else
888  if SPY_mem_wr_addr_i = "11111111111" then -- if terminal count -1 to prevent wrap round to ZERO
889  enable_raw_spy_mem_wr <= '0'; -- disable memory wr to prevent data corruption
890  end if;
891  end if;
892  end if;
893  end process U14_stop_wr;
894 
895 
896 end RTL;
FSM to read RAW Event data from Link Output FIFO to MGT for process FPGA.
out RAW_data_out STD_LOGIC_VECTOR( 31 downto 0)
32b RAW to connect to output MGT to control FPGA
in frame_counter STD_LOGIC_VECTOR( 11 downto 0)
Frame counter register.
in FIFO_MGT_TOBs STD_LOGIC_VECTOR( 32 downto 0)
RAW from Link Output FIFO.
out FIFO_MGT_rd_en STD_LOGIC
Read enalbe singal to Link Output FIFO.
out raw_data_mgt_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
in LO_FIFO_empty std_logic
Link Output FIFO Empty Flag.
out RAW_data_is_char STD_LOGIC
RAW is CHAR to connect to output MGT to control FPGA.
out RAW_data_out_valid STD_LOGIC
RAW is valid signal to wr to SPY memory.
out frame_counter_dec_en STD_LOGIC
Decrement Frame Counter.
in RAW_ready_in std_logic
Ready signal from control FPGA to receive RAW data from process FPGA.
in TOB_FIFO_sw_rst std_logic
TOB Readout FIFO reset Pulse by software command ORed with SYS_RST.
in FIFO_MGT_TOB_valid STD_LOGIC
RAW from Link Output FIFO valid signal.
Calorimeter data PISO for process FPGA.
in data_sync_in STD_LOGIC
calorimeter data valid/synch signal
in RAW_link_data_in STD_LOGIC_VECTOR( 226 downto 0)
calorimeter data array 49 x 227b input frames
out data_out_valid STD_LOGIC
calorimeter data valid signal out
out data_sync_out STD_LOGIC
calorimeter data synch signal out
in clk_in_280M STD_LOGIC
280MHz clock input signal
out data_out STD_LOGIC_VECTOR( 35 downto 0)
calorimeter Error & Data out 36b
RAW Calorimeter Data Readout Logic for process FPGA.
integer := 49 chan_no
number of input fibres
std_logic RAW_ready_in_i
Control FPGA Ready signal internal.
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
Generate Full Flag for RAW data de-randomisation FIFO.
out full_flag_out STD_LOGIC
Full Flag for RAW input FIFO.
in negate_count_in STD_LOGIC_VECTOR( 8 downto 0)
negate count input to set Full Flag
in assert_count_in STD_LOGIC_VECTOR( 8 downto 0)
assert count input to set Full Flag
in fifo_data_count STD_LOGIC_VECTOR( 8 downto 0)
RAW FIFO data count input.
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.
Transfer calorimeter data from Circular DPRAM to de-randomisation FIFO.
out DPR_wr_addr STD_LOGIC_VECTOR( 9 downto 0)
DPRAM write address.
out DPR_rd_addr STD_LOGIC_VECTOR( 9 downto 0)
DPRAM read address.
out DRP_rd_en STD_LOGIC
DPRAM read enable.
out FIFO_wr_en STD_LOGIC
FIFO write enable.
in L1A_in STD_LOGIC
TTC L1A input.
out raw_data_dpram_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
out en_error_valid STD_LOGIC
Enable capture of error flags from last RAW word.
in pre_ld_wr_addr STD_LOGIC_VECTOR( 9 downto 0)
latency offset for DPRAM wr address
in RST STD_LOGIC
Reset input.
in CLK_280M STD_LOGIC
Clock 280 MHz.
FSM to write RAW calolimeter data to Link Output FIFO for process FPGA.
out raw_data_mux_fsm STD_LOGIC_VECTOR( 7 downto 0)
Monitor state machine status register.
out RAW_rdout_fifo_rd_en_out t_49_arr_1b
read enable signal to all RAW data FIFOs
in raw_rd_all_in STD_LOGIC
readout all raw data links
in bcn_fifo_47b_in STD_LOGIC_VECTOR( 46 downto 0)
BCN fifo data 47b = 1b FIFO_RAW_Data_prog_full_i + 0 + 1b Privilege Read + 12b BCN_ID_in + 32b L1A_ID...
in BCN_FIFO_prog_full_in STD_LOGIC
BCN & L1A FIFO prog full flag.
in FIFO_error_flags_54b STD_LOGIC_VECTOR( 53 downto 0)
Link Error FIFO = ZERO + 1-b request RAW data on error + ORed 3-bit link error + 49-bit channel error...
out BCN_fifo_rd_en_out STD_LOGIC
read enable signal to BCN & L1A FIFOs
in BCN_FIFO_empty STD_LOGIC
FIFO empty flag from BCN L1A FIFO.
out RAW_safe_mode_out STD_LOGIC
Safe Mode operation flag for RAW readout.
in mgt_enable_in STD_LOGIC_VECTOR( 48 downto 0)
MGT enable signals - use to enable readout on error.
in LO_FIFO_data_count_in STD_LOGIC_VECTOR( 12 downto 0)
Link Output FIFO data count.
out RAW_out_valid STD_LOGIC
RAW data valid signal to Link_outpout_FIFO.
in valid_RAW_in t_49_arr_1b
RAW data valid signal.
in RAW_FIFO_prog_full_in std_logic
RAW Input FIFO partial FULL flag.
in link_err_FIFO_empty STD_LOGIC
FIFO empty flag from link error FIFO.
in valid_BCN_in std_logic
RAW data valid signal.
in rdout_RAW_36b_in DPR_RAW_out_36_type
raw data 36b = 4b+32b ERR+RAW
in hw_addr STD_LOGIC_VECTOR( 1 downto 0)
FPGA Hardware Address.
in LO_FIFO_prog_full_in std_logic
Link Output FIFO partial FULL flag to receive RAW calorimeter data.
out RAW_out STD_LOGIC_VECTOR( 31 downto 0)
RAW data 32b to Link_outpout_FIFO.
out RAW_out_is_char STD_LOGIC
RAW data is CHAR signal to Link_outpout_FIFO.
out frame_cntr_en STD_LOGIC
Comp;leted frame counter enable.
in clk_280M_in STD_LOGIC
fabric 280MHz clock
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.