26 use IEEE.STD_LOGIC_1164.
ALL;
30 use IEEE.NUMERIC_STD.
ALL;
31 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
88 CRC20_G_Poly : std_logic_vector(19 downto 0) := x"8349f";
90 bp_width : integer := 64;
91 event_width : integer := 64;
92 header_width : integer := 64
95 Port ( clock : in STD_LOGIC;
97 geo_location : in STD_LOGIC_VECTOR (7 downto 0);
98 s_tdata : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
99 s_tvalid : in STD_LOGIC;
100 s_tlast : in STD_LOGIC;
101 s_header_mark : in STD_LOGIC;
102 s_trailer_mark : in STD_LOGIC;
103 s_hdr_crc_tag : in STD_LOGIC;
104 s_tready : out STD_LOGIC;
105 nxt_chan : out STD_LOGIC;
106 empty_0 : in STD_LOGIC;
107 empty_1 : in STD_LOGIC;
108 empty_2 : in STD_LOGIC;
109 empty_3 : in STD_LOGIC;
111 match_0 : in STD_LOGIC;
112 match_1 : in STD_LOGIC;
113 match_2 : in STD_LOGIC;
114 match_3 : in STD_LOGIC;
118 lead_follow_b : in STD_LOGIC;
119 comb_error : in STD_LOGIC;
121 hdr_match : out STD_LOGIC;
122 poll_chan : out STD_LOGIC;
125 current_chan : in STD_LOGIC_VECTOR (4 downto 0);
126 num_chan : in STD_LOGIC_VECTOR (4 downto 0);
127 chan_in : in STD_LOGIC_VECTOR (4 downto 0);
130 chan_enable : in STD_LOGIC;
133 first_chan : in STD_LOGIC_VECTOR (4 downto 0);
134 last_chan : in STD_LOGIC_VECTOR (4 downto 0);
136 chan_pointer_reset : out STD_LOGIC;
137 any_chan_active : in std_logic;
139 event_sel : in STD_LOGIC_VECTOR (1 downto 0);
140 rod_slot : in std_logic;
141 flx_backpressure : in STD_LOGIC;
142 flx_bp_enable : in STD_LOGIC;
146 TTC_ignore : in STD_LOGIC;
150 master_header : in STD_LOGIC_VECTOR (63 downto 0);
151 header_fifo_empty : in STD_LOGIC;
152 L1ID_error : in STD_LOGIC;
153 CTTC_CRC_error : in STD_LOGIC;
154 header_read_en : out STD_LOGIC;
155 header_fifo_valid : in STD_LOGIC;
156 header_fifo_full : in STD_LOGIC;
157 header_sequence : in STD_LOGIC_VECTOR (11 downto 0);
158 header_type : in STD_LOGIC_VECTOR (3 downto 0);
164 m_tvalid : out STD_LOGIC;
165 m_tlast : out STD_LOGIC;
166 m_tdata : out STD_LOGIC_VECTOR ((bp_width-1) downto 0);
167 m_header_marker : out STD_LOGIC;
168 m_tail_marker : out STD_LOGIC;
169 m_tready : in STD_LOGIC;
171 state_out : out STD_LOGIC_VECTOR(5 DOWNTO 0);
172 event_fifo_level : out STD_LOGIC_VECTOR(31 DOWNTO 0);
173 debug_fifo_level : out STD_LOGIC_VECTOR(31 DOWNTO 0);
175 crc20_err : out STD_LOGIC;
176 crc20_err_chan : out STD_LOGIC_VECTOR (4 downto 0) := "00000";
177 crc9_err : out STD_LOGIC;
178 BCID_mismatch : out STD_LOGIC;
179 l1ID_mismatch : out STD_LOGIC;
180 timeout_err : out STD_LOGIC;
181 timeout_1_val : in STD_LOGIC_VECTOR (15 downto 0);
182 timeout_n_val : in STD_LOGIC_VECTOR (15 downto 0);
183 wdog_overflow : out STD_LOGIC;
184 wdog_threshold : in STD_LOGIC_VECTOR (15 downto 0);
185 wdog_disable : in STD_LOGIC;
186 l1id_resync_enable: in STD_LOGIC;
187 tob_timeout_1_disable : in STD_LOGIC;
188 tob_timeout_n_disable : in STD_LOGIC;
189 ttc_rollover : out std_logic;
190 dbg_pkt_count : out std_logic_VECTOR (31 downto 0);
191 dbg_pkt_count_reset : in STD_LOGIC;
192 L1ID_ttc_32_reg_out : out std_logic_VECTOR (31 downto 0);
193 stop_proc : in std_logic;
195 l1id_max_l1id_o : out std_logic_VECTOR (31 downto 0);
196 l1id_measure_max_o : out std_logic_VECTOR (31 downto 0);
197 l1id_measure_last_o : out std_logic_VECTOR (31 downto 0);
198 clr_pkt_wait_timer : in STD_LOGIC;
201 timeout_counter_max : out std_logic_VECTOR (15 downto 0);
202 max_chan : out std_logic_VECTOR (4 downto 0);
203 clr_max_timeout : in STD_LOGIC
210 component event_builder_fifo
211 Port ( s_axis_tvalid :
in STD_LOGIC;
212 s_axis_tready :
out STD_LOGIC;
213 s_axis_aresetn :
in STD_LOGIC;
214 s_axis_aclk :
in STD_LOGIC;
215 s_axis_tlast :
in STD_LOGIC;
216 s_axis_tuser :
in STD_LOGIC_VECTOR (
1 downto 0);
217 s_axis_tdata :
in STD_LOGIC_VECTOR ((event_width
-1)
downto 0);
219 m_axis_tvalid :
out STD_LOGIC;
220 m_axis_tready :
in STD_LOGIC;
221 m_axis_tlast :
out STD_LOGIC;
222 m_axis_tuser :
out STD_LOGIC_VECTOR (
1 downto 0);
223 m_axis_tdata :
out STD_LOGIC_VECTOR ((event_width
-1)
downto 0);
226 axis_wr_data_count :
out STD_LOGIC_VECTOR (
31 downto 0);
227 axis_rd_data_count :
out STD_LOGIC_VECTOR (
31 downto 0)
236 COMPONENT event_fifo_ila
243 probe0 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
244 probe1 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
245 probe2 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
246 probe3 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
247 probe4 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
248 probe5 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
249 probe6 :
IN STD_LOGIC_VECTOR(
63 DOWNTO 0);
250 probe7 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
251 probe8 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
252 probe9 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
253 probe10 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
254 probe11 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
255 probe12 :
IN STD_LOGIC_VECTOR(
63 DOWNTO 0);
256 probe13 :
IN STD_LOGIC_VECTOR(
5 DOWNTO 0)
260 COMPONENT ILA_ev_builder
267 probe0 :
IN STD_LOGIC_VECTOR(
5 DOWNTO 0);
268 probe1 :
IN STD_LOGIC_VECTOR(
4 DOWNTO 0);
269 probe2 :
IN STD_LOGIC_VECTOR(
4 DOWNTO 0);
270 probe3 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
271 probe4 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
272 probe5 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
273 probe6 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
274 probe7 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
275 probe8 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
276 probe9 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
277 probe10 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
278 probe11 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
279 probe12 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
280 probe13 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
281 probe14 :
IN STD_LOGIC_VECTOR(
23 DOWNTO 0);
282 probe15 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
283 probe16 :
IN STD_LOGIC_VECTOR(
11 DOWNTO 0);
284 probe17 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
285 probe18 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
286 probe19 :
IN STD_LOGIC_VECTOR(
15 DOWNTO 0);
287 probe20 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
288 probe21 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
289 probe22 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
290 probe23 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
291 probe24 :
IN STD_LOGIC_VECTOR(
15 DOWNTO 0);
292 probe25 :
IN STD_LOGIC_VECTOR(
63 DOWNTO 0);
293 probe26 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
294 probe27 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
295 probe28 :
IN STD_LOGIC_VECTOR(
15 DOWNTO 0);
296 probe29 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0)
301 COMPONENT rx_time_ila
308 probe0 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
309 probe1 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
310 probe2 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
311 probe3 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
312 probe4 :
IN STD_LOGIC_VECTOR(
31 DOWNTO 0);
313 probe5 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
314 probe6 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0);
315 probe7 :
IN STD_LOGIC_VECTOR(
0 DOWNTO 0)
319 component header_fifo
320 Port ( clk :
in STD_LOGIC;
322 din :
in STD_LOGIC_VECTOR ((header_width
-1)
downto 0);
323 wr_en :
in STD_LOGIC;
324 rd_en :
in STD_LOGIC;
325 full :
out STD_LOGIC;
326 empty :
out STD_LOGIC;
327 dout :
out STD_LOGIC_VECTOR ((header_width
-1)
downto 0)
333 clock :
in STD_LOGIC;
334 crc_reset :
in STD_LOGIC;
335 s_tdata :
in STD_LOGIC_VECTOR (
63 downto 0);
336 crc_start :
in STD_LOGIC;
337 header_mismatch :
out std_logic
343 clock :
in STD_LOGIC;
344 crc_reset :
in STD_LOGIC;
345 BCN :
in STD_LOGIC_VECTOR (
11 downto 0);
346 version :
in STD_LOGIC_VECTOR (
2 downto 0);
347 tob_stream_id :
in STD_LOGIC_VECTOR (
7 downto 0);
348 ECRID :
in STD_LOGIC_VECTOR (
7 downto 0);
349 L1ID :
in STD_LOGIC_VECTOR (
23 downto 0);
351 header_reg_1 :
in STD_LOGIC_VECTOR (
31 downto 0);
352 header_reg_2 :
in STD_LOGIC_VECTOR (
31 downto 0);
353 crc_start :
in STD_LOGIC;
354 load_hdr_reg :
in STD_LOGIC;
355 CRC_out :
out STD_LOGIC_VECTOR (
8 downto 0);
356 hdr_out_crc9_valid :
out STD_Logic
363 crc20_G_Poly :
std_logic_vector(
19 downto 0) := x"
8349f";
364 Nbits :
positive :=
64;
365 CRC_Width :
positive :=
20;
366 G_Poly:
Std_Logic_Vector :=x
"c1acf";
367 G_InitVal:
std_logic_vector:=x
"fffff"
370 CRC :
out std_logic_vector(CRC_Width
-1 downto 0);
372 Clock :
in std_logic;
373 s_tdata :
in std_logic_vector(Nbits
-1 downto 0);
374 crc_reset :
in std_logic;
375 sel_packet_trailer :
in std_logic
381 Nbits :
positive :=
64;
382 CRC_Width :
positive :=
9;
385 G_Poly:
Std_Logic_Vector := "
011111011";
386 G_InitVal:
std_logic_vector:= "
111111111"
389 CRC :
out std_logic_vector(CRC_Width
-1 downto 0);
392 DIn :
in std_logic_vector(Nbits
-1 downto 0);
393 Reset :
in std_logic);
401 pp_clock :
in STD_LOGIC;
402 reset :
in STD_LOGIC;
403 current_chan :
in STD_LOGIC_VECTOR (
4 downto 0);
404 chan_len_error :
in STD_LOGIC;
405 chan_hdr_crc_err :
in STD_LOGIC;
406 chan_crc20_err :
in STD_LOGIC;
407 L1ID_eq :
in STD_LOGIC;
408 chan_crc20_samp :
in STD_LOGIC;
409 crc9_err_samp :
in STD_LOGIC;
410 len_err_samp :
in STD_LOGIC;
411 L1ID_eq_samp :
in STD_LOGIC;
412 timeout_error :
in STD_LOGIC;
413 clear_map :
in STD_LOGIC;
414 sel_corr_trailer :
in STD_LOGIC;
415 error_map :
out STD_LOGIC_VECTOR(
11 downto 0);
416 lmem :
out STD_LOGIC_VECTOR(
3 downto 0);
417 rod_err_map :
out STD_LOGIC_VECTOR(
6 downto 0);
418 debug_pkt_module_map:
out STD_LOGIC_VECTOR(
11 downto 0)
424 Port ( clock :
in STD_LOGIC;
425 reset :
in STD_LOGIC;
426 start_timer :
in STD_LOGIC;
427 stop_timer :
in STD_LOGIC;
428 set_time_1 :
in STD_LOGIC_VECTOR(
15 downto 0);
429 set_time_n :
in STD_LOGIC_VECTOR(
15 downto 0);
430 timeout_1 :
out STD_LOGIC;
431 timeout_n :
out STD_LOGIC;
432 counter_out :
out STD_LOGIC_VECTOR(
15 downto 0);
433 run_out :
out STD_LOGIC
438 generic ( overflow_clock_count :
std_logic_vector(
7 downto 0) := x"
0f"
440 Port ( pp_clock :
in STD_LOGIC;
441 reset_in :
in STD_LOGIC;
442 wdog_disable :
in STD_LOGIC;
443 wdog_pet :
in STD_LOGIC;
444 wdog_threshold :
in STD_LOGIC_VECTOR (
15 downto 0);
445 wdog_overflow :
out STD_LOGIC
449 signal s_axis_aresetn : std_logic;
456 signal tob_data_count : STD_LOGIC_VECTOR (31 downto 0);
457 signal tob_wr_data_count : STD_LOGIC_VECTOR (31 downto 0);
458 signal tob_rd_data_count : STD_LOGIC_VECTOR (31 downto 0);
459 signal hp_empty : std_logic;
460 signal no_other_match : std_logic;
461 signal hdr_reg_valid : std_logic := '0';
462 signal header_reg : STD_LOGIC_VECTOR ((bp_width-1) downto 0);
463 signal header_reg_ex : STD_LOGIC_VECTOR ((header_width-bp_width) downto 0);
465 signal empty_out : std_logic := '1';
466 signal poll : std_logic := '0';
467 signal inc_chan : std_logic := '0';
468 signal match_out : std_logic := '0';
469 signal read_active : std_logic := '0';
471 signal load_last_chan : std_logic;
472 signal load_hdr_reg : std_logic;
473 signal fifo_s_tvalid : std_logic;
474 signal fifo_s_tlast : std_logic;
476 signal current_state : state_type;
477 signal next_state : state_type;
478 signal next1 : state_type;
479 signal ctrl_code : controls_type;
481 signal chan_len_cnt : STD_LOGIC_VECTOR (11 downto 0) := "000000000000";
482 signal corrected_length : STD_LOGIC_VECTOR (15 downto 0) := x"0000";
483 signal pkt_len_cnt : STD_LOGIC_VECTOR (15 downto 0) := x"0000";
484 signal pkt_len_cnt_dly : STD_LOGIC_VECTOR (15 downto 0) := x"0000";
486 signal fifo_s_tready : std_logic;
487 signal hdr_fifo_wr : std_logic;
488 signal rod_header : STD_LOGIC_VECTOR (63 downto 0);
489 signal lead_follow_b_reg : std_logic;
490 signal sel_packet_header : std_logic;
491 signal sel_packet_header_2 : std_logic;
492 signal sel_packet_trailer : std_logic;
493 signal chan_len_error : std_logic:= '0';
494 signal dbg_chan_len_error : std_logic:= '0';
495 signal trailer_crc20_calc : std_logic;
496 signal trailer_crc20_reset : std_logic;
497 signal chan_trailer_crc20_calc : std_logic;
498 signal chan_trailer_crc20_reset : std_logic;
499 signal proposed_crc20 : STD_LOGIC_VECTOR (19 downto 0);
500 signal hdr_out_crc9_start : std_logic;
501 signal hdr_out_crc9_valid : std_logic;
502 signal trailer_crc20 : STD_LOGIC_VECTOR (19 downto 0);
503 signal chan_crc20_err : std_logic;
504 signal timeout_error : std_logic;
505 signal dbg_timeout_error : std_logic;
506 signal chan_trailer_crc20 : STD_LOGIC_VECTOR (19 downto 0);
507 signal fifo_s_tdata : STD_LOGIC_VECTOR (bp_width-1 downto 0);
508 signal evnt_sel : STD_LOGIC_VECTOR (3 downto 0);
509 signal next_chan : STD_LOGIC_VECTOR (4 downto 0);
510 signal L1ID_eq : std_logic;
511 signal L1ID_reg_eq : std_logic;
512 signal L1ID_reg_lt : std_logic;
513 signal L1ID_reg_gt : std_logic;
514 signal L1ID_eq_pipe : std_logic;
515 signal BCN : STD_LOGIC_VECTOR (11 downto 0);
516 signal BCID_reg : STD_LOGIC_VECTOR (11 downto 0);
518 signal L1ID : STD_LOGIC_VECTOR (23 downto 0);
519 signal ECRID : STD_LOGIC_VECTOR (7 downto 0);
520 signal orbit : STD_LOGIC_VECTOR (15 downto 0);
521 signal header_reg_0 : STD_LOGIC_VECTOR (31 downto 0);
522 signal header_reg_1 : STD_LOGIC_VECTOR (31 downto 0);
523 signal header_reg_2 : STD_LOGIC_VECTOR (31 downto 0);
524 signal version : STD_LOGIC_VECTOR (2 downto 0);
525 signal pkt_type : STD_LOGIC_VECTOR (3 downto 0);
526 signal header_crc : STD_LOGIC_VECTOR (8 downto 0);
527 signal h_sequence : STD_LOGIC_VECTOR (11 downto 0);
528 signal tob_stream_id : STD_LOGIC_VECTOR (7 downto 0);
531 signal chan_hdr_crc_err : std_logic;
532 signal header_crc_start : std_logic;
534 signal rod_number : STD_LOGIC_VECTOR (1 downto 0);
535 signal rod_link_error_map : STD_LOGIC_VECTOR (11 downto 0);
536 signal rod_error_map : STD_LOGIC_VECTOR (6 downto 0);
538 signal dbg_link_error_map : STD_LOGIC_VECTOR (11 downto 0);
539 signal dbg_error_map : STD_LOGIC_VECTOR (6 downto 0);
541 signal corr_trail_chan : STD_LOGIC_VECTOR (4 downto 0) := "00000";
543 signal LMEM : STD_LOGIC_VECTOR (3 downto 0);
544 signal dbg_LMEM : STD_LOGIC_VECTOR (3 downto 0);
546 signal event_trailer : STD_LOGIC_VECTOR (63 downto 0);
547 signal corr_trailer : STD_LOGIC_VECTOR (63 downto 0);
548 signal L1ID_ttc_hreg : STD_LOGIC_VECTOR (23 downto 0);
549 signal L1id_ttc_32_reg : STD_LOGIC_VECTOR (31 downto 0);
550 signal ECRID_ttc_hreg : STD_LOGIC_VECTOR (7 downto 0);
552 signal S_tdata_swap : STD_LOGIC_VECTOR (63 downto 0);
554 signal m_tdata_i : STD_LOGIC_VECTOR (63 downto 0);
555 signal m_tvalid_i : STD_LOGIC;
556 signal m_tlast_i : STD_LOGIC;
557 signal m_header_marker_i : STD_LOGIC;
558 signal m_tail_marker_i : STD_LOGIC;
559 signal state : state_type;
562 signal tob_m_tvalid_i : STD_LOGIC;
563 signal tob_m_tlast_i : STD_LOGIC;
564 signal tob_m_tready : STD_LOGIC;
565 signal tob_m_header_marker_i : STD_LOGIC;
566 signal tob_m_tail_marker_i : STD_LOGIC;
567 signal tob_m_tdata_i : STD_LOGIC_VECTOR (63 downto 0);
569 signal s_tlast_del : STD_LOGIC;
570 signal s_tlast_del2 : STD_LOGIC;
576 signal dbg_s_tvalid : STD_LOGIC;
577 signal dbg_s_tlast : STD_LOGIC;
578 signal dbg_s_tready : STD_LOGIC;
579 signal dbg_s_tdata : STD_LOGIC_VECTOR (63 downto 0);
580 signal dbg_header_reg : STD_LOGIC_VECTOR (63 downto 0);
581 signal dbg_header_reg_tmp : STD_LOGIC_VECTOR (63 downto 0);
582 signal dbg_corr_trailer : STD_LOGIC_VECTOR (63 downto 0);
583 signal dbg_stream_id : STD_LOGIC_VECTOR (7 downto 0);
585 signal dbg_m_tvalid_i : STD_LOGIC;
586 signal dbg_m_tlast_i : STD_LOGIC;
587 signal dbg_m_tready : STD_LOGIC;
588 signal dbg_m_header_marker_i : STD_LOGIC;
589 signal dbg_m_tail_marker_i : STD_LOGIC;
590 signal dbg_m_tdata_i : STD_LOGIC_VECTOR (63 downto 0);
592 signal dbg_crc9_in_flip : STD_LOGIC_VECTOR (63 downto 0);
594 signal dbg_hdr_CRC : STD_LOGIC_VECTOR (8 downto 0);
595 signal dbg_crc9_calc : STD_LOGIC;
596 signal dgb_crc9_reset : STD_LOGIC;
597 signal hdr_in_crc9_reset : STD_LOGIC;
598 signal dbg_sel : STD_LOGIC_VECTOR (1 downto 0);
599 signal sel_dbg_header : STD_LOGIC;
600 signal sel_dbg_trailer : STD_LOGIC;
601 signal sel_corr_trailer : STD_LOGIC;
603 signal dbg_trailer_CRC : STD_LOGIC_VECTOR (19 downto 0);
604 signal dbg_crc20_calc : STD_LOGIC;
605 signal dbg_crc20_in_flip : STD_LOGIC_VECTOR (63 downto 0);
606 signal dgb_crc20_reset : STD_LOGIC;
607 signal dbg_LenCount_Ena : STD_LOGIC;
608 signal dbg_LenCount_Rst : STD_LOGIC;
609 signal dbg_LenCount : STD_LOGIC_VECTOR (14 downto 0);
610 signal dbg_chan_LenCount : STD_LOGIC_VECTOR (11 downto 0);
611 signal dbg_pkt_count_i : STD_LOGIC_VECTOR (31 downto 0);
612 signal tobsel : STD_LOGIC;
613 signal corr_trailer_len_flag : STD_LOGIC;
614 signal corr_trailer_pe_flag : STD_LOGIC;
616 signal chan_crc_dmux_ctrl : STD_LOGIC;
617 signal chan_crc_dmux_data : STD_LOGIC_VECTOR (63 downto 0);
618 signal chan_crc_din : STD_LOGIC_VECTOR (63 downto 0);
621 signal m_tdata_buf : STD_LOGIC_VECTOR (63 downto 0);
622 signal m_tvalid_buf : STD_LOGIC;
623 signal m_tlast_buf : STD_LOGIC;
624 signal m_header_marker_buf : STD_LOGIC;
625 signal m_tail_marker_buf : STD_LOGIC;
627 signal tob_pkt_active : STD_LOGIC;
629 signal timeout_1 : STD_LOGIC;
630 signal timeout_n : STD_LOGIC;
631 signal stop_timeout : STD_LOGIC;
632 signal timeout_counter : STD_LOGIC_VECTOR (15 downto 0);
633 signal timeout_run : STD_LOGIC;
635 signal pet_timer : STD_LOGIC;
636 signal clr_build_flag : STD_LOGIC;
637 signal set_build_flag : STD_LOGIC;
638 signal clr_chan_len_cnt : STD_LOGIC;
639 signal inc_corr_counter : STD_LOGIC;
640 signal build_flag : STD_LOGIC;
641 signal last_chan_read : STD_LOGIC;
642 signal any_chan_read : STD_LOGIC;
643 signal chan_enable_del : STD_LOGIC;
645 signal finished_lc : STD_LOGIC;
647 signal reference_lid_0 : STD_LOGIC;
649 signal set_bad_l1id_flag : STD_LOGIC;
650 signal bad_l1id_flag : STD_LOGIC;
651 signal l1id_resync_flag : STD_LOGIC;
653 signal shelf : STD_LOGIC_VECTOR(3 downto 0);
654 signal wdog_pet : STD_LOGIC;
655 signal wdog_overflow_i : STD_LOGIC;
657 signal tempsig : std_logic;
659 signal efex_shelf_num : STD_LOGIC_VECTOR(1 downto 0);
660 signal set_empty_packet_build : std_logic;
661 signal empty_pkt_active : std_logic := '0';
664 signal ttc_rollover_sig : std_logic := '0';
665 signal ttc_rollover_reg : std_logic := '0';
668 signal rx_timer_clear : std_logic := '0';
669 signal l1id_measure_lock : std_logic := '0';
670 signal header_fifo_valid_del : std_logic := '0';
671 signal l1id_measure_reg : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
672 signal l1id_measure_time : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
673 signal l1id_measure_last : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
674 signal l1id_measure_max : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
675 signal l1id_max_l1id : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
676 signal l1id_measure_last_i : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
677 signal l1id_measure_max_i : STD_LOGIC_VECTOR(31 downto 0) := x"0000_0000";
681 signal timeout_1_raw : std_logic := '0';
682 signal timeout_n_raw : std_logic := '0';
684 signal timeout_counter_max_i : STD_LOGIC_VECTOR(15 downto 0) := x"0000";
685 signal max_chan_i : STD_LOGIC_VECTOR(4 downto 0);
686 signal hdr_crc_flag : std_logic := '0';
692 tob_stream_id <= x"01";
693 shelf <= geo_location(4 downto 1);
702 efex_shelf_num <= "00" when "0000",
708 generic map (StWIDTH
)
714 state <= current_state;
715 state_out <= current_state;
717 event_fifo: event_builder_fifo
720 s_axis_tvalid => fifo_s_tvalid,
721 s_axis_tready => fifo_s_tready,
722 s_axis_aresetn => s_axis_aresetn,
723 s_axis_aclk => clock,
724 s_axis_tlast => fifo_s_tlast,
727 s_axis_tuser
(1) => sel_packet_header,
728 s_axis_tuser
(0) => sel_packet_trailer,
731 s_axis_tdata => fifo_s_tdata,
733 m_axis_tvalid => tob_m_tvalid_i,
734 m_axis_tlast => tob_m_tlast_i,
735 m_axis_tready => tob_m_tready,
736 m_axis_tuser
(1) => tob_m_header_marker_i,
737 m_axis_tuser
(0) => tob_m_tail_marker_i,
738 m_axis_tdata => tob_m_tdata_i,
741 axis_wr_data_count => tob_wr_data_count,
742 axis_rd_data_count => tob_rd_data_count
745 s_axis_aresetn <= not reset;
746 event_fifo_level <= tob_wr_data_count;
771 process (clock)
begin
772 if rising_edge (clock) then
773 m_tdata_buf <= m_tdata_i;
774 m_tvalid_buf <= m_tvalid_i;
775 m_tlast_buf <= m_tlast_i;
776 m_header_marker_buf <= m_header_marker_i;
777 m_tail_marker_buf <= m_tail_marker_i;
781 m_tdata <= m_tdata_buf;
782 m_tvalid <= m_tvalid_buf;
783 m_tlast <= m_tlast_buf;
784 m_header_marker <= m_header_marker_buf;
785 m_tail_marker <= m_tail_marker_buf;
803 hp_empty <= not (empty_0 or empty_1 or empty_2 or empty_3);
806 no_other_match <= not (match_0 or match_1 or match_2 or match_3);
848 case current_state is
855 when wait_for_event =>
856 if (((flx_backpressure and flx_bp_enable) = '1') or (stop_proc = '1')) then
857 next1 <= wait_for_event;
858 elsif header_fifo_valid = '1' then
861 next1 <= wait_for_event;
863 ctrl_code <= wait_for_event_o;
873 ctrl_code <= read_ttc_o;
885 next1 <= check_enable;
886 ctrl_code <= chan_timeout_o;
901 if (chan_enable = '0') and (current_chan = num_chan) and (any_chan_read = '1') then
902 next1 <= trailer_build_2;
904 elsif (chan_enable = '0') and (current_chan /= num_chan) then
905 next1 <= chan_timeout;
909 ctrl_code <= check_enable_o;
918 when discard_event =>
919 next1 <= wait_for_event;
920 ctrl_code <= discard_event_o;
978 if (timeout_1 = '1') and (current_chan = first_chan) then
979 if (current_chan = num_chan) then
980 next1 <= start_empty_pkt;
982 next1 <= chan_timeout;
985 elsif (timeout_n = '1') and ((s_tvalid = '0')) and (current_chan > first_chan) then
987 if (current_chan = num_chan) and (tob_pkt_active = '0') then
991 next1 <= start_empty_pkt;
993 else next1 <= chan_timeout;
996 elsif ((lead_follow_b_reg ='1') or (current_chan < chan_in) or ((current_chan = num_chan) and (chan_in >= first_chan)and chan_in /= num_chan))
997 and (s_tvalid = '1') and (s_header_mark = '1') and (s_hdr_crc_tag = '0') and (comb_error = '0') then
999 if (L1ID_reg_eq = '1') then
1000 next1 <= start_reading;
1005 elsif (L1ID_reg_lt = '1') then
1006 next1 <= dbg_bad_l1ID;
1008 elsif (L1ID_reg_gt = '1') then
1011 next1 <= chan_timeout;
1014 next1 <= dbg_header_build;
1019 elsif ((lead_follow_b_reg ='1') or (current_chan < chan_in) or ((current_chan = num_chan) and (chan_in >= first_chan)and chan_in /= num_chan))
1020 and (s_tvalid = '1') and (s_header_mark = '1') and (s_hdr_crc_tag = '1') and (comb_error = '0')
1021 then next1 <= dbg_header_build;
1024 next1 <= idle_state;
1033 ctrl_code <= idle_o;
1059 if ((L1ID_eq = '1') or (TTC_ignore = '1')) and (s_tvalid = '1') and (s_header_mark = '1') and (comb_error = '0') then
1060 next1 <= start_reading;
1063 elsif ((L1ID_eq = '0') AND (TTC_ignore = '0')) and (s_tvalid = '1') and (s_header_mark = '1') and (comb_error = '0') then
1065 next1 <= dbg_bad_l1ID;
1074 next1 <= chan_timeout;
1076 ctrl_code <= load_header_o;
1090 when start_reading =>
1091 next1 <= header_build;
1092 ctrl_code <= start_reading_o;
1102 when header_build =>
1103 next1 <= header_build_2;
1104 ctrl_code <= header_build_o;
1115 when header_build_2 =>
1123 if (empty_pkt_active = '1') then
1124 next1 <= trailer_build_2;
1127 next1 <= continue_reading;
1129 ctrl_code <= header_build_2_o;
1141 when continue_reading =>
1145 if (s_tvalid = '1') and (s_trailer_mark = '1') and (current_chan = num_chan)
1146 then next1 <= trailer_build;
1149 elsif (s_tvalid = '1') and (s_trailer_mark = '1') and (current_chan /= num_chan) then
1150 next1 <= finish_reading;
1152 next1 <= continue_reading;
1154 ctrl_code <= continue_reading_o;
1168 when finish_reading =>
1169 if (next_chan >= chan_in) and (lead_follow_b_reg = '0') then
1170 next1 <= wait_chan_in;
1173 else next1 <= wait_for_hdr;
1175 ctrl_code <= finish_reading_o;
1187 when wait_for_hdr =>
1189 if (chan_enable = '0' and chan_enable_del = '0') then
1190 next1 <= finish_reading;
1191 elsif (chan_enable_del = '1')and (timeout_n = '0') and (timeout_1 = '0') and ((chan_crc20_err = '1') or (chan_len_error = '1')) then
1192 next1 <= pr_corr_trailer;
1194 next1 <= check_error;
1196 ctrl_code <= wait_for_hdr_o;
1215 if (chan_in = current_chan) and (timeout_n = '1')
1216 then next1 <= wait_for_hdr;
1219 elsif (timeout_n = '1') and (s_tvalid = '0') and (current_chan = num_chan) then
1220 if (tob_pkt_active = '1') then
1221 next1 <= trailer_build;
1224 next1 <= discard_event;
1229 elsif (timeout_n = '1') and ((s_tvalid = '0'))
1230 then next1 <= finish_reading;
1235 elsif ((s_tvalid = '1') and (s_header_mark = '1') and (comb_error = '0') and (chan_enable = '1') and (s_hdr_crc_tag = '1')) then
1236 next1 <= dbg_header_build;
1246 elsif ((s_header_mark = '1') and (comb_error = '0') and (chan_enable = '1') and (L1ID_reg_eq = '0')) and (L1ID_ttc_32_reg < s_tdata (63 downto 32)) and (l1id_resync_enable = '1') then
1247 if (current_chan = num_chan) and (tob_pkt_active = '1') then
1248 next1 <= trailer_build;
1250 next1 <= finish_reading;
1253 elsif (L1ID_reg_gt = '1') then
1256 next1 <= finish_reading;
1260 elsif ((s_tvalid = '1') and (s_header_mark = '1') and (comb_error = '0') and (chan_enable = '1') and ((L1ID_reg_eq = '0') or (s_hdr_crc_tag = '1'))) then
1263 next1 <= dbg_bad_l1ID;
1267 elsif ((s_tvalid = '1') and (s_header_mark = '1') and (comb_error = '0') and (chan_enable = '1') and (s_hdr_crc_tag = '0') and (L1ID_reg_eq = '1')) then
1268 next1 <= poll_early;
1271 elsif (chan_enable = '0') and (current_chan /= num_chan) then
1272 next1 <= finish_reading;
1275 elsif (chan_enable = '0') and (current_chan = num_chan) then
1276 next1 <= trailer_build;
1279 next1 <= check_error;
1311 ctrl_code <= check_error_o;
1321 next1 <= continue_polling;
1322 ctrl_code <= poll_early_o;
1335 when continue_polling =>
1338 if ((l1ID_reg_eq = '1') or (TTC_ignore = '1')) and (s_tvalid = '1') and (s_header_mark = '1') and (comb_error = '0') and (chan_enable = '1') and (s_hdr_crc_tag = '0') then
1340 next1 <= header_blocking;
1351 elsif (chan_enable = '0') then
1352 if (current_chan = num_chan) then
1353 next1 <= trailer_build;
1355 next1 <= finish_reading;
1358 next1 <= check_error;
1364 ctrl_code <= continue_polling_o;
1370 when header_blocking =>
1372 next1 <= continue_reading;
1373 ctrl_code <= header_blocking_o;
1380 when trailer_build =>
1381 next1 <= eval_chan_crc20;
1382 ctrl_code <= trailer_build_o;
1392 when eval_chan_crc20 =>
1396 if ((timeout_n = '1') and (current_chan = num_chan) and (tob_pkt_active = '1')) then
1397 next1 <= trailer_build_2;
1400 elsif ((chan_crc20_err = '1') or (chan_len_error = '1')) then
1401 next1 <= pr_corr_trlr_lc;
1403 next1 <= trailer_build_2;
1405 ctrl_code <= eval_chan_crc20_o;
1414 when trailer_build_2 =>
1418 next1 <= trailer_build_3;
1420 ctrl_code <= trailer_build_2_o;
1431 when trailer_build_3 =>
1432 next1 <= trailer_mux;
1433 ctrl_code <= trailer_build_3_o;
1442 next1 <= wait_for_event;
1443 ctrl_code <= trailer_mux_o;
1456 when wait_chan_in =>
1457 if (next_chan >= chan_in) then next1 <= wait_chan_in;
1458 else next1 <= continue_polling;
1460 ctrl_code <= wait_chan_in_o;
1465 when pr_corr_trailer =>
1466 next1 <= wait_corr_crc;
1467 ctrl_code <= pr_corr_trailer_o;
1471 when wait_corr_crc =>
1472 next1 <= add_corr_trailer;
1473 ctrl_code <= wait_corr_crc_o;
1477 when add_corr_trailer =>
1478 if (current_chan = num_chan) and (last_chan_read = '1') then
1479 next1 <= trailer_build_3;
1481 next1 <= check_error;
1483 ctrl_code <= add_corr_trailer_o;
1501 when pr_corr_trlr_lc =>
1502 next1 <= wait_corr_crc_lc;
1503 ctrl_code <= pr_corr_trlr_lc_o;
1507 when wait_corr_crc_lc =>
1508 next1 <= add_corr_trlr_lc;
1509 ctrl_code <= wait_corr_crc_lc_o;
1513 when add_corr_trlr_lc =>
1514 if (current_chan = num_chan) and (last_chan_read = '1') then
1515 next1 <= trailer_build_2;
1517 next1 <= check_error;
1519 ctrl_code <= add_corr_trlr_lc_o;
1530 when dbg_header_build =>
1531 next1 <= dbg_header_load;
1532 ctrl_code <= dbg_header_build_o;
1536 when dbg_header_load =>
1538 next1 <= dbg_pkt_load_1st;
1539 ctrl_code <= dbg_header_load_o;
1545 when dbg_pkt_load_1st =>
1546 if (s_tvalid = '1') and (s_trailer_mark = '1') then
1547 next1 <= dbg_trailer_build;
1549 next1 <= dbg_packet_load;
1551 ctrl_code <= dbg_pkt_load_1st_o;
1555 when dbg_packet_load =>
1556 if (s_tvalid = '1') and (s_trailer_mark = '1') then
1557 next1 <= dbg_trailer_build;
1559 next1 <= dbg_packet_load;
1561 ctrl_code <= dbg_packet_load_o;
1565 when dbg_trailer_build =>
1566 next1 <= dbg_trail_build_2;
1567 ctrl_code <= dbg_trailer_build_o;
1571 when dbg_trail_build_2 =>
1572 next1 <= dbg_trail_build_3;
1573 ctrl_code <= dbg_trail_build_2_o;
1594 when dbg_trail_build_3 =>
1596 if (current_chan = first_chan) and (bad_l1id_flag = '1') and (s_tvalid = '0' and s_header_mark = '0' and timeout_1 = '1') then
1598 next1 <= dbg_trlr_inc_chan;
1602 elsif (current_chan = first_chan) and timeout_1 = '0' then
1603 next1 <= dbg_trlr_ld_last;
1605 elsif (current_chan = num_chan) and (bad_l1id_flag = '1') and (s_tvalid = '0' and s_header_mark = '0') then
1606 next1 <= dbg_trlr_ld_last;
1609 elsif (current_chan /= num_chan) and (current_chan /= first_chan)and (hdr_crc_flag = '1') then
1610 next1 <= dbg_trlr_inc_chan;
1633 elsif (current_chan < num_chan) and (bad_l1id_flag = '1') then
1634 next1 <= dbg_trlr_ld_last;
1636 elsif (((current_chan = num_chan) and (tob_pkt_active = '1')) or (bad_l1id_flag = '1' and s_tvalid = '1' and s_header_mark = '1' and timeout_n = '0') ) then
1637 next1 <= dbg_trlr_ld_last;
1639 elsif(current_chan = num_chan) and (tob_pkt_active = '0') and (bad_l1id_flag = '1') then
1640 next1 <= dbg_trlr_ld_last;
1646 next1 <= dbg_trlr_inc_chan;
1649 ctrl_code <= dbg_trail_build_3_o;
1653 when dbg_trlr_inc_chan =>
1654 next1 <= dbg_trailer_load;
1655 ctrl_code <= dbg_trlr_inc_chan_o;
1659 when dbg_trailer_load =>
1661 if (tob_pkt_active = '0') then
1662 next1 <= idle_state;
1664 elsif (current_chan /= first_chan) then
1665 next1 <= check_error;
1676 next1 <= wait_for_event;
1679 ctrl_code <= dbg_trailer_load_o;
1683 when dbg_trlr_ld_last =>
1685 if (current_chan = first_chan) then
1686 next1 <= idle_state;
1687 elsif (current_chan < num_chan) then
1688 next1 <= dbg_wait_for_hdr;
1691 elsif (current_chan = num_chan) and (tob_pkt_active = '1') and (bad_l1id_flag = '0') then
1692 next1 <= trailer_build_2;
1698 elsif (current_chan = num_chan) and (tob_pkt_active = '1') and (bad_l1id_flag = '1') and (s_tvalid = '1') then
1699 next1 <= check_error;
1701 elsif (current_chan = num_chan) and (tob_pkt_active = '1') and (bad_l1id_flag = '1') and (s_tvalid = '0') then
1702 next1 <= trailer_build_2;
1705 elsif (current_chan = num_chan) and (tob_pkt_active = '0') and (bad_l1id_flag = '1') and (l1id_resync_flag = '1') then
1707 next1 <= attempt_resync;
1709 elsif (current_chan = num_chan) and (tob_pkt_active = '0') and (bad_l1id_flag = '1') and (l1id_resync_flag = '0') then
1710 next1 <= wait_for_event;
1717 next1 <= wait_for_event;
1720 ctrl_code <= dbg_trlr_ld_last_o;
1725 when dbg_bad_l1ID =>
1726 next1 <= dbg_header_load;
1727 ctrl_code <= dbg_bad_l1ID_o;
1740 when start_empty_pkt =>
1741 next1 <= header_build;
1742 ctrl_code <= start_empty_pkt_o;
1751 when attempt_resync =>
1752 next1 <= await_resync;
1754 ctrl_code <= attempt_resync_o;
1758 when await_resync =>
1759 next1 <= idle_state;
1761 ctrl_code <= await_resync_o;
1769 when dbg_wait_for_hdr =>
1770 next1 <= check_error;
1772 ctrl_code <= dbg_wait_for_hdr_o;
1775 when others => next1 <= wait_for_event;
ctrl_code <=wait_for_event_o;
1783 next_state <= wait_for_event when ((reset = '1') or (wdog_overflow_i = '1')) else next1;
1791 chan_pointer_reset <= ctrl_code(21);
1792 sel_corr_trailer <= ctrl_code(20);
1793 inc_corr_counter <= ctrl_code(19);
1794 clr_chan_len_cnt <= ctrl_code(18);
1795 clr_build_flag <= ctrl_code(17);
1796 set_build_flag <= ctrl_code(
16);
1797 fifo_s_tvalid <= ctrl_code(15);
1798 fifo_s_tlast <= ctrl_code(14);
1799 load_hdr_reg <= ctrl_code(13);
1800 hdr_reg_valid <= ctrl_code(12);
1801 poll <= ctrl_code(11);
1802 inc_chan <= ctrl_code(10);
1803 load_last_chan <= ctrl_code(9);
1804 sel_packet_header <= ctrl_code(8);
1805 sel_packet_header_2 <= ctrl_code(7);
1806 sel_packet_trailer <= ctrl_code(6);
1807 trailer_crc20_calc <= ctrl_code(5);
1808 trailer_crc20_reset <= ctrl_code(4);
1810 pet_timer <= ctrl_code(3);
1812 hdr_out_crc9_start <= ctrl_code(2);
1813 chan_trailer_crc20_calc <= ctrl_code(1);
1814 chan_trailer_crc20_reset <= ctrl_code(0);
1820 process (clock)
begin
1821 if rising_edge (clock) then
1822 if (reset = '1') then
1823 lead_follow_b_reg <= lead_follow_b;
1824 elsif (current_state = trailer_mux) then
1827 lead_follow_b_reg <= '1';
1832 BCN <= master_header(11 downto 0);
1833 L1ID <= master_header(35 downto 12);
1834 ECRID <= master_header(43 downto 36);
1835 ORBIT <= master_header(59 downto 44);
1842 h_sequence <= header_sequence;
1844 pkt_type <= header_type;
1858 process (clock)
begin
1859 if rising_edge (clock) then
1860 if load_hdr_reg = '1' then
1862 header_reg_0(7 downto 0) <= tob_stream_id;
1863 header_reg_0(19 downto 8) <= BCN;
1864 header_reg_0(28 downto 20) <= (others => '0');
1865 header_reg_0(31 downto 29) <= version;
1866 header_reg_1(23 downto 0) <= L1ID;
1867 header_reg_1(31 downto 24) <= ECRID;
1868 header_reg_2(3 downto 0) <= pkt_type;
1869 header_reg_2(15 downto 4) <= h_sequence;
1870 header_reg_2(31 downto 16) <= ORBIT;
1872 header_reg_0 <= header_reg_0;
1873 header_reg_1 <= header_reg_1;
1874 header_reg_2 <= header_reg_2;
1879 header_read_en <=load_hdr_reg;
1880 L1ID_ttc_hreg <= header_reg_1(23 downto 0);
1881 ECRID_ttc_hreg <= header_reg_1(31 downto 24);
1882 L1ID_ttc_32_reg <= header_reg_1(31 downto 0);
1883 L1ID_ttc_32_reg_out <= header_reg_1(31 downto 0);
1884 BCID_reg <= header_reg_0(19 downto 8);
1894 L1ID_eq <= '1' when (((ECRid & L1ID) = s_tdata(63 downto 32)) or (TTC_ignore = '1')) else '0';
1895 L1ID_reg_eq <= '1' when ((s_tdata(63 downto 32) = L1ID_ttc_32_reg(31 downto 0)) or (TTC_ignore = '1')) else '0';
1896 L1ID_reg_lt <= '1' when ((s_tdata(63 downto 32) < L1ID_ttc_32_reg(31 downto 0)) and (TTC_ignore = '0')) else '0';
1901 L1ID_reg_gt <= '1' when (((s_tdata(63 downto 32) > L1ID_ttc_32_reg(31 downto 0)) and (s_tdata(63 downto 32) <= L1ID_ttc_32_reg(31 downto 0) + 4)) and (TTC_ignore = '0')) and (L1ID_ttc_32_reg /= 32x"0") else '0';
1904 Process(clock)
begin
1905 if rising_edge (clock) then
1906 if (reset = '1') then
1907 ttc_rollover_sig <= '0';
1908 elsif (ECRid & l1id) < l1id_ttc_32_reg then
1909 ttc_rollover_sig <= '1';
1911 ttc_rollover_sig <= '0';
1917 Process(clock)
begin
1918 if rising_edge (clock) then
1919 if (reset = '1') then
1920 ttc_rollover_reg <= '0';
1922 ttc_rollover_reg <= ttc_rollover_sig;
1927 ttc_rollover <= ttc_rollover_sig and not ttc_rollover_reg;
1930 BCID_mismatch <= '1' when ((BCID_reg /= s_tdata(19 downto 8)) and (poll_chan = '1')) else '0';
1934 process (clock)
begin
1935 if rising_edge (clock) then
1936 L1ID_eq_pipe <= L1ID_reg_eq;
1942 with rod_slot select
1943 rod_number <= "00" when '1',
1961 event_trailer <= trailer_crc20 & lmem & '0' & rod_error_map & rod_link_error_map & efex_shelf_num & rod_number & pkt_len_cnt_dly;
1964 process(clock)
begin
1965 if rising_edge (clock) then
1966 if (current_state = continue_reading) then
1967 corr_trail_chan <= current_chan;
1969 corr_trail_chan <= corr_trail_chan;
1975 process(clock)
begin
1976 if rising_edge (clock) then
1977 if crc20_err = '1' then
1978 crc20_err_chan <= corr_trail_chan;
1983 process(clock)
begin
1984 if rising_edge (clock) then
1985 if (reset = '1') or (sel_corr_trailer = '1') or (chan_trailer_crc20_reset = '1') then
1986 corr_trailer_len_flag <= '0';
1987 elsif (chan_len_error = '1') and (s_tlast_del2 = '1') then
1988 corr_trailer_len_flag <= '1';
1992 process(clock)
begin
1993 if rising_edge (clock) then
1994 if (reset = '1') or (sel_corr_trailer = '1') or (chan_trailer_crc20_reset = '1') then
1995 corr_trailer_pe_flag <= '0';
1996 elsif (crc20_err = '1') and (s_tlast_del2 = '1') then
1997 corr_trailer_pe_flag <= '1';
2010 corr_trailer <= chan_trailer_crc20 & "000000" & "10" & corr_trailer_pe_flag & corr_trailer_len_flag & "00" & x"00" & shelf & corr_trail_chan(3 downto 0) & corrected_length;
2016 evnt_sel(3) <= sel_packet_header;
2017 evnt_sel(2) <= sel_packet_header_2;
2018 evnt_sel(1) <= sel_packet_trailer;
2019 evnt_sel(0) <= sel_corr_trailer;
2021 with evnt_sel select
2022 fifo_s_tdata <= header_reg_1 & header_reg_0(31 downto 29) & header_crc & header_reg_0(19 downto 0) when "1000",
2023 x"00000000" & header_reg_2 (31 downto 0)when "0100",
2024 event_trailer when "0010",
2025 corr_trailer when "0001",
2027 s_tdata when "0000",
2028 s_tdata when others;
2055 process (clock)
begin
2056 if rising_edge (clock) then
2057 if (reset = '1') then
2059 next_chan <= (first_chan + 1);
2060 elsif inc_chan = '1' then
2061 if (next_chan = num_chan) then
2063 next_chan <= first_chan;
2065 next_chan <= (next_chan + 1);
2074 Port map ( clock => clock,
2076 start_timer => pet_timer,
2077 stop_timer => stop_timeout,
2080 set_time_1 => timeout_1_val,
2081 set_time_n => timeout_n_val,
2082 timeout_1 => timeout_1_raw,
2083 timeout_n => timeout_n_raw,
2084 counter_out => timeout_counter,
2085 run_out => timeout_run
2087 timeout_1 <= (timeout_1_raw and not tob_timeout_1_disable);
2088 timeout_n <= (timeout_n_raw and not tob_timeout_n_disable);
2092 stop_timeout <= s_tvalid and chan_enable_del and not pet_timer;
2095 process (clock)
begin
2096 if rising_edge (clock) then
2097 if (reset = '1') or (clr_build_flag = '1') then
2099 elsif (set_build_flag = '1') then
2102 build_flag <= build_flag;
2111 process (clock)
begin
2112 if rising_edge (clock) then
2113 if (reset = '1') or (current_state = add_corr_trailer) or (current_state = add_corr_trlr_lc) or (current_state = trailer_mux) then
2114 last_chan_read <= '0';
2115 elsif (current_state = continue_reading) and (current_chan = num_chan) then
2116 last_chan_read <= '1';
2118 last_chan_read <= last_chan_read;
2123 process (clock)
begin
2124 if rising_edge (clock) then
2125 if (reset = '1') or (current_state = wait_for_event) then
2126 any_chan_read <= '0';
2127 elsif (current_state = continue_reading) and (current_state = start_reading) then
2128 any_chan_read <= '1';
2130 any_chan_read <= any_chan_read;
2141 process (clock)
begin
2142 if rising_edge (clock) then
2143 if (reset = '1') then
2144 chan_enable_del <= '0';
2146 chan_enable_del <= chan_enable;
2171 process (clock)
begin
2172 if rising_edge (clock) then
2175 if (reset = '1') or (clr_chan_len_cnt = '1') or (s_tlast_del2 = '1') then
2176 chan_len_cnt <= "000000000000";
2177 elsif ((fifo_s_tvalid = '1') and (s_tlast = '0') and (evnt_sel = "000") and (fifo_s_tready = '1'))then
2178 chan_len_cnt <= (chan_len_cnt + 2);
2183 process (clock)
begin
2184 if rising_edge (clock) then
2187 if (reset = '1') or (s_tlast_del2 = '1') or ((s_tlast = '1') and (chan_len_cnt = s_tdata(11 downto 0))) then
2188 chan_len_error <= '0';
2192 elsif (s_tlast = '1') and (chan_len_cnt /= s_tdata(11 downto 0)) then
2193 chan_len_error <= '1';
2196 chan_len_error <= chan_len_error;
2203 process (clock)
begin
2204 if rising_edge (clock) then
2206 if (reset = '1') or (clr_chan_len_cnt = '1') then
2207 corrected_length <= x"0000";
2208 elsif ((fifo_s_tvalid = '1') and (s_tlast = '0') and (evnt_sel = "000") and (fifo_s_tready = '1')) or (inc_corr_counter='1') then
2210 corrected_length <= (corrected_length + 2);
2225 process (clock)
begin
2226 if rising_edge (clock) then
2227 if (reset = '1') or (sel_packet_header = '1') then
2228 pkt_len_cnt(15 downto 0) <= x"0002";
2230 elsif (fifo_s_tvalid = '1') and (fifo_s_tready = '1') and (sel_packet_header = '0') and (sel_packet_header_2 = '0') and (fifo_s_tlast = '0') then
2231 pkt_len_cnt <= (pkt_len_cnt + 2);
2232 pkt_len_cnt_dly <= pkt_len_cnt;
2234 pkt_len_cnt <= pkt_len_cnt;
2261 process (clock)
begin
2262 if rising_edge (clock) then
2263 if (reset = '1') or (fifo_s_tlast = '1') then
2264 tob_pkt_active <= '0';
2265 elsif (sel_packet_header = '1') then
2267 tob_pkt_active <= '1';
2269 tob_pkt_active <= tob_pkt_active;
2279 process (clock)
begin
2280 if rising_edge (clock) then
2281 if (reset = '1') or (fifo_s_tlast = '1') then
2282 empty_pkt_active <= '0';
2283 elsif (set_empty_packet_build = '1') then
2284 empty_pkt_active <= '1';
2286 empty_pkt_active <= empty_pkt_active;
2298 crc_reset => hdr_in_crc9_reset,
2301 header_mismatch => chan_hdr_crc_err
2304 hdr_in_crc9_reset <= s_tlast_del2 or reset;
2306 process (clock)
begin
2307 if rising_edge (clock) then
2308 if (reset = '1') then
2309 hdr_crc_flag <= '0';
2311 hdr_crc_flag <= chan_hdr_crc_err;
2322 crc_reset => sel_packet_header_2,
2325 tob_stream_id => tob_stream_id,
2328 ECRID => ECRID_ttc_hreg,
2329 L1ID => L1ID_ttc_hreg,
2331 header_reg_1 => header_reg_1,
2332 header_reg_2 => header_reg_2,
2333 crc_start => header_crc_start,
2334 load_hdr_reg => load_hdr_reg,
2335 CRC_out => header_crc,
2336 hdr_out_crc9_valid => hdr_out_crc9_valid
2341 header_crc_start <= hdr_out_crc9_start;
2343 event_trailer_crc : event_trailer_crc20
2345 CRC20_G_Poly => CRC20_G_Poly,
2348 G_InitVal => x"fffff"
2352 crc_reset => trailer_crc20_reset,
2353 CRC => trailer_crc20,
2354 Calc => trailer_crc20_calc,
2355 S_tdata => fifo_s_tdata,
2356 sel_packet_trailer => sel_packet_trailer
2370 chan_crc_dmux_ctrl <= ((s_tlast_del2 and not s_tvalid) and (chan_crc20_err or chan_len_error)) or corr_trailer_pe_flag or corr_trailer_len_flag;
2371 chan_crc_dmux_data <= x"00000" & corr_trailer(43 downto 0);
2373 with chan_crc_dmux_ctrl select
2374 chan_crc_din <= s_tdata when '0',
2375 chan_crc_dmux_data when '1',
2376 s_tdata when others;
2379 chan_trailer_crc : event_trailer_crc20
2381 CRC20_G_Poly => CRC20_G_Poly,
2384 G_InitVal => x"fffff"
2388 crc_reset => chan_trailer_crc20_reset,
2389 CRC => chan_trailer_crc20,
2390 Calc => chan_trailer_crc20_calc,
2392 S_tdata => chan_crc_din,
2393 sel_packet_trailer => s_tlast
2397 process (clock)
begin
2398 if rising_edge (clock) then
2399 if s_tlast = '1' then
2400 proposed_crc20(19 downto 0) <= s_tdata(63 downto 44);
2408 chan_crc20_err <= '1' when proposed_crc20 /= chan_trailer_crc20 else '0';
2413 process (clock)
begin
2414 if rising_edge (clock) then
2415 s_tlast_del <= s_tlast and s_tvalid;
2416 s_tlast_del2 <= s_tlast_del;
2438 crc20_err <= s_tlast_del2 and chan_crc20_err;
2440 crc9_err <= s_tlast_del2 and chan_hdr_crc_err;
2444 timeout_error <= '1' when (((current_state = idle_state) and (current_chan = first_chan) and (timeout_1 = '1'))
2445 or ((current_state = idle_state) and (current_chan /= first_chan) and (timeout_n = '1'))
2446 or ((current_state = eval_chan_crc20) and ((timeout_n = '1') and (current_chan = num_chan) and (tob_pkt_active = '1')))
2447 or ((current_state = check_error) and (timeout_n = '1')))
2450 dbg_timeout_error <= '1' when ((current_state = dbg_trail_build_3) and ((timeout_1 = '1') or (timeout_n = '1'))) else '0';
2451 timeout_err <= timeout_error;
2464 reset => trailer_crc20_reset,
2466 current_chan => current_chan,
2467 chan_len_error => chan_len_error,
2468 chan_hdr_crc_err => chan_hdr_crc_err,
2469 chan_crc20_err => chan_crc20_err,
2470 L1ID_eq => L1ID_eq_pipe,
2471 chan_crc20_samp => s_tlast_del2,
2472 crc9_err_samp => s_tlast_del2,
2473 len_err_samp => s_tlast_del2,
2474 L1id_eq_samp => sel_packet_header_2,
2475 timeout_error => timeout_error,
2476 clear_map => load_last_chan,
2477 sel_corr_trailer => sel_corr_trailer,
2478 error_map => rod_link_error_map,
2480 rod_err_map => rod_error_map,
2481 debug_pkt_module_map =>
open
2501 nxt_chan <= inc_chan;
2503 hdr_match <= match_out;
2504 s_tready <= fifo_s_tready;
2542 set_empty_packet_build <= ctrl_code(
33);
2543 set_bad_l1id_flag <= ctrl_code(
32);
2544 dbg_s_tvalid <= ctrl_code(31);
2545 dbg_s_tlast <= ctrl_code(30);
2546 dgb_crc9_reset <= ctrl_code(29);
2547 dbg_crc9_calc <= ctrl_code(28);
2548 sel_dbg_header <= ctrl_code(27);
2549 sel_dbg_trailer <= ctrl_code(26);
2550 dgb_crc20_reset <= ctrl_code(25);
2551 dbg_crc20_calc <= ctrl_code(24);
2552 dbg_LenCount_Ena <= ctrl_code(23);
2553 dbg_LenCount_Rst <= ctrl_code(22);
2562 with rod_slot select
2563 dbg_stream_id <= x"DD" when '1',
2566 debug_fifo: event_builder_fifo
2569 s_axis_tvalid => dbg_s_tvalid,
2570 s_axis_tready => dbg_s_tready,
2571 s_axis_aresetn => s_axis_aresetn,
2572 s_axis_aclk => clock,
2573 s_axis_tlast => dbg_s_tlast,
2577 s_axis_tuser
(1) => sel_dbg_header,
2578 s_axis_tuser
(0) => sel_dbg_trailer,
2581 s_axis_tdata => dbg_s_tdata,
2583 m_axis_tvalid => dbg_m_tvalid_i,
2584 m_axis_tlast => dbg_m_tlast_i,
2585 m_axis_tready => dbg_m_tready,
2586 m_axis_tuser
(1) => dbg_m_header_marker_i,
2587 m_axis_tuser
(0) => dbg_m_tail_marker_i,
2588 m_axis_tdata => dbg_m_tdata_i,
2591 axis_wr_data_count => debug_fifo_level,
2592 axis_rd_data_count =>
open
2597 dbg_sel(1) <= sel_dbg_header;
2598 dbg_sel(0) <= sel_dbg_trailer;
2601 dbg_s_tdata <= dbg_header_reg_tmp when "10",
2602 dbg_corr_trailer when "01",
2604 s_tdata when others;
2608 dbg_header_reg_tmp(7 downto 0) <= dbg_stream_id;
2610 dbg_header_reg_tmp(19 downto 8) <= BCID_reg;
2611 dbg_header_reg_tmp(28 downto 20) <= dbg_hdr_crc;
2612 dbg_header_reg_tmp(31 downto 29) <= version;
2614 dbg_header_reg_tmp(63 downto 32) <= L1ID_ttc_32_reg;
2617 process (clock)
begin
2618 if rising_edge (clock) then
2619 if dbg_crc9_calc = '1' then
2620 dbg_header_reg(7 downto 0) <= dbg_stream_id;
2622 dbg_header_reg(19 downto 8) <= BCID_reg;
2623 dbg_header_reg(28 downto 20) <= dbg_hdr_crc;
2624 dbg_header_reg(31 downto 29) <= version;
2626 dbg_header_reg(63 downto 32) <= L1ID_ttc_32_reg;
2644 dbg_corr_trailer(15 downto 0) <= dbg_LenCount & '0';
2646 dbg_corr_trailer(17 downto 16) <= rod_number;
2647 dbg_corr_trailer(19 downto 18) <= efex_shelf_num;
2648 dbg_corr_trailer (31 downto 20) <= dbg_link_error_map;
2649 dbg_corr_trailer (38 downto 32) <= dbg_error_map;
2651 dbg_corr_trailer (39) <= '0';
2652 dbg_corr_trailer (43 downto 40) <= dbg_LMEM;
2653 dbg_corr_trailer (63 downto 44) <= dbg_trailer_CRC;
2658 dbg_crc9_in_flip <= version & "000000000" & BCID_reg & dbg_stream_id & L1ID_ttc_32_reg;
2660 with dbg_s_tvalid select
2661 dbg_crc20_in_flip <= dbg_s_tdata(31 downto 0) & dbg_s_tdata(63 downto 32) when '1',
2662 dbg_corr_trailer(31 downto 0) & x"00000" & dbg_corr_trailer(43 downto 32) when '0',
2663 dbg_s_tdata(31 downto 0) & dbg_s_tdata(63 downto 32) when others;
2669 process (clock)
begin
2670 if rising_edge (clock) then
2671 if dbg_pkt_count_reset = '1' then
2672 dbg_pkt_count_i <= (others => '0');
2673 elsif ((dbg_m_tlast_i and dbg_m_tvalid_i) = '1') and (dbg_pkt_count_i < x"ffffffff") then
2674 dbg_pkt_count_i <= (dbg_pkt_count_i + 1);
2676 dbg_pkt_count_i <= dbg_pkt_count_i;
2681 dbg_pkt_count <= dbg_pkt_count_i;
2691 process (clock)
begin
2692 if rising_edge (clock) then
2693 if dbg_LenCount_Rst = '1' then
2694 dbg_chan_LenCount <= x"FFE";
2695 elsif dbg_LenCount_Ena = '1' then
2696 dbg_chan_LenCount <= dbg_chan_LenCount + x"2";
2701 process (clock)
begin
2702 if rising_edge (clock) then
2704 if (reset = '1') or (dbg_LenCount_Rst = '1') or ((s_tlast = '1') and (s_tvalid = '1') and (dbg_chan_lencount = dbg_s_tdata(11 downto 0))) then
2705 dbg_chan_len_error <= '0';
2706 elsif (s_tlast = '1') and (s_tvalid = '1') and (dbg_chan_lencount /= dbg_s_tdata(11 downto 0)) then
2707 dbg_chan_len_error <= '1';
2709 dbg_chan_len_error <= dbg_chan_len_error;
2727 Calc => dbg_crc9_calc,
2729 DIn => dbg_crc9_in_flip,
2730 Reset => dgb_crc9_reset
2743 G_Poly => CRC20_G_Poly,
2744 G_InitVal => x"fffff"
)
2747 CRC => dbg_trailer_CRC,
2748 Calc => dbg_crc20_calc,
2750 DIn => dbg_crc20_in_flip,
2751 Reset => dgb_crc20_reset
2757 process (clock)
begin
2758 if rising_edge (clock) then
2759 if dbg_LenCount_Rst = '1' then
2760 dbg_LenCount <= (others => '0');
2761 elsif dbg_LenCount_Ena = '1' then
2762 dbg_LenCount <= dbg_LenCount + '1';
2779 reset => dgb_crc20_reset,
2781 current_chan => current_chan,
2782 chan_len_error => dbg_chan_len_error,
2783 chan_hdr_crc_err => chan_hdr_crc_err,
2784 chan_crc20_err => chan_crc20_err,
2785 L1ID_eq => L1ID_eq_pipe,
2786 chan_crc20_samp => s_tlast_del2,
2787 crc9_err_samp => s_tlast_del2,
2788 len_err_samp => s_tlast_del2,
2789 L1id_eq_samp => set_bad_l1id_flag,
2790 timeout_error => dbg_timeout_error,
2791 clear_map => dgb_crc20_reset,
2792 sel_corr_trailer => sel_corr_trailer,
2795 rod_err_map => dbg_error_map,
2796 debug_pkt_module_map => dbg_link_error_map
2802 l1id_mismatch <= poll_chan and not L1ID_reg_eq;
2815 m_tdata_i <= dbg_m_tdata_i when '0',
2816 tob_m_tdata_i when '1',
2817 tob_m_tdata_i when others;
2819 m_tvalid_i <= dbg_m_tvalid_i when '0',
2820 tob_m_tvalid_i when '1',
2821 tob_m_tvalid_i when others;
2824 m_tlast_i <= dbg_m_tlast_i when '0',
2825 tob_m_tlast_i when '1',
2826 tob_m_tlast_i when others;
2829 m_header_marker_i <= dbg_m_header_marker_i when '0',
2830 tob_m_header_marker_i when '1',
2831 tob_m_header_marker_i when others;
2834 m_tail_marker_i <= dbg_m_tail_marker_i when '0',
2835 tob_m_tail_marker_i when '1',
2836 tob_m_tail_marker_i when others;
2839 tob_m_tready <= tobsel and m_tready;
2840 dbg_m_tready <= not tobsel and m_tready;
2853 process (clock)
begin
2854 if rising_edge (clock) then
2855 if (reset = '1') or ((tobsel = '0') and ((dbg_m_tlast_i = '1') or (dbg_m_tvalid_i = '0'))) then
2857 elsif (tobsel = '1') and (dbg_m_tvalid_i = '1') and ((tob_m_tlast_i = '1') or (tob_m_tvalid_i = '0')) then
2881 process (event_sel(
0), rod_slot)
2882 variable sel_bus : std_logic_vector(1 downto 0);
2884 sel_bus := event_sel(0) & rod_slot;
2887 reference_lid_0 <= '0';
2889 reference_lid_0 <= '1';
2891 reference_lid_0 <= '1';
2893 reference_lid_0 <= '0';
2895 reference_lid_0 <= '0';
2902 process (clock)
begin
2903 if rising_edge (clock) then
2904 if (reset = '1') or (dbg_s_tlast = '1') then
2905 bad_l1id_flag <= '0';
2906 elsif set_bad_l1id_flag = '1' then
2907 bad_l1id_flag <= '1';
2909 bad_l1id_flag <= bad_l1id_flag;
2925 process (clock)
begin
2926 if rising_edge (clock) then
2927 if (reset = '1') or (tob_pkt_active = '1') then
2928 l1id_resync_flag <= '0';
2929 elsif (state = dbg_trlr_ld_last) and (current_chan = num_chan) and (bad_l1id_flag = '1') and (tob_pkt_active = '0') and (l1id_resync_enable = '1') then
2930 l1id_resync_flag <= not l1id_resync_flag;
2932 l1id_resync_flag <= l1id_resync_flag;
2978 State_machine_ILA : ILA_ev_builder
2982 probe1 => current_chan,
2984 probe3
(0) => chan_enable,
2985 probe4
(0) => header_fifo_valid,
2986 probe5
(0) => timeout_n,
2987 probe6
(0) => timeout_1,
2988 probe7
(0) => s_header_mark,
2989 probe8
(0) => s_hdr_crc_tag,
2990 probe9
(0) => s_tvalid,
2991 probe10
(0) => s_tlast,
2992 probe11
(0) => L1ID_eq,
2993 probe12
(0) => L1ID_reg_eq,
2994 probe13
(0) => ttc_ignore,
2995 probe14 => L1ID_ttc_hreg,
2997 probe15
(0) => crc20_err,
2998 probe16 => chan_len_cnt,
2999 probe17
(0) => pet_timer,
3000 probe18
(0) => stop_timeout,
3001 probe19 => timeout_counter,
3002 probe20
(0) => timeout_run,
3003 probe21
(0) => wdog_overflow_i,
3004 probe22
(0) => wdog_pet,
3005 probe23
(0) => wdog_disable,
3006 probe24 => wdog_threshold,
3008 probe26
(0) => flx_backpressure,
3009 probe27
(0) => stop_proc,
3010 probe28 => l1id_measure_time
(16 downto 1),
3011 probe29 => l1id_measure_max
3018 generic map ( overflow_clock_count => x"0f"
3023 wdog_disable => wdog_disable,
3024 wdog_pet => wdog_pet,
3025 wdog_threshold => wdog_threshold,
3026 wdog_overflow => wdog_overflow_i
3030 wdog_pet <= '1' when ((current_state = wait_for_event)or (current_state = await_resync)) else '0';
3031 wdog_overflow <= wdog_overflow_i;
3039 process (clock)
begin
3040 if rising_edge (clock) then
3041 header_fifo_valid_del <= header_fifo_valid;
3047 process (clock)
begin
3048 if rising_edge (clock) then
3049 if (rx_timer_clear = '1') then
3050 l1id_measure_lock <= '0';
3051 elsif ((header_fifo_valid_del ='0') and (header_fifo_valid = '1') and (l1id_measure_lock = '0')) then
3052 l1id_measure_reg <= master_header(43 downto 12);
3053 l1id_measure_lock <= '1';
3055 l1id_measure_reg <= l1id_measure_reg;
3056 l1id_measure_lock <= l1id_measure_lock;
3063 process (clock)
begin
3064 if rising_edge (clock) then
3065 if (clr_pkt_wait_timer = '1') then
3066 l1id_measure_last_i <= x"0000_0000";
3067 l1id_measure_time <= x"0000_0000";
3068 elsif (rx_timer_clear = '1') then
3069 l1id_measure_time <= x"0000_0000";
3070 elsif (l1id_measure_lock = '1') then
3071 l1id_measure_time <= (l1id_measure_time + 1);
3072 l1id_measure_last_i <= l1id_measure_time;
3074 l1id_measure_time <= l1id_measure_time;
3075 l1id_measure_last_i <= l1id_measure_last_i;
3081 process (clock)
begin
3082 if rising_edge (clock) then
3083 if (clr_pkt_wait_timer = '1') then
3084 l1id_measure_max_i <= x"0000_0000";
3085 l1id_max_l1id <= x"0000_0000";
3086 elsif (rx_timer_clear = '1') then
3087 l1id_measure_max_i <= l1id_measure_max_i;
3088 elsif (l1id_measure_max_i < l1id_measure_time) and (l1id_measure_lock = '1') then
3089 l1id_measure_max_i <= l1id_measure_time;
3090 l1id_max_l1id <= l1id_measure_reg;
3093 l1id_measure_max_i <= l1id_measure_max_i;
3094 l1id_max_l1id <= l1id_max_l1id;
3104 process (clock)
begin
3105 if rising_edge (clock) then
3106 if (clr_pkt_wait_timer = '1') then
3107 l1id_measure_last <= x"0000_0000";
3108 l1id_measure_max <= x"0000_0000";
3109 elsif (rx_timer_clear = '1') and (l1id_measure_lock = '1') then
3110 l1id_measure_last <= '0' & l1id_measure_last_i(31 downto 1);
3111 l1id_measure_max <= '0' & l1id_measure_max_i(31 downto 1);
3117 process (clock)
begin
3118 if rising_edge (clock) then
3119 if (clr_pkt_wait_timer = '1') or ((s_header_mark = '1') and (s_tdata(63 downto 32) = l1id_measure_reg) and (l1id_measure_lock = '1')) then
3120 rx_timer_clear <= '1';
3121 elsif rx_timer_clear = '1' then
3122 rx_timer_clear <= '0';
3124 rx_timer_clear <= rx_timer_clear;
3132 Process (clock)
begin
3133 if rising_edge(clock) then
3134 if (clr_max_timeout = '1') then
3135 timeout_counter_max_i <= x"0000";
3136 elsif (timeout_counter > timeout_counter_max_i) then
3137 timeout_counter_max_i <= timeout_counter;
3138 max_chan_i <= current_chan;
3140 timeout_counter_max_i <= timeout_counter_max_i;
3141 max_chan_i <= max_chan_i;
3146 max_chan <= max_chan_i;
3147 timeout_counter_max <= timeout_counter_max_i;
3168 l1id_max_l1id_o <= l1id_max_l1id;
3169 l1id_measure_max_o <= l1id_measure_max;
3170 l1id_measure_last_o <= l1id_measure_last;