34 USE ieee.std_logic_1164.
all;
35 use ieee.numeric_std.
all;
38 USE ipbus_lib.ipbus.
all;
39 LIBRARY infrastructure_lib;
45 NProcessorFPGA: positive := 4;
46 TOB_FIFO_ADDR_WIDTH: positive := 12;
47 MERGED_FIFO_ADDR_WIDTH: positive := 11;
48 RAW_FIFO_ADDR_WIDTH: positive := 11;
49 TOB_SPY_ADDR_WIDTH: positive := 11;
50 RAW_SPY_ADDR_WIDTH: positive := 11;
51 MERGER_SPY_ADDR_WIDTH: positive := 10;
52 AURORA_SPY_ADDR_WIDTH: positive := 12;
53 MAX_BUILT_PACKET_WIDTH: positive := 8
58 clk_mgt_bus : in std_logic_vector(NProcessorFPGA*2 - 1 downto 0);
59 clk_320 : in std_logic;
60 clk_ipb : in std_logic;
61 rst_320 : in std_logic;
62 rst_ipb : in std_logic;
64 eFEX_number : in std_logic_vector(7 downto 0);
67 ipb_out : out ipb_rbus;
69 bcr_40 : in std_logic;
70 ecr_40 : in std_logic;
71 rst_ttc : in std_logic;
72 ttc_wr_en : in std_logic;
73 ttc_rd_en : in std_logic;
74 ttc_din : in std_logic_vector(49 DOWNTO 0);
76 l1a_enable : in std_logic;
77 source_enable : in std_logic_vector(NProcessorFPGA*2 - 1 downto 0) := (Others => '0');
78 tob_destination_enable : in std_logic_vector(1 downto 0) := (Others => '0');
79 raw_destination_enable : in std_logic_vector(1 downto 0) := (Others => '0');
81 data_from_mgt_bus : in mgt_data_array(NProcessorFPGA*2 - 1 downto 0);
82 char_is_k_bus : in std_logic_vector(NProcessorFPGA*2 - 1 downto 0);
83 error_from_mgt_bus : in std_logic_vector(NProcessorFPGA*2 - 1 downto 0);
85 payload_data_bus : out packet_data_array(1 downto 0);
86 payload_valid_bus : out std_logic_vector(1 downto 0);
87 payload_last_bus : out std_logic_vector(1 downto 0);
88 tready_data_bus : in std_logic_vector(1 downto 0);
89 packet_mux_source : OUT std_logic_vector(7 downto 0);
91 tob_xoff_bus : in std_logic_vector(1 downto 0);
92 raw_xoff_bus : in std_logic_vector(1 downto 0);
93 mgt_xoff_bus : out std_logic_vector(NProcessorFPGA*2 - 1 downto 0);
94 busy_bus : out std_logic_vector(NProcessorFPGA*2 - 1 downto 0)
104 rst_clk :
in std_logic;
107 packet_valid :
IN std_logic;
108 packet_last :
IN std_logic;
109 packet_ready :
OUT std_logic;
112 payload_valid :
OUT std_logic;
113 payload_last :
OUT std_logic;
114 tready_data :
IN std_logic
119 generic(NSRC:
positive :=
4);
122 rst_clk :
in std_logic;
124 eFEX_number :
in std_logic_vector(
7 downto 0);
125 pause :
in std_logic := '
0';
126 packet_mux_enabled :
IN std_logic_vector(NSRC
-1 downto 0);
127 packet_mux_reset :
IN std_logic_vector(NSRC
-1 downto 0);
128 packet_mux_source :
OUT std_logic_vector(
3 downto 0);
131 packet_mux_valid :
IN std_logic_vector(NSRC
-1 downto 0);
132 packet_mux_last :
IN std_logic_vector(NSRC
-1 downto 0);
133 packet_mux_ready :
OUT std_logic_vector(NSRC
-1 downto 0);
136 packet_valid :
OUT std_logic;
137 packet_last :
OUT std_logic;
138 packet_ready :
IN std_logic
144 DATA_WIDTH:
positive :=
64
148 rst_clk :
in std_logic;
150 in_data :
IN std_logic_vector(DATA_WIDTH
-1 DOWNTO 0);
151 in_valid :
IN std_logic;
152 in_ready :
OUT std_logic;
154 out_data :
OUT std_logic_vector(DATA_WIDTH
-1 DOWNTO 0);
155 out_valid :
OUT std_logic;
156 out_ready :
IN std_logic
162 INPUT_FPGA_NO :
std_logic_vector(
1 downto 0) := "
00";
163 DATA_FORMAT_VERSION :
std_logic_vector (
2 DOWNTO 0) := "
001";
164 IPBUS_ADDR_WIDTH :
positive :=
10;
165 ILA_ENABLED :
std_logic := '
0'
169 eFEX_number :
IN std_logic_vector(
7 downto 0);
170 enable :
in std_logic;
172 clk_mgt :
in std_logic;
173 data_from_mgt :
in std_logic_vector(
31 downto 0);
174 char_is_k :
in std_logic;
175 error_from_mgt :
in std_logic;
177 clk_320 :
in std_logic;
178 rst_320 :
in std_logic;
179 fifo_data :
out std_logic_vector (
63 DOWNTO 0);
180 fifo_valid :
out std_logic;
181 fifo_last :
out std_logic;
183 mgt_last_l1id :
out std_logic_vector (
31 downto 0);
184 mgt_packet_stats :
out std_logic_vector (
4 downto 0);
186 clk_ipb :
in std_logic;
187 rst_ipb :
in std_logic;
188 rst_ipbus_addr :
in std_logic;
189 ipbus_wraparound :
in std_logic;
190 ipb_in :
in ipb_wbus;
191 ipb_out :
out ipb_rbus
197 DATA_FORMAT_VERSION :
std_logic_vector (
2 DOWNTO 0) := "
001"
201 rst_clk :
in std_logic;
203 eFEX_number :
in std_logic_vector(
7 downto 0);
205 ifg_duration :
IN std_logic_vector(
3 downto 0);
206 fpga_tob_enabled :
IN std_logic_vector(
3 downto 0);
207 pause :
IN std_logic_vector(
1 downto 0);
209 ttc_rd_en :
OUT STD_LOGIC;
210 ttc_dout :
IN std_logic_vector(
49 DOWNTO 0);
211 ttc_fifo_empty :
IN STD_LOGIC;
213 input_fifo_empty :
IN std_logic_vector(
3 downto 0);
214 fpga_tob_data :
IN packet_data_array(
3 downto 0);
215 fpga_tob_valid :
IN std_logic_vector(
3 downto 0);
216 fpga_tob_last :
IN std_logic_vector(
3 downto 0);
217 fpga_tob_ready :
OUT std_logic_vector(
3 downto 0);
219 merged_fifo_data :
OUT packet_data_array(
1 downto 0);
220 merged_fifo_valid :
OUT std_logic_vector(
1 downto 0);
221 merged_fifo_last :
OUT std_logic_vector(
1 downto 0);
223 L1A_seen :
OUT STD_LOGIC;
224 Last_L1ID_merged :
OUT std_logic_vector(
31 downto 0);
225 TOB_packet_merged_bus :
OUT std_logic_vector(
3 downto 0);
226 TOB_packet_missing_bus :
OUT std_logic_vector(
3 downto 0);
227 debug_packet_created_bus :
OUT std_logic_vector(
3 downto 0)
233 clk_320 :
in std_logic;
235 fifo_data :
in std_logic_vector (
63 DOWNTO 0);
236 fifo_valid :
in std_logic;
237 fifo_last :
in std_logic;
239 fifo_data_A :
out std_logic_vector (
63 DOWNTO 0);
240 fifo_valid_A :
out std_logic;
241 fifo_last_A :
out std_logic;
243 fifo_data_B :
out std_logic_vector (
63 DOWNTO 0);
244 fifo_valid_B :
out std_logic;
245 fifo_last_B :
out std_logic;
247 destination_enable :
in std_logic_vector(
1 downto 0) := (
Others => '
0')
253 RAM_ADDR_WIDTH :
positive :=
12;
254 MAX_PACKET_WIDTH :
positive :=
8
257 clk_320 :
in std_logic;
258 rst_320 :
in std_logic;
260 fifo_data :
in std_logic_vector (
63 DOWNTO 0);
261 fifo_valid :
in std_logic;
262 fifo_last :
in std_logic;
264 packet_data :
OUT std_logic_vector (
63 DOWNTO 0);
265 packet_valid :
OUT std_logic;
266 packet_last :
OUT std_logic;
267 packet_ready :
IN std_logic;
269 fifo_fill_level :
out std_logic_vector(
15 downto 0);
270 packet_count :
out STD_LOGIC_VECTOR(
15 downto 0);
271 fifo_empty :
OUT std_logic;
272 input_error :
OUT std_logic;
273 fifo_error :
OUT std_logic
324 fifo_valid :
in std_logic;
325 fifo_last :
in std_logic;
326 fifo_error :
in std_logic;
327 fifo_reset :
out std_logic
333 DELAY_DEPTH :
Integer range 0 to 255 :=
3
337 clk40 :
in std_logic;
338 clk_320 :
in std_logic;
340 rst_ttc :
in std_logic;
341 ttc_wr_en :
in std_logic;
342 ttc_rd_en :
in std_logic;
343 ttc_din :
in std_logic_vector(
49 DOWNTO 0);
345 ttc_rd_en_A :
in std_logic;
346 ttc_empty_A :
out std_logic;
347 ttc_dout_A :
out std_logic_vector(
49 DOWNTO 0);
348 ttc_rd_en_B :
in std_logic;
349 ttc_empty_B :
out std_logic;
350 ttc_dout_B :
out std_logic_vector(
49 DOWNTO 0);
352 destination_enable :
in std_logic_vector(
1 downto 0) := (
Others => '
0');
353 readout_delay :
in std_logic_vector(
7 downto 0)
359 IPBUS_ADDR_WIDTH :
positive :=
10
363 clk_320 :
in std_logic;
364 rst_320 :
in std_logic;
365 fifo_data :
in std_logic_vector (
63 DOWNTO 0);
366 fifo_valid :
in std_logic;
367 fifo_last :
in std_logic;
368 fifo_tready :
in std_logic;
370 clk_ipb :
in std_logic;
371 rst_ipb :
in std_logic;
372 rst_ipbus_addr :
in std_logic;
373 ipbus_wraparound :
in std_logic;
374 ipb_in :
in ipb_wbus;
375 ipb_out :
out ipb_rbus
381 RAM_ADDR_WIDTH :
positive :=
10
384 clk_320 :
in std_logic;
385 rst_320 :
in std_logic;
387 tob_mgt_packet_err_bus :
in std_logic_vector(
3 downto 0);
388 tob_mgt_length_err_bus :
in std_logic_vector(
3 downto 0);
389 tob_mgt_last_l1id_bus :
in mgt_data_array(
3 downto 0);
391 L1A_seen :
in std_logic;
392 Last_L1ID_merged :
in std_logic_vector(
31 downto 0);
394 merged_fifo_data :
in packet_data_array(
1 downto 0);
395 merged_fifo_valid :
in std_logic_vector(
1 downto 0);
396 merged_fifo_last :
in std_logic_vector(
1 downto 0);
398 clk_ipb :
in std_logic;
399 rst_ipb :
in std_logic;
400 rst_ipbus_addr :
in std_logic;
401 ipbus_wraparound :
in std_logic;
402 ipb_in :
in ipb_wbus;
403 ipb_out :
out ipb_rbus
409 TOB_FIFO_ADDR_MAX_WIDTH:
positive :=
12;
416 clk_320 :
in std_logic;
417 rst_320 :
in std_logic;
418 clk_ipb :
in std_logic;
419 rst_ipb :
in std_logic;
420 bcr_320 :
in std_logic;
421 ecr_320 :
in std_logic;
423 ipb_in :
in ipb_wbus;
424 ipb_out :
out ipb_rbus;
426 ipbus_tob_mgt_wbus_array :
out ipb_wbus_array(
3 downto 0);
427 ipbus_tob_mgt_rbus_array :
in ipb_rbus_array(
3 downto 0);
429 ipbus_raw_mgt_wbus_array :
out ipb_wbus_array(
3 downto 0);
430 ipbus_raw_mgt_rbus_array :
in ipb_rbus_array(
3 downto 0);
432 ipbus_merger_spy_wbus_array :
out ipb_wbus_array(
1 downto 0);
433 ipbus_merger_spy_rbus_array :
in ipb_rbus_array(
1 downto 0);
435 ipbus_built_fifo_wbus_array :
out ipb_wbus_array(
1 downto 0);
436 ipbus_built_fifo_rbus_array :
in ipb_rbus_array(
1 downto 0);
439 rst_ipbus_tob_mgt_addr_bus :
out std_logic_vector(
3 downto 0);
440 ipbus_tob_mgt_wraparound_bus :
out std_logic_vector(
3 downto 0);
442 rst_ipbus_raw_mgt_addr_bus :
out std_logic_vector(
3 downto 0);
443 ipbus_raw_mgt_wraparound_bus :
out std_logic_vector(
3 downto 0);
445 rst_ipbus_merger_spy_addr_bus :
out std_logic_vector(
1 downto 0);
446 ipbus_merger_spy_wraparound_bus :
out std_logic_vector(
1 downto 0);
448 rst_ipbus_built_fifo_addr_bus :
out std_logic_vector(
1 downto 0);
449 ipbus_built_fifo_wraparound_bus :
out std_logic_vector(
1 downto 0);
451 readout_delay :
out std_logic_vector(
31 downto 0);
453 tob_mgt_packet_received_bus :
in std_logic_vector(
3 downto 0);
454 tob_mgt_safe_mode_bus :
in std_logic_vector(
3 downto 0);
455 tob_mgt_packet_err_bus :
in std_logic_vector(
3 downto 0);
456 tob_mgt_length_err_bus :
in std_logic_vector(
3 downto 0);
457 tob_mgt_bcn_err_bus :
in std_logic_vector(
3 downto 0);
458 tob_mgt_last_l1id_bus :
in mgt_data_array(
3 downto 0);
461 raw_mgt_packet_received_bus :
in std_logic_vector(
3 downto 0);
462 raw_mgt_safe_mode_bus :
in std_logic_vector(
3 downto 0);
463 raw_mgt_packet_err_bus :
in std_logic_vector(
3 downto 0);
464 raw_mgt_length_err_bus :
in std_logic_vector(
3 downto 0);
465 raw_mgt_last_l1id_bus :
in mgt_data_array(
3 downto 0);
468 tob_fifo_fill_level_A_bus :
in fifo_status_array(
3 downto 0);
469 tob_packet_count_A_bus :
in fifo_status_array(
3 downto 0);
470 tob_fifo_error_A_bus :
in std_logic_vector(
3 downto 0);
473 tob_fifo_fill_level_B_bus :
in fifo_status_array(
3 downto 0);
474 tob_packet_count_B_bus :
in fifo_status_array(
3 downto 0);
475 tob_fifo_error_B_bus :
in std_logic_vector(
3 downto 0);
478 Last_L1ID_merger_A :
in std_logic_vector(
31 downto 0);
479 Last_L1ID_merger_B :
in std_logic_vector(
31 downto 0);
480 L1A_seen_bus :
in std_logic_vector(
1 downto 0);
483 TOB_packet_merged_A_bus :
in std_logic_vector(
3 downto 0);
484 TOB_packet_missing_A_bus :
in std_logic_vector(
3 downto 0);
485 debug_packet_created_A_bus :
in std_logic_vector(
3 downto 0);
486 TOB_packet_merged_B_bus :
in std_logic_vector(
3 downto 0);
487 TOB_packet_missing_B_bus :
in std_logic_vector(
3 downto 0);
488 debug_packet_created_B_bus :
in std_logic_vector(
3 downto 0);
491 mux_active_bus :
in std_logic_vector(
1 downto 0);
492 mux_l1id_valid_bus :
in std_logic_vector(
1 downto 0);
493 mux_source_bus :
in std_logic_vector(
7 downto 0);
494 mux_l1id_bus :
in mgt_data_array(
1 downto 0);
497 merged_fifo_fill_level_A_bus :
in fifo_status_array(
1 downto 0);
498 merged_packet_count_A_bus :
in fifo_status_array(
1 downto 0);
499 merged_fifo_error_A_bus :
in std_logic_vector(
1 downto 0);
502 merged_fifo_fill_level_B_bus :
in fifo_status_array(
1 downto 0);
503 merged_packet_count_B_bus :
in fifo_status_array(
1 downto 0);
504 merged_fifo_error_B_bus :
in std_logic_vector(
1 downto 0);
507 raw_fifo_fill_level_bus :
in fifo_status_array(
3 downto 0);
508 raw_packet_count_bus :
in fifo_status_array(
3 downto 0);
509 raw_fifo_error_bus :
in std_logic_vector(
3 downto 0);
512 tob_mgt_xoff_bus :
out std_logic_vector(
3 downto 0);
513 raw_mgt_xoff_bus :
out std_logic_vector(
3 downto 0);
515 tob_busy_bus :
out std_logic_vector(
3 downto 0);
516 raw_busy_bus :
out std_logic_vector(
3 downto 0);
518 Block_A_pause :
out std_logic_vector(
1 downto 0);
519 Block_B_pause :
out std_logic_vector(
1 downto 0)
525 INIT :
std_logic_vector(
31 downto 0) := (
Others => '
0')
531 A :
in std_logic_vector(
4 downto 0);
535 end COMPONENT SRLC32E;
537 constant FPGA_mapping : STD_LOGIC_VECTOR (7 downto 0) := x"9C" ;
539 SIGNAL rst_320_sig, rst_320_end, rst_320_delay, l1a_enable_sig : std_logic;
542 SIGNAL ipbus_tob_mgt_wbus_array, ipbus_raw_mgt_wbus_array : ipb_wbus_array(3 downto 0);
543 SIGNAL ipbus_tob_mgt_rbus_array, ipbus_raw_mgt_rbus_array : ipb_rbus_array(3 downto 0);
545 SIGNAL ipbus_merger_spy_wbus_array, ipbus_built_fifo_wbus_array : ipb_wbus_array(1 downto 0);
546 SIGNAL ipbus_merger_spy_rbus_array, ipbus_built_fifo_rbus_array : ipb_rbus_array(1 downto 0);
548 SIGNAL rst_ipbus_tob_mgt_addr_bus : std_logic_vector(3 downto 0);
549 SIGNAL ipbus_tob_mgt_wraparound_bus : std_logic_vector(3 downto 0);
551 SIGNAL rst_ipbus_raw_mgt_addr_bus : std_logic_vector(3 downto 0);
552 SIGNAL ipbus_raw_mgt_wraparound_bus : std_logic_vector(3 downto 0);
554 SIGNAL rst_ipbus_merger_spy_addr_bus : std_logic_vector(1 downto 0);
555 SIGNAL ipbus_merger_spy_wraparound_bus : std_logic_vector(1 downto 0);
557 SIGNAL rst_ipbus_built_fifo_addr_bus : std_logic_vector(1 downto 0);
558 SIGNAL ipbus_built_fifo_wraparound_bus : std_logic_vector(1 downto 0);
560 SIGNAL readout_delay : std_logic_vector(31 downto 0);
562 SIGNAL tob_fifo_data_bus, tob_fifo_data_A_bus, tob_fifo_data_B_bus : packet_data_array(3 downto 0);
563 SIGNAL tob_fifo_last_bus, tob_fifo_last_A_bus, tob_fifo_last_B_bus : std_logic_vector(3 downto 0);
564 SIGNAL tob_fifo_valid_bus, tob_fifo_valid_A_bus, tob_fifo_valid_B_bus : std_logic_vector(3 downto 0);
565 SIGNAL tob_packet_data_A_bus, tob_packet_data_B_bus, tob_packet_data_A_reg_bus, tob_packet_data_B_reg_bus : packet_data_array(3 downto 0);
566 SIGNAL tob_packet_last_A_bus, tob_packet_last_B_bus, tob_packet_last_A_reg_bus, tob_packet_last_B_reg_bus : std_logic_vector(3 downto 0);
567 SIGNAL tob_packet_valid_A_bus, tob_packet_valid_B_bus, tob_packet_valid_A_reg_bus, tob_packet_valid_B_reg_bus : std_logic_vector(3 downto 0);
568 SIGNAL tob_packet_ready_A_bus, tob_packet_ready_B_bus, tob_packet_ready_A_reg_bus, tob_packet_ready_B_reg_bus : std_logic_vector(3 downto 0);
569 SIGNAL tob_fifo_reset_A_bus, tob_fifo_reset_B_bus : std_logic_vector(3 downto 0);
570 SIGNAL tob_fifo_fill_level_A_bus, tob_fifo_fill_level_B_bus : fifo_status_array(3 downto 0);
571 SIGNAL tob_packet_count_A_bus, tob_packet_count_B_bus : fifo_status_array(3 downto 0);
572 SIGNAL tob_fifo_empty_A_bus, tob_fifo_empty_B_bus, tob_input_error_A_bus, tob_input_error_B_bus, tob_fifo_error_A_bus, tob_fifo_error_B_bus : std_logic_vector(3 downto 0);
573 SIGNAL tob_mgt_packet_received_bus, tob_mgt_safe_mode_bus, tob_mgt_packet_err_bus, tob_mgt_length_err_bus, tob_mgt_bcn_err_bus: std_logic_vector(3 downto 0);
574 SIGNAL tob_mgt_last_l1id_bus: mgt_data_array(3 downto 0);
576 SIGNAL ttc_dout_A, ttc_dout_B : std_logic_vector(49 DOWNTO 0);
577 SIGNAL ttc_empty_A, ttc_empty_B, ttc_rd_en_A, ttc_rd_en_B : std_logic;
579 SIGNAL TOB_Block_A_pause, TOB_Block_B_pause : std_logic_vector(1 downto 0);
580 SIGNAL merged_fifo_data_A_bus, merged_fifo_data_B_bus : packet_data_array(1 downto 0);
581 SIGNAL merged_fifo_last_A_bus, merged_fifo_last_B_bus : std_logic_vector(1 downto 0);
582 SIGNAL merged_fifo_valid_A_bus, merged_fifo_valid_B_bus : std_logic_vector(1 downto 0);
583 SIGNAL merged_fifo_fill_level_A_bus, merged_fifo_fill_level_B_bus : fifo_status_array(1 downto 0);
584 SIGNAL merged_packet_count_A_bus, merged_packet_count_B_bus : fifo_status_array(1 downto 0);
585 SIGNAL merged_input_error_A_bus, merged_input_error_B_bus : std_logic_vector(1 downto 0);
586 SIGNAL merged_fifo_error_A_bus, merged_fifo_error_B_bus : std_logic_vector(1 downto 0);
587 SIGNAL merged_fifo_reset_A_bus, merged_fifo_reset_B_bus : std_logic_vector(1 downto 0);
588 SIGNAL Last_L1ID_merger_A, Last_L1ID_merger_B : std_logic_vector(31 downto 0);
589 SIGNAL L1A_seen_bus : std_logic_vector(1 downto 0);
590 SIGNAL TOB_packet_merged_A_bus, TOB_packet_missing_A_bus, debug_packet_created_A_bus : std_logic_vector(3 downto 0);
591 SIGNAL TOB_packet_merged_B_bus, TOB_packet_missing_B_bus, debug_packet_created_B_bus : std_logic_vector(3 downto 0);
593 SIGNAL raw_fifo_data_bus, raw_demux_data_bus, raw_fifo_data_A_bus, raw_fifo_data_B_bus : packet_data_array(3 downto 0);
594 SIGNAL raw_demux_pause_bus, raw_demux_pause_A_bus, raw_demux_pause_B_bus : std_logic_vector(3 downto 0);
595 SIGNAL raw_fifo_last_bus, raw_demux_last_bus, raw_fifo_last_A_bus, raw_fifo_last_B_bus : std_logic_vector(3 downto 0);
596 SIGNAL raw_fifo_valid_bus, raw_demux_valid_bus, raw_fifo_valid_A_bus, raw_fifo_valid_B_bus : std_logic_vector(3 downto 0);
597 SIGNAL raw_fifo_fill_level_bus : fifo_status_array(3 downto 0);
598 SIGNAL raw_packet_count_bus : fifo_status_array(3 downto 0);
599 SIGNAL raw_fifo_error_bus, raw_input_error_bus, raw_ram_fifo_error_bus, raw_fifo_error_A_bus, raw_fifo_error_B_bus, raw_fifo_reset_bus : std_logic_vector(3 downto 0);
600 SIGNAL raw_mgt_packet_received_bus, raw_mgt_safe_mode_bus, raw_mgt_packet_err_bus, raw_mgt_length_err_bus, raw_mgt_bcn_err_bus: std_logic_vector(3 downto 0);
601 SIGNAL raw_mgt_last_l1id_bus: mgt_data_array(3 downto 0);
603 SIGNAL mux_data_A_bus, mux_data_B_bus : packet_data_array(5 downto 0);
604 SIGNAL mux_enable_A_bus, mux_enable_B_bus : std_logic_vector(5 downto 0);
605 SIGNAL mux_last_A_bus, mux_last_B_bus : std_logic_vector(5 downto 0);
606 SIGNAL mux_ready_A_bus, mux_ready_B_bus : std_logic_vector(5 downto 0);
607 SIGNAL mux_valid_A_bus, mux_valid_B_bus : std_logic_vector(5 downto 0);
608 SIGNAL mux_reset_A_bus, mux_reset_B_bus : std_logic_vector(5 downto 0);
610 SIGNAL mux_data_A_reg_bus, mux_data_B_reg_bus : packet_data_array(5 downto 0);
611 SIGNAL mux_last_A_reg_bus, mux_last_B_reg_bus : std_logic_vector(5 downto 0);
612 SIGNAL mux_ready_A_reg_bus, mux_ready_B_reg_bus : std_logic_vector(5 downto 0);
613 SIGNAL mux_valid_A_reg_bus, mux_valid_B_reg_bus : std_logic_vector(5 downto 0);
615 SIGNAL mux_active_bus, mux_l1id_valid_bus: std_logic_vector(1 downto 0);
616 SIGNAL mux_source_bus: std_logic_vector(7 downto 0);
617 SIGNAL mux_l1id_bus: mgt_data_array(1 downto 0);
619 SIGNAL packet_data_bus, packet_builder_data_bus, built_data_bus : packet_data_array(1 downto 0);
620 SIGNAL packet_last_bus, packet_valid_bus, packet_ready_bus, built_last_bus, built_valid_bus : std_logic_vector(1 downto 0);
621 SIGNAL packet_builder_last_bus, packet_builder_valid_bus, packet_builder_ready_bus : std_logic_vector(1 downto 0);
623 SIGNAL source_enable_sig, raw_destination_select_sig : std_logic_vector(NProcessorFPGA*2 - 1 downto 0) := (Others => '0');
624 SIGNAL tob_destination_enable_sig : std_logic_vector(1 downto 0) := (Others => '0');
627 SIGNAL bcr_40_tff, ecr_40_tff, bcr_320, ecr_320 : std_logic := '0';
628 SIGNAL bcr_320_tff_buf, ecr_320_tff_buf : std_logic_vector(1 downto 0) := (Others => '0');
630 attribute ASYNC_REG : string;
631 attribute ASYNC_REG of bcr_320_tff_buf : signal is "TRUE";
632 attribute ASYNC_REG of ecr_320_tff_buf : signal is "TRUE";
636 TOB_sources: for i in 0 to NProcessorFPGA-1 generate
640 INPUT_FPGA_NO => FPGA_mapping
(i*2+1
downto i*2
),
641 DATA_FORMAT_VERSION => "
001",
642 IPBUS_ADDR_WIDTH => TOB_SPY_ADDR_WIDTH,
647 eFEX_number => eFEX_number,
648 enable => source_enable_sig
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
650 clk_mgt => clk_mgt_bus
(i*2
),
651 data_from_mgt => data_from_mgt_bus
(i*2
),
652 char_is_k => char_is_k_bus
(i*2
),
653 error_from_mgt => error_from_mgt_bus
(i*2
),
656 rst_320 => rst_320_sig,
657 fifo_data => tob_fifo_data_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
658 fifo_valid => tob_fifo_valid_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
659 fifo_last => tob_fifo_last_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
661 mgt_last_l1id => tob_mgt_last_l1id_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
662 mgt_packet_stats
(4) => tob_mgt_safe_mode_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
663 mgt_packet_stats
(3) => tob_mgt_packet_err_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
664 mgt_packet_stats
(2) => tob_mgt_length_err_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
665 mgt_packet_stats
(1) => tob_mgt_bcn_err_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
666 mgt_packet_stats
(0) => tob_mgt_packet_received_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
670 rst_ipbus_addr => rst_ipbus_tob_mgt_addr_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
671 ipbus_wraparound => ipbus_tob_mgt_wraparound_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
672 ipb_in => ipbus_tob_mgt_wbus_array
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
673 ipb_out => ipbus_tob_mgt_rbus_array
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
))))
680 fifo_data => tob_fifo_data_bus
(i
),
681 fifo_valid => tob_fifo_valid_bus
(i
),
682 fifo_last => tob_fifo_last_bus
(i
),
684 fifo_data_A => tob_fifo_data_A_bus
(i
),
685 fifo_valid_A => tob_fifo_valid_A_bus
(i
),
686 fifo_last_A => tob_fifo_last_A_bus
(i
),
688 fifo_data_B => tob_fifo_data_B_bus
(i
),
689 fifo_valid_B => tob_fifo_valid_B_bus
(i
),
690 fifo_last_B => tob_fifo_last_B_bus
(i
),
691 destination_enable => tob_destination_enable_sig
696 RAM_ADDR_WIDTH => TOB_FIFO_ADDR_WIDTH,
697 MAX_PACKET_WIDTH => MAX_BUILT_PACKET_WIDTH
701 rst_320 => tob_fifo_reset_A_bus
(i
),
703 fifo_data => tob_fifo_data_A_bus
(i
),
704 fifo_valid => tob_fifo_valid_A_bus
(i
),
705 fifo_last => tob_fifo_last_A_bus
(i
),
707 packet_data => tob_packet_data_A_bus
(i
),
708 packet_valid => tob_packet_valid_A_bus
(i
),
709 packet_last => tob_packet_last_A_bus
(i
),
710 packet_ready => tob_packet_ready_A_bus
(i
),
712 fifo_fill_level => tob_fifo_fill_level_A_bus
(i
),
713 packet_count => tob_packet_count_A_bus
(i
),
714 fifo_empty => tob_fifo_empty_A_bus
(i
),
715 input_error => tob_input_error_A_bus
(i
),
716 fifo_error => tob_fifo_error_A_bus
(i
)
725 rst_clk => tob_fifo_reset_A_bus
(i
),
727 in_data
(63 downto 0) => tob_packet_data_A_bus
(i
),
728 in_data
(64) => tob_packet_last_A_bus
(i
),
729 in_valid => tob_packet_valid_A_bus
(i
),
730 in_ready => tob_packet_ready_A_bus
(i
),
732 out_data
(63 downto 0) => tob_packet_data_A_reg_bus
(i
),
733 out_data
(64) => tob_packet_last_A_reg_bus
(i
),
734 out_valid => tob_packet_valid_A_reg_bus
(i
),
735 out_ready => tob_packet_ready_A_reg_bus
(i
)
742 fifo_valid => tob_fifo_valid_A_bus
(i
),
743 fifo_last => tob_fifo_last_A_bus
(i
),
744 fifo_error => tob_fifo_error_A_bus
(i
),
745 fifo_reset => tob_fifo_reset_A_bus
(i
)
750 RAM_ADDR_WIDTH => TOB_FIFO_ADDR_WIDTH,
751 MAX_PACKET_WIDTH => MAX_BUILT_PACKET_WIDTH
755 rst_320 => tob_fifo_reset_B_bus
(i
),
757 fifo_data => tob_fifo_data_B_bus
(i
),
758 fifo_valid => tob_fifo_valid_B_bus
(i
),
759 fifo_last => tob_fifo_last_B_bus
(i
),
761 packet_data => tob_packet_data_B_bus
(i
),
762 packet_valid => tob_packet_valid_B_bus
(i
),
763 packet_last => tob_packet_last_B_bus
(i
),
764 packet_ready => tob_packet_ready_B_bus
(i
),
766 fifo_fill_level => tob_fifo_fill_level_B_bus
(i
),
767 packet_count => tob_packet_count_B_bus
(i
),
768 fifo_empty => tob_fifo_empty_B_bus
(i
),
769 input_error => tob_input_error_B_bus
(i
),
770 fifo_error => tob_fifo_error_B_bus
(i
)
779 rst_clk => tob_fifo_reset_B_bus
(i
),
781 in_data
(63 downto 0) => tob_packet_data_B_bus
(i
),
782 in_data
(64) => tob_packet_last_B_bus
(i
),
783 in_valid => tob_packet_valid_B_bus
(i
),
784 in_ready => tob_packet_ready_B_bus
(i
),
786 out_data
(63 downto 0) => tob_packet_data_B_reg_bus
(i
),
787 out_data
(64) => tob_packet_last_B_reg_bus
(i
),
788 out_valid => tob_packet_valid_B_reg_bus
(i
),
789 out_ready => tob_packet_ready_B_reg_bus
(i
)
796 fifo_valid => tob_fifo_valid_B_bus
(i
),
797 fifo_last => tob_fifo_last_B_bus
(i
),
798 fifo_error => tob_fifo_error_B_bus
(i
),
799 fifo_reset => tob_fifo_reset_B_bus
(i
)
802 End generate TOB_sources;
814 ttc_wr_en => ttc_wr_en,
815 ttc_rd_en => ttc_rd_en,
818 ttc_rd_en_A => ttc_rd_en_A,
819 ttc_empty_A => ttc_empty_A,
820 ttc_dout_A => ttc_dout_A,
821 ttc_rd_en_B => ttc_rd_en_B,
822 ttc_empty_B => ttc_empty_B,
823 ttc_dout_B => ttc_dout_B,
825 destination_enable => tob_destination_enable_sig,
826 readout_delay => readout_delay
(7 downto 0)
831 DATA_FORMAT_VERSION => "
001"
835 rst_clk => rst_320_sig,
836 eFEX_number => eFEX_number,
838 ifg_duration => readout_delay
(11 downto 8),
839 fpga_tob_enabled => source_enable_sig
(3 downto 0),
840 pause => TOB_Block_A_pause,
842 ttc_rd_en => ttc_rd_en_A,
843 ttc_dout => ttc_dout_A,
844 ttc_fifo_empty => ttc_empty_A,
846 input_fifo_empty => tob_fifo_empty_A_bus,
847 fpga_tob_data => tob_packet_data_A_reg_bus,
848 fpga_tob_valid => tob_packet_valid_A_reg_bus,
849 fpga_tob_last => tob_packet_last_A_reg_bus,
850 fpga_tob_ready => tob_packet_ready_A_reg_bus,
852 merged_fifo_data => merged_fifo_data_A_bus,
853 merged_fifo_valid => merged_fifo_valid_A_bus,
854 merged_fifo_last => merged_fifo_last_A_bus,
856 L1A_seen => L1A_seen_bus
(0),
857 Last_L1ID_merged => Last_L1ID_merger_A,
858 TOB_packet_merged_bus => TOB_packet_merged_A_bus,
859 TOB_packet_missing_bus => TOB_packet_missing_A_bus,
860 debug_packet_created_bus => debug_packet_created_A_bus
864 Generic map (RAM_ADDR_WIDTH => MERGER_SPY_ADDR_WIDTH
)
867 rst_320 => rst_320_sig,
869 tob_mgt_packet_err_bus => tob_mgt_packet_err_bus,
870 tob_mgt_length_err_bus => tob_mgt_length_err_bus,
871 tob_mgt_last_l1id_bus => tob_mgt_last_l1id_bus,
873 L1A_seen => L1A_seen_bus
(0),
874 Last_L1ID_merged => Last_L1ID_merger_A,
876 merged_fifo_data => merged_fifo_data_A_bus,
877 merged_fifo_valid => merged_fifo_valid_A_bus,
878 merged_fifo_last => merged_fifo_last_A_bus,
882 rst_ipbus_addr => rst_ipbus_merger_spy_addr_bus
(0),
883 ipbus_wraparound => ipbus_merger_spy_wraparound_bus
(0),
884 ipb_in => ipbus_merger_spy_wbus_array
(0),
885 ipb_out => ipbus_merger_spy_rbus_array
(0)
890 DATA_FORMAT_VERSION => "
001"
894 rst_clk => rst_320_sig,
895 eFEX_number => eFEX_number,
897 ifg_duration => readout_delay
(11 downto 8),
898 fpga_tob_enabled => source_enable_sig
(3 downto 0),
899 pause => TOB_Block_B_pause,
901 ttc_rd_en => ttc_rd_en_B,
902 ttc_dout => ttc_dout_B,
903 ttc_fifo_empty => ttc_empty_B,
905 input_fifo_empty => tob_fifo_empty_B_bus,
906 fpga_tob_data => tob_packet_data_B_reg_bus,
907 fpga_tob_valid => tob_packet_valid_B_reg_bus,
908 fpga_tob_last => tob_packet_last_B_reg_bus,
909 fpga_tob_ready => tob_packet_ready_B_reg_bus,
911 merged_fifo_data => merged_fifo_data_B_bus,
912 merged_fifo_valid => merged_fifo_valid_B_bus,
913 merged_fifo_last => merged_fifo_last_B_bus,
915 L1A_seen => L1A_seen_bus
(1),
916 Last_L1ID_merged => Last_L1ID_merger_B,
917 TOB_packet_merged_bus => TOB_packet_merged_B_bus,
918 TOB_packet_missing_bus => TOB_packet_missing_B_bus,
919 debug_packet_created_bus => debug_packet_created_B_bus
923 Generic map (RAM_ADDR_WIDTH => MERGER_SPY_ADDR_WIDTH
)
926 rst_320 => rst_320_sig,
928 tob_mgt_packet_err_bus => tob_mgt_packet_err_bus,
929 tob_mgt_length_err_bus => tob_mgt_length_err_bus,
930 tob_mgt_last_l1id_bus => tob_mgt_last_l1id_bus,
932 L1A_seen => L1A_seen_bus
(1),
933 Last_L1ID_merged => Last_L1ID_merger_B,
935 merged_fifo_data => merged_fifo_data_B_bus,
936 merged_fifo_valid => merged_fifo_valid_B_bus,
937 merged_fifo_last => merged_fifo_last_B_bus,
941 rst_ipbus_addr => rst_ipbus_merger_spy_addr_bus
(1),
942 ipbus_wraparound => ipbus_merger_spy_wraparound_bus
(1),
943 ipb_in => ipbus_merger_spy_wbus_array
(1),
944 ipb_out => ipbus_merger_spy_rbus_array
(1)
947 Merged_FIFOs: for i in 0 to 1 generate
950 RAM_ADDR_WIDTH => MERGED_FIFO_ADDR_WIDTH,
951 MAX_PACKET_WIDTH => MAX_BUILT_PACKET_WIDTH+2
955 rst_320 => merged_fifo_reset_A_bus
(i
),
957 fifo_data => merged_fifo_data_A_bus
(i
),
958 fifo_valid => merged_fifo_valid_A_bus
(i
),
959 fifo_last => merged_fifo_last_A_bus
(i
),
961 packet_data => mux_data_A_bus
(i
),
962 packet_valid => mux_valid_A_bus
(i
),
963 packet_last => mux_last_A_bus
(i
),
964 packet_ready => mux_ready_A_bus
(i
),
966 fifo_fill_level => merged_fifo_fill_level_A_bus
(i
),
967 packet_count => merged_packet_count_A_bus
(i
),
969 input_error => merged_input_error_A_bus
(i
),
970 fifo_error => merged_fifo_error_A_bus
(i
)
977 fifo_valid => merged_fifo_valid_A_bus
(i
),
978 fifo_last => merged_fifo_last_A_bus
(i
),
979 fifo_error => merged_fifo_error_A_bus
(i
),
980 fifo_reset => merged_fifo_reset_A_bus
(i
)
985 RAM_ADDR_WIDTH => MERGED_FIFO_ADDR_WIDTH,
986 MAX_PACKET_WIDTH => MAX_BUILT_PACKET_WIDTH+2
990 rst_320 => merged_fifo_reset_B_bus
(i
),
992 fifo_data => merged_fifo_data_B_bus
(i
),
993 fifo_valid => merged_fifo_valid_B_bus
(i
),
994 fifo_last => merged_fifo_last_B_bus
(i
),
996 packet_data => mux_data_B_bus
(i
),
997 packet_valid => mux_valid_B_bus
(i
),
998 packet_last => mux_last_B_bus
(i
),
999 packet_ready => mux_ready_B_bus
(i
),
1001 fifo_fill_level => merged_fifo_fill_level_B_bus
(i
),
1002 packet_count => merged_packet_count_B_bus
(i
),
1004 input_error => merged_input_error_B_bus
(i
),
1005 fifo_error => merged_fifo_error_B_bus
(i
)
1012 fifo_valid => merged_fifo_valid_B_bus
(i
),
1013 fifo_last => merged_fifo_last_B_bus
(i
),
1014 fifo_error => merged_fifo_error_B_bus
(i
),
1015 fifo_reset => merged_fifo_reset_B_bus
(i
)
1018 End generate Merged_FIFOs;
1020 Bulk_sources: for i in 0 to NProcessorFPGA-1 generate
1023 INPUT_FPGA_NO => FPGA_mapping
(i*2+1
downto i*2
),
1024 DATA_FORMAT_VERSION => "
001",
1025 IPBUS_ADDR_WIDTH => RAW_SPY_ADDR_WIDTH,
1030 eFEX_number => eFEX_number,
1031 enable => source_enable_sig
(NProcessorFPGA+to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1033 clk_mgt => clk_mgt_bus
(i*2+1
),
1034 data_from_mgt => data_from_mgt_bus
(i*2+1
),
1035 char_is_k => char_is_k_bus
(i*2+1
),
1036 error_from_mgt => error_from_mgt_bus
(i*2+1
),
1039 rst_320 => rst_320_sig,
1040 fifo_data => raw_fifo_data_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1041 fifo_valid => raw_fifo_valid_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1042 fifo_last => raw_fifo_last_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1044 mgt_last_l1id => raw_mgt_last_l1id_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1045 mgt_packet_stats
(4) => raw_mgt_safe_mode_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1046 mgt_packet_stats
(3) => raw_mgt_packet_err_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1047 mgt_packet_stats
(2) => raw_mgt_length_err_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1048 mgt_packet_stats
(1) => raw_mgt_bcn_err_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1049 mgt_packet_stats
(0) => raw_mgt_packet_received_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1053 rst_ipbus_addr => rst_ipbus_raw_mgt_addr_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1054 ipbus_wraparound => ipbus_raw_mgt_wraparound_bus
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1055 ipb_in => ipbus_raw_mgt_wbus_array
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
)))),
1056 ipb_out => ipbus_raw_mgt_rbus_array
(to_integer
(unsigned(FPGA_mapping
(i*2+1
downto i*2
))))
1067 rst_clk => raw_fifo_reset_bus
(i
),
1069 in_data => raw_fifo_data_bus
(i
),
1071 in_last => raw_fifo_last_bus
(i
),
1080 in_error => raw_input_error_bus
(i
),
1088 fifo_data => raw_demux_data_bus
(i
),
1089 fifo_valid => raw_demux_valid_bus
(i
),
1090 fifo_last => raw_demux_last_bus
(i
),
1092 fifo_data_A => raw_fifo_data_A_bus
(i
),
1093 fifo_valid_A => raw_fifo_valid_A_bus
(i
),
1094 fifo_last_A => raw_fifo_last_A_bus
(i
),
1096 fifo_data_B => raw_fifo_data_B_bus
(i
),
1097 fifo_valid_B => raw_fifo_valid_B_bus
(i
),
1098 fifo_last_B => raw_fifo_last_B_bus
(i
),
1099 destination_enable => raw_destination_select_sig
(i*2+1
downto i*2
)
1109 rst_clk => raw_fifo_reset_bus
(i
),
1111 in_data => raw_fifo_data_A_bus
(i
),
1112 in_valid => raw_fifo_valid_A_bus
(i
),
1113 in_last => raw_fifo_last_A_bus
(i
),
1114 in_pause => raw_demux_pause_A_bus
(i
),
1130 rst_clk => raw_fifo_reset_bus
(i
),
1132 in_data => raw_fifo_data_B_bus
(i
),
1133 in_valid => raw_fifo_valid_B_bus
(i
),
1134 in_last => raw_fifo_last_B_bus
(i
),
1135 in_pause => raw_demux_pause_B_bus
(i
),
1148 fifo_valid => raw_fifo_valid_bus
(i
),
1149 fifo_last => raw_fifo_last_bus
(i
),
1150 fifo_error => raw_fifo_error_bus
(i
),
1151 fifo_reset => raw_fifo_reset_bus
(i
)
1154 End generate Bulk_sources;
1156 raw_demux_pause_bus <= raw_demux_pause_A_bus or raw_demux_pause_B_bus;
1157 raw_fifo_error_bus <= raw_ram_fifo_error_bus or raw_fifo_error_A_bus or raw_fifo_error_B_bus;
1159 mux_reset_A_bus <= raw_fifo_reset_bus & merged_fifo_reset_A_bus;
1160 mux_reset_B_bus <= raw_fifo_reset_bus & merged_fifo_reset_B_bus;
1162 MUX_registers: for i in 0 to 5 generate
1169 rst_clk => mux_reset_A_bus
(i
),
1171 in_data
(63 downto 0) => mux_data_A_bus
(i
),
1172 in_data
(64) => mux_last_A_bus
(i
),
1173 in_valid => mux_valid_A_bus
(i
),
1174 in_ready => mux_ready_A_bus
(i
),
1176 out_data
(63 downto 0) => mux_data_A_reg_bus
(i
),
1177 out_data
(64) => mux_last_A_reg_bus
(i
),
1178 out_valid => mux_valid_A_reg_bus
(i
),
1179 out_ready => mux_ready_A_reg_bus
(i
)
1188 rst_clk => mux_reset_B_bus
(i
),
1190 in_data
(63 downto 0) => mux_data_B_bus
(i
),
1191 in_data
(64) => mux_last_B_bus
(i
),
1192 in_valid => mux_valid_B_bus
(i
),
1193 in_ready => mux_ready_B_bus
(i
),
1195 out_data
(63 downto 0) => mux_data_B_reg_bus
(i
),
1196 out_data
(64) => mux_last_B_reg_bus
(i
),
1197 out_valid => mux_valid_B_reg_bus
(i
),
1198 out_ready => mux_ready_B_reg_bus
(i
)
1201 End generate MUX_registers;
1209 rst_clk => rst_320_sig,
1210 eFEX_number => eFEX_number,
1212 packet_mux_enabled => mux_enable_A_bus,
1213 packet_mux_reset => mux_reset_A_bus,
1214 packet_mux_source => mux_source_bus
(3 downto 0),
1216 packet_mux_valid => mux_valid_A_reg_bus,
1217 packet_mux_last => mux_last_A_reg_bus,
1218 packet_mux_ready => mux_ready_A_reg_bus,
1220 packet_valid => packet_valid_bus
(0),
1221 packet_last => packet_last_bus
(0),
1222 packet_ready => packet_ready_bus
(0)
1231 rst_clk => rst_320_sig,
1232 eFEX_number => eFEX_number,
1234 packet_mux_enabled => mux_enable_B_bus,
1235 packet_mux_reset => mux_reset_B_bus,
1236 packet_mux_source => mux_source_bus
(7 downto 4),
1238 packet_mux_valid => mux_valid_B_reg_bus,
1239 packet_mux_last => mux_last_B_reg_bus,
1240 packet_mux_ready => mux_ready_B_reg_bus,
1242 packet_valid => packet_valid_bus
(1),
1243 packet_last => packet_last_bus
(1),
1244 packet_ready => packet_ready_bus
(1)
1247 packet_mux_source <= mux_source_bus;
1249 MUX_monitor_block:
process(clk_320)
1250 Variable mux_active_var, mux_l1id_valid_var: std_logic_vector(1 downto 0) := (Others => '0');
1251 Variable mux_l1id_var: mgt_data_array(1 downto 0) := (Others => (Others => '0'));
1253 if rising_edge(clk_320) then
1254 if (rst_320_sig = '1') then
1255 mux_active_var := (Others => '0');
1256 mux_l1id_valid_var := (Others => '0');
1257 mux_l1id_var := (Others => (Others => '0'));
1259 for i in 0 to 1 loop
1260 if (mux_active_var(i) = '0') and (packet_valid_bus(i) = '1') then
1261 mux_l1id_valid_var(i) := '1';
1262 mux_l1id_var(i) := packet_data_bus(i)(63 downto 32);
1263 mux_active_var(i) := '1';
1265 mux_l1id_valid_var(i) := '0';
1266 mux_l1id_var(i) := (Others => '0');
1268 if (packet_last_bus(i) = '1') and (packet_valid_bus(i) = '1') and (packet_ready_bus(i) = '1') then
1269 mux_active_var(i) := '0';
1273 mux_active_bus <= mux_active_var
1278 mux_l1id_valid_bus <= mux_l1id_valid_var
1283 mux_l1id_bus <= mux_l1id_var
1289 end process MUX_monitor_block;
1291 Packet_builders: for i in 0 to 1 generate
1298 rst_clk => rst_320_sig,
1300 in_data
(63 downto 0) => packet_data_bus
(i
),
1301 in_data
(64) => packet_last_bus
(i
),
1302 in_valid => packet_valid_bus
(i
),
1303 in_ready => packet_ready_bus
(i
),
1305 out_data
(63 downto 0) => packet_builder_data_bus
(i
),
1306 out_data
(64) => packet_builder_last_bus
(i
),
1307 out_valid => packet_builder_valid_bus
(i
),
1308 out_ready => packet_builder_ready_bus
(i
)
1314 rst_clk => rst_320_sig,
1316 packet_valid => packet_builder_valid_bus
(i
),
1317 packet_last => packet_builder_last_bus
(i
),
1318 packet_ready => packet_builder_ready_bus
(i
),
1320 payload_valid => built_valid_bus
(i
),
1321 payload_last => built_last_bus
(i
),
1322 tready_data => tready_data_bus
(i
)
1327 IPBUS_ADDR_WIDTH => AURORA_SPY_ADDR_WIDTH
1332 rst_320 => rst_320_sig,
1333 fifo_data => built_data_bus
(i
),
1334 fifo_valid => built_valid_bus
(i
),
1335 fifo_last => built_last_bus
(i
),
1336 fifo_tready => tready_data_bus
(i
),
1341 rst_ipbus_addr => rst_ipbus_built_fifo_addr_bus
(i
),
1342 ipbus_wraparound => ipbus_built_fifo_wraparound_bus
(i
),
1343 ipb_in => ipbus_built_fifo_wbus_array
(i
),
1344 ipb_out => ipbus_built_fifo_rbus_array
(i
)
1347 End generate Packet_builders;
1349 payload_data_bus <= built_data_bus;
1350 payload_valid_bus <= built_valid_bus;
1351 payload_last_bus <= built_last_bus;
1355 TOB_FIFO_ADDR_MAX_WIDTH => TOB_FIFO_ADDR_WIDTH,
1364 rst_320 => rst_320_sig,
1372 ipbus_tob_mgt_wbus_array => ipbus_tob_mgt_wbus_array,
1373 ipbus_tob_mgt_rbus_array => ipbus_tob_mgt_rbus_array,
1375 ipbus_raw_mgt_wbus_array => ipbus_raw_mgt_wbus_array,
1376 ipbus_raw_mgt_rbus_array => ipbus_raw_mgt_rbus_array,
1378 ipbus_merger_spy_wbus_array => ipbus_merger_spy_wbus_array,
1379 ipbus_merger_spy_rbus_array => ipbus_merger_spy_rbus_array,
1381 ipbus_built_fifo_wbus_array => ipbus_built_fifo_wbus_array,
1382 ipbus_built_fifo_rbus_array => ipbus_built_fifo_rbus_array,
1384 rst_ipbus_tob_mgt_addr_bus => rst_ipbus_tob_mgt_addr_bus,
1385 ipbus_tob_mgt_wraparound_bus => ipbus_tob_mgt_wraparound_bus,
1387 rst_ipbus_raw_mgt_addr_bus => rst_ipbus_raw_mgt_addr_bus,
1388 ipbus_raw_mgt_wraparound_bus => ipbus_raw_mgt_wraparound_bus,
1390 rst_ipbus_merger_spy_addr_bus => rst_ipbus_merger_spy_addr_bus,
1391 ipbus_merger_spy_wraparound_bus => ipbus_merger_spy_wraparound_bus,
1393 rst_ipbus_built_fifo_addr_bus => rst_ipbus_built_fifo_addr_bus,
1394 ipbus_built_fifo_wraparound_bus => ipbus_built_fifo_wraparound_bus,
1396 readout_delay => readout_delay,
1398 L1A_seen_bus => L1A_seen_bus,
1399 Last_L1ID_merger_A => Last_L1ID_merger_A,
1400 Last_L1ID_merger_B => Last_L1ID_merger_B,
1402 tob_mgt_packet_received_bus => tob_mgt_packet_received_bus,
1403 tob_mgt_safe_mode_bus => tob_mgt_safe_mode_bus,
1404 tob_mgt_packet_err_bus => tob_mgt_packet_err_bus,
1405 tob_mgt_length_err_bus => tob_mgt_length_err_bus,
1406 tob_mgt_bcn_err_bus => tob_mgt_bcn_err_bus,
1407 tob_mgt_last_l1id_bus => tob_mgt_last_l1id_bus,
1409 raw_mgt_packet_received_bus => raw_mgt_packet_received_bus,
1410 raw_mgt_safe_mode_bus => raw_mgt_safe_mode_bus,
1411 raw_mgt_packet_err_bus => raw_mgt_packet_err_bus,
1412 raw_mgt_length_err_bus => raw_mgt_length_err_bus,
1413 raw_mgt_last_l1id_bus => raw_mgt_last_l1id_bus,
1415 tob_fifo_fill_level_A_bus => tob_fifo_fill_level_A_bus,
1416 tob_packet_count_A_bus => tob_packet_count_A_bus,
1417 tob_fifo_error_A_bus => tob_fifo_error_A_bus,
1418 merged_fifo_fill_level_A_bus => merged_fifo_fill_level_A_bus,
1419 merged_packet_count_A_bus => merged_packet_count_A_bus,
1420 merged_fifo_error_A_bus => merged_fifo_error_A_bus,
1421 TOB_packet_merged_A_bus => TOB_packet_merged_A_bus,
1422 TOB_packet_missing_A_bus => TOB_packet_missing_A_bus,
1423 debug_packet_created_A_bus => debug_packet_created_A_bus,
1425 tob_fifo_fill_level_B_bus => tob_fifo_fill_level_B_bus,
1426 tob_packet_count_B_bus => tob_packet_count_B_bus,
1427 tob_fifo_error_B_bus => tob_fifo_error_B_bus,
1428 merged_fifo_fill_level_B_bus => merged_fifo_fill_level_B_bus,
1429 merged_packet_count_B_bus => merged_packet_count_B_bus,
1430 merged_fifo_error_B_bus => merged_fifo_error_B_bus,
1431 TOB_packet_merged_B_bus => TOB_packet_merged_B_bus,
1432 TOB_packet_missing_B_bus => TOB_packet_missing_B_bus,
1433 debug_packet_created_B_bus => debug_packet_created_B_bus,
1435 mux_active_bus => mux_active_bus,
1436 mux_l1id_valid_bus => mux_l1id_valid_bus,
1437 mux_source_bus => mux_source_bus,
1438 mux_l1id_bus => mux_l1id_bus,
1440 raw_fifo_fill_level_bus => raw_fifo_fill_level_bus,
1441 raw_packet_count_bus => raw_packet_count_bus,
1442 raw_fifo_error_bus => raw_fifo_error_bus,
1444 tob_mgt_xoff_bus => mgt_xoff_bus
(3 downto 0),
1445 raw_mgt_xoff_bus => mgt_xoff_bus
(7 downto 4),
1447 tob_busy_bus => busy_bus
(3 downto 0),
1448 raw_busy_bus => busy_bus
(7 downto 4),
1450 Block_A_pause => TOB_Block_A_pause,
1451 Block_B_pause => TOB_Block_B_pause
1456 bcr_clk40 :
process(clk40)
1458 if rising_edge(clk40) then
1459 if (bcr_40 = '1') then
1460 bcr_40_tff <= not bcr_40_tff;
1462 bcr_40_tff <= bcr_40_tff;
1465 end process bcr_clk40;
1467 ecr_clk40 :
process(clk40)
1469 if rising_edge(clk40) then
1470 if (ecr_40 = '1') then
1471 ecr_40_tff <= not ecr_40_tff;
1473 ecr_40_tff <= ecr_40_tff;
1476 end process ecr_clk40;
1478 bcr_tff_clk320 :
process(clk_320)
1480 if rising_edge(clk_320) then
1481 bcr_320_tff_buf <= bcr_320_tff_buf(0) & bcr_40_tff;
1483 end process bcr_tff_clk320;
1485 ecr_tff_clk320 :
process(clk_320)
1487 if rising_edge(clk_320) then
1488 ecr_320_tff_buf <= ecr_320_tff_buf(0) & ecr_40_tff;
1490 end process ecr_tff_clk320;
1492 bcr_clk320 :
process(clk_320)
1494 if rising_edge(clk_320) then
1495 if ((bcr_320_tff_buf(1) xor bcr_320_tff_buf(0)) = '1') then
1501 end process bcr_clk320;
1503 ecr_clk320 :
process(clk_320)
1505 if rising_edge(clk_320) then
1506 if ((ecr_320_tff_buf(1) xor ecr_320_tff_buf(0)) = '1') then
1512 end process ecr_clk320;
1514 Reset_block:
process(clk_320)
1515 Variable stretch: std_logic_vector(7 downto 0) := (Others => '1');
1516 Variable first_reset: std_logic := '0';
1519 if rising_edge(clk_320) then
1520 if (first_reset = '0') or (rst_320 = '1') then
1521 stretch := (Others => '1');
1524 stretch := stretch(6 downto 0) & "0";
1526 if (rst_320_sig = '1') and (stretch(7) = '0') then
1539 rst_320_sig <= stretch(7)
1545 end process Reset_block;
1547 SRLC32E_reset_delay : SRLC32E
1548 --
generate a
delayed pulse
after end of reset
1550 INIT => X"00000000"
)
1553 Q31 => rst_320_delay,
1554 A =>
(Others => '1'
),
1560 L1A_enable_block:
process(clk_320)
1562 if rising_edge(clk_320) then
1563 l1a_enable_sig <= l1a_enable
1569 end process L1A_enable_block;
1571 Enable_block:
process(clk_320)
1572 Variable source_enable_var, raw_destination_select_var : std_logic_vector(NProcessorFPGA*2 - 1 downto 0) := (Others => '0');
1573 Variable tob_destination_enable_var : std_logic_vector(1 downto 0) := (Others => '0');
1574 Variable mux_enable_A_var, mux_enable_B_var : std_logic_vector(5 downto 0);
1575 Variable mux_xon_A_mask, mux_xon_B_mask : std_logic_vector(5 downto 0);
1577 if rising_edge(clk_320) then
1578 if (rst_320_sig = '1') then
1579 source_enable_var := (Others => '0');
1580 tob_destination_enable_var := (Others => '0');
1581 raw_destination_select_var := (Others => '0');
1582 mux_enable_A_var := (Others => '0');
1583 mux_enable_B_var := (Others => '0');
1584 elsif (rst_320_delay = '1') then
1585 source_enable_var := source_enable;
1586 tob_destination_enable_var := tob_destination_enable;
1587 mux_enable_A_var(1 downto 0) := tob_destination_enable(0) & tob_destination_enable(0);
1588 mux_enable_B_var(1 downto 0) := tob_destination_enable(1) & tob_destination_enable(1);
1589 Case raw_destination_enable is
1591 raw_destination_select_var := "10100101";
1592 mux_enable_A_var(5 downto 2) := "0011";
1593 mux_enable_B_var(5 downto 2) := "1100";
1595 raw_destination_select_var := "01010101";
1596 mux_enable_A_var(5 downto 2) := "1111";
1597 mux_enable_B_var(5 downto 2) := "0000";
1599 raw_destination_select_var := "10101010";
1600 mux_enable_A_var(5 downto 2) := "0000";
1601 mux_enable_B_var(5 downto 2) := "1111";
1603 raw_destination_select_var := (Others => '0');
1604 mux_enable_A_var(5 downto 2) := "0000";
1605 mux_enable_B_var(5 downto 2) := "0000";
1608 if tob_xoff_bus(0) = '0' then
1609 mux_xon_A_mask(0) := '1';
1611 mux_xon_A_mask(0) := '0';
1613 if tob_xoff_bus(1) = '0' then
1614 mux_xon_B_mask(0) := '1';
1616 mux_xon_B_mask(0) := '0';
1618 if raw_xoff_bus(0) = '0' then
1619 mux_xon_A_mask(5 downto 1) := "11111";
1621 mux_xon_A_mask(5 downto 1) := "00000";
1623 if raw_xoff_bus(1) = '0' then
1624 mux_xon_B_mask(5 downto 1) := "11111";
1626 mux_xon_B_mask(5 downto 1) := "00000";
1628 if (l1a_enable_sig = '1') then
1629 source_enable_sig <= source_enable_var
1634 tob_destination_enable_sig <= tob_destination_enable_var
1639 raw_destination_select_sig <= raw_destination_select_var
1644 mux_enable_A_bus <= mux_enable_A_var and mux_xon_A_mask
1649 mux_enable_B_bus <= mux_enable_B_var and mux_xon_B_mask
1655 source_enable_sig <= (Others => '0')
1660 tob_destination_enable_sig <= (Others => '0')
1665 raw_destination_select_sig <= (Others => '0')
1670 mux_enable_A_bus <= (Others => '0')
1675 mux_enable_B_bus <= (Others => '0')
1682 end process Enable_block;
1684 END Architecture rtl;
AXI-stream version of packet engine...
in packet_data std_logic_vector( 63 DOWNTO 0)
FIFO signals.
out payload_data std_logic_vector( 63 DOWNTO 0)
towards Aurora readout
AXI-stream MUX into packet engine...
in packet_mux_data packet_data_array( NSRC- 1 downto 0)
Input signals.
out packet_data std_logic_vector( 63 DOWNTO 0)
FIFO signals.
Switch FIFO data to correct stream depending on destination_enable...
Capture FIFO traffic into IPBus DPRAM64...
Second version of packet format engine from MGT through to formatted (sub)block...
Instantiate the readout merging and routing logic...
efex_packet_builder
FIFO signals.
Instantiate the readout merging and routing logic...
Instantiate a Block RAM storage and Distributed RAM AXI interface block...
Assert reset on error in FIFO and hold until end of incoming packet...
Optimised RAM-based single clock packet FIFO.
out out_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream output.
in in_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream input.
out in_pause STD_LOGIC
AXI stream input pause request.
out out_error STD_LOGIC
AXI stream output error (asserted on last)
in rst_clk STD_LOGIC
Synchronous reset.
DATA_WIDTH positive := 64
Width of data for RAM.
out out_valid STD_LOGIC
AXI stream output valid.
in in_last STD_LOGIC
AXI stream input last.
in in_valid STD_LOGIC
AXI stream input valid.
in out_ready STD_LOGIC
AXI stream output ready.
out out_last STD_LOGIC
AXI stream output last.
BUFWIDTH positive := 4
Width of address bus for buffer, i.e. array (0 to 2**BUFWIDTH - 1)
Optimised RAM-based single clock packet FIFO.
out out_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream output.
in in_data STD_LOGIC_VECTOR( DATA_WIDTH- 1 downto 0)
AXI stream input.
MAXWIDTH positive := 5
Parameter for maximum packet size (2**MAXWIDTH - 1) on input or output before trigger reset mechanism...
out out_error STD_LOGIC
AXI stream output error (asserted on last)
in rst_clk STD_LOGIC
Synchronous reset.
out packet_count STD_LOGIC_VECTOR( 15 downto 0)
Number of packets stored in the FIFO.
DATA_WIDTH positive := 64
Width of data for RAM.
in out_pause STD_LOGIC
AXI stream output pause request.
out out_valid STD_LOGIC
AXI stream output valid.
in in_last STD_LOGIC
AXI stream input last.
in in_valid STD_LOGIC
AXI stream input valid.
out fifo_fill_level STD_LOGIC_VECTOR( 15 downto 0)
Number of words stored in the FIFO.
BUFWIDTH positive := 10
Width of address bus for RAM, i.e. array (0 to 2**BUFWIDTH - 1)
out out_last STD_LOGIC
AXI stream output last.
out in_error STD_LOGIC
AXI stream input error.
Instantiate the readout merging and routing FIFO status and control interface to IPBus....
RAW_FIFO_ADDR_MAX_WIDTH positive := 11
address bus width of merged FIFO RAMs after TOB merging
MERGED_FIFO_ADDR_MAX_WIDTH positive := 11
address bus width of TOB FIFO RAM in packet_fifo_block for each Processor FPGA
MAX_PACKET_WIDTH positive := 8
address bus width of RAW FIFO RAM in packet_fifo_block for each Processor FPGA address bus width of m...
Switch TTC FIFO data to correct stream depending on destination_enable...