ROD firmware  1.0.5
ATLAS l1-calo - ROD_eFEX and ROD_jFEX firmware for the L1Calo ROD board

Back to ROD documentation
tob_processor.vhd
1 
3 ----------------------------------------------------------------------------------
4 -- Company:
5 -- Engineer:
6 --
7 -- Create Date: 16.05.2019 14:41:50
8 -- Design Name:
9 -- Module Name: tob_processor - RTL
10 -- Project Name:
11 -- Target Devices:
12 -- Tool Versions:
13 -- Description:
14 --
15 -- Dependencies:
16 --
17 -- Revision:
18 -- Revision 0.01 - File Created
19 -- Additional Comments:
20 --
21 ----------------------------------------------------------------------------------
22 
23 
24 library IEEE;
25 use IEEE.STD_LOGIC_1164.ALL;
26 use work.ipbus.all;
27 use work.ipbus_decode_L1CaloHubRodTobProc.all;
28 
29 -- Uncomment the following library declaration if using
30 -- arithmetic functions with Signed or Unsigned values
31 --use IEEE.NUMERIC_STD.ALL;
32 
33 -- Uncomment the following library declaration if instantiating
34 -- any Xilinx leaf cells in this code.
35 --library UNISIM;
36 --use UNISIM.VComponents.all;
37 
38 entity tob_processor is
39  generic (
40  sim : integer := 0;
41  jfex : integer := 0;
42  CRC20_G_Poly : std_logic_vector(19 downto 0) := x"8349f"; --old poly
43  timeout_1_default : std_logic_vector(15 downto 0) := x"0600";
44  timeout_n_default : std_logic_vector(15 downto 0) := x"0030";
45  wdog_thresh_default : std_logic_vector(15 downto 0) := x"2000";
46 
47  -- Width of S_AXI data bus
48  C_S_AXI_DATA_WIDTH : integer := 32;
49  -- Width of S_AXI address bus
50  C_S_AXI_ADDR_WIDTH : integer := 9;
51 
52  --backplane input width
53  bp_width : integer := 64;
54 
55 --width of header
56  header_width : integer := 64;
57 
58 --widh of event queue
59  event_width : integer := 64
60 
61  );
62  Port (
63  ipb_clk: in std_logic;
64  ipb_rst: in std_logic;
65  ipb_in: in ipb_wbus;
66  ipb_out: out ipb_rbus;
67 
68  geo_location : in STD_LOGIC_VECTOR (7 downto 0);
69  event_sel : in STD_LOGIC_VECTOR (1 downto 0);
70  rod_slot : in std_logic;
71 
72  full_mode_ctrl : out STD_LOGIC_VECTOR (31 downto 0);
73  full_mode_stat : in STD_LOGIC_VECTOR (31 downto 0);
74  FM_L1id_stat : in std_logic_vector(31 downto 0);
75  stage_fifo_level : in std_logic_vector (15 downto 0);
76 
77  stage_fifo_busy : out STD_LOGIC;
78  stage_fifo_xoff : out STD_LOGIC;
79  stage_fifo_full : in STD_LOGIC;
80 
81  flx_backpressure : in STD_LOGIC_vector (11 downto 0);
82  flx_backpressure_tob : out STD_LOGIC;
83 
84 
85  pp_clock : in STD_LOGIC;
86  rt_clk : in std_logic;
87 -- clock : in STD_LOGIC;
88  system_reset : in STD_LOGIC;
89  proc_reset : in STD_LOGIC;
90  wdog_fifo_reset : out STD_LOGIC;
91  first_chan : in STD_LOGIC_VECTOR (4 downto 0);
92  last_chan : in STD_LOGIC_VECTOR (4 downto 0);
93  TTC_ignore : in STD_LOGIC;
94 
95  master_header : in STD_LOGIC_VECTOR (63 downto 0); --synchronous to pp_clk
96  header_fifo_valid : in STD_LOGIC;
97  header_read_en : out std_logic;
98  header_sequence : in STD_LOGIC_VECTOR (11 downto 0);
99  header_type : in STD_LOGIC_VECTOR (3 downto 0);
100  timeout_err_out : out std_logic;
101 
102  --- output queue(s)
103 
104  m_tvalid : out STD_LOGIC;
105  m_tlast : out STD_LOGIC;
106  m_tdata : out STD_LOGIC_VECTOR (bp_width-1 downto 0);
107  m_header_marker : out STD_LOGIC;
108  m_tail_marker : out STD_LOGIC;
109  m_tready : in STD_LOGIC;
110  ttc_rollover : out std_logic;
111 
112  l1id_mis_stretch : out std_logic;
113 
114  s_tdata_0 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
115  s_tvalid_0 : in STD_LOGIC;
116  s_tlast_0 : in STD_LOGIC;
117  s_tready_0 : out STD_LOGIC;
118  s_header_mark_0 : in STD_LOGIC;
119  s_trailer_mark_0 : in STD_LOGIC;
120  s_hdr_crc_tag_0 : in STD_LOGIC;
121  s_poll_chan_0 : out STD_LOGIC;
122  s_chan_enable_0 : in STD_LOGIC;
123 
124  s_tdata_1 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
125  s_tvalid_1 : in STD_LOGIC;
126  s_tlast_1 : in STD_LOGIC;
127  s_tready_1 : out STD_LOGIC;
128  s_header_mark_1 : in STD_LOGIC;
129  s_trailer_mark_1 : in STD_LOGIC;
130  s_hdr_crc_tag_1 : in STD_LOGIC;
131  s_poll_chan_1 : out STD_LOGIC;
132  s_chan_enable_1 : in STD_LOGIC;
133 
134  s_tdata_2 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
135  s_tvalid_2 : in STD_LOGIC;
136  s_tlast_2 : in STD_LOGIC;
137  s_tready_2 : out STD_LOGIC;
138  s_header_mark_2 : in STD_LOGIC;
139  s_trailer_mark_2 : in STD_LOGIC;
140  s_hdr_crc_tag_2 : in STD_LOGIC;
141  s_poll_chan_2 : out STD_LOGIC;
142  s_chan_enable_2 : in STD_LOGIC;
143 
144  s_tdata_3 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
145  s_tvalid_3 : in STD_LOGIC;
146  s_tlast_3 : in STD_LOGIC;
147  s_tready_3 : out STD_LOGIC;
148  s_header_mark_3 : in STD_LOGIC;
149  s_trailer_mark_3 : in STD_LOGIC;
150  s_hdr_crc_tag_3 : in STD_LOGIC;
151  s_poll_chan_3 : out STD_LOGIC;
152  s_chan_enable_3 : in STD_LOGIC;
153 
154  s_tdata_4 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
155  s_tvalid_4 : in STD_LOGIC;
156  s_tlast_4 : in STD_LOGIC;
157  s_tready_4 : out STD_LOGIC;
158  s_header_mark_4 : in STD_LOGIC;
159  s_trailer_mark_4 : in STD_LOGIC;
160  s_hdr_crc_tag_4 : in STD_LOGIC;
161  s_poll_chan_4 : out STD_LOGIC;
162  s_chan_enable_4 : in STD_LOGIC;
163 
164  s_tdata_5 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
165  s_tvalid_5 : in STD_LOGIC;
166  s_tlast_5 : in STD_LOGIC;
167  s_tready_5 : out STD_LOGIC;
168  s_header_mark_5 : in STD_LOGIC;
169  s_trailer_mark_5 : in STD_LOGIC;
170  s_hdr_crc_tag_5 : in STD_LOGIC;
171  s_poll_chan_5 : out STD_LOGIC;
172  s_chan_enable_5 : in STD_LOGIC;
173 
174  s_tdata_6 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
175  s_tvalid_6 : in STD_LOGIC;
176  s_tlast_6 : in STD_LOGIC;
177  s_tready_6 : out STD_LOGIC;
178  s_header_mark_6 : in STD_LOGIC;
179  s_trailer_mark_6 : in STD_LOGIC;
180  s_hdr_crc_tag_6 : in STD_LOGIC;
181  s_poll_chan_6 : out STD_LOGIC;
182  s_chan_enable_6 : in STD_LOGIC;
183 
184  s_tdata_7 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
185  s_tvalid_7 : in STD_LOGIC;
186  s_tlast_7 : in STD_LOGIC;
187  s_tready_7 : out STD_LOGIC;
188  s_header_mark_7 : in STD_LOGIC;
189  s_trailer_mark_7 : in STD_LOGIC;
190  s_hdr_crc_tag_7 : in STD_LOGIC;
191  s_poll_chan_7 : out STD_LOGIC;
192  s_chan_enable_7 : in STD_LOGIC;
193 
194  s_tdata_8 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
195  s_tvalid_8 : in STD_LOGIC;
196  s_tlast_8 : in STD_LOGIC;
197  s_tready_8 : out STD_LOGIC;
198  s_header_mark_8 : in STD_LOGIC;
199  s_trailer_mark_8 : in STD_LOGIC;
200  s_hdr_crc_tag_8 : in STD_LOGIC;
201  s_poll_chan_8 : out STD_LOGIC;
202  s_chan_enable_8 : in STD_LOGIC;
203 
204  s_tdata_9 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
205  s_tvalid_9 : in STD_LOGIC;
206  s_tlast_9 : in STD_LOGIC;
207  s_tready_9 : out STD_LOGIC;
208  s_header_mark_9 : in STD_LOGIC;
209  s_trailer_mark_9 : in STD_LOGIC;
210  s_hdr_crc_tag_9 : in STD_LOGIC;
211  s_poll_chan_9 : out STD_LOGIC;
212  s_chan_enable_9 : in STD_LOGIC;
213 
214  s_tdata_10 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
215  s_tvalid_10 : in STD_LOGIC;
216  s_tlast_10 : in STD_LOGIC;
217  s_tready_10 : out STD_LOGIC;
218  s_header_mark_10 : in STD_LOGIC;
219  s_trailer_mark_10 : in STD_LOGIC;
220  s_hdr_crc_tag_10 : in STD_LOGIC;
221  s_poll_chan_10 : out STD_LOGIC;
222  s_chan_enable_10 : in STD_LOGIC;
223 
224 
225 
226 
227 
228  s_tdata_11 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
229  s_tvalid_11 : in STD_LOGIC;
230  s_tlast_11 : in STD_LOGIC;
231  s_tready_11 : out STD_LOGIC;
232  s_header_mark_11 : in STD_LOGIC;
233  s_trailer_mark_11 : in STD_LOGIC;
234  s_hdr_crc_tag_11 : in STD_LOGIC;
235  s_poll_chan_11 : out STD_LOGIC;
236  s_chan_enable_11 : in STD_LOGIC;
237 
238 
239 
240  s_tdata_12 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
241  s_tvalid_12 : in STD_LOGIC;
242  s_tlast_12 : in STD_LOGIC;
243  s_tready_12 : out STD_LOGIC;
244  s_header_mark_12 : in STD_LOGIC;
245  s_trailer_mark_12 : in STD_LOGIC;
246  s_hdr_crc_tag_12 : in STD_LOGIC;
247  s_poll_chan_12 : out STD_LOGIC;
248  s_chan_enable_12 : in STD_LOGIC;
249 
250  s_tdata_13 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
251  s_tvalid_13 : in STD_LOGIC;
252  s_tlast_13 : in STD_LOGIC;
253  s_tready_13 : out STD_LOGIC;
254  s_header_mark_13 : in STD_LOGIC;
255  s_trailer_mark_13 : in STD_LOGIC;
256  s_hdr_crc_tag_13 : in STD_LOGIC;
257  s_poll_chan_13 : out STD_LOGIC;
258  s_chan_enable_13 : in STD_LOGIC;
259 
260 
261  s_tdata_14 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
262  s_tvalid_14 : in STD_LOGIC;
263  s_tlast_14 : in STD_LOGIC;
264  s_tready_14 : out STD_LOGIC;
265  s_header_mark_14 : in STD_LOGIC;
266  s_trailer_mark_14 : in STD_LOGIC;
267  s_hdr_crc_tag_14 : in STD_LOGIC;
268  s_poll_chan_14 : out STD_LOGIC;
269  s_chan_enable_14 : in STD_LOGIC;
270 
271 
272  s_tdata_15 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
273  s_tvalid_15 : in STD_LOGIC;
274  s_tlast_15 : in STD_LOGIC;
275  s_tready_15 : out STD_LOGIC;
276  s_header_mark_15 : in STD_LOGIC;
277  s_trailer_mark_15 : in STD_LOGIC;
278  s_hdr_crc_tag_15 : in STD_LOGIC;
279  s_poll_chan_15 : out STD_LOGIC;
280  s_chan_enable_15 : in STD_LOGIC;
281 
282  s_tdata_16 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
283  s_tvalid_16 : in STD_LOGIC;
284  s_tlast_16 : in STD_LOGIC;
285  s_tready_16 : out STD_LOGIC;
286  s_header_mark_16 : in STD_LOGIC;
287  s_trailer_mark_16 : in STD_LOGIC;
288  s_hdr_crc_tag_16 : in STD_LOGIC;
289  s_poll_chan_16 : out STD_LOGIC;
290  s_chan_enable_16 : in STD_LOGIC;
291 
292  s_tdata_17 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
293  s_tvalid_17 : in STD_LOGIC;
294  s_tlast_17 : in STD_LOGIC;
295  s_tready_17 : out STD_LOGIC;
296  s_header_mark_17 : in STD_LOGIC;
297  s_trailer_mark_17 : in STD_LOGIC;
298  s_hdr_crc_tag_17 : in STD_LOGIC;
299  s_poll_chan_17 : out STD_LOGIC;
300  s_chan_enable_17 : in STD_LOGIC;
301 
302  s_tdata_18 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
303  s_tvalid_18 : in STD_LOGIC;
304  s_tlast_18 : in STD_LOGIC;
305  s_tready_18 : out STD_LOGIC;
306  s_header_mark_18 : in STD_LOGIC;
307  s_trailer_mark_18 : in STD_LOGIC;
308  s_hdr_crc_tag_18 : in STD_LOGIC;
309  s_poll_chan_18 : out STD_LOGIC;
310  s_chan_enable_18 : in STD_LOGIC;
311 
312  s_tdata_19 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
313  s_tvalid_19 : in STD_LOGIC;
314  s_tlast_19 : in STD_LOGIC;
315  s_tready_19 : out STD_LOGIC;
316  s_header_mark_19 : in STD_LOGIC;
317  s_trailer_mark_19 : in STD_LOGIC;
318  s_hdr_crc_tag_19 : in STD_LOGIC;
319  s_poll_chan_19 : out STD_LOGIC;
320  s_chan_enable_19 : in STD_LOGIC;
321 
322  s_tdata_20 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
323  s_tvalid_20 : in STD_LOGIC;
324  s_tlast_20 : in STD_LOGIC;
325  s_tready_20 : out STD_LOGIC;
326  s_header_mark_20 : in STD_LOGIC;
327  s_trailer_mark_20 : in STD_LOGIC;
328  s_hdr_crc_tag_20 : in STD_LOGIC;
329  s_poll_chan_20 : out STD_LOGIC;
330  s_chan_enable_20 : in STD_LOGIC;
331 
332  s_tdata_21 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
333  s_tvalid_21 : in STD_LOGIC;
334  s_tlast_21 : in STD_LOGIC;
335  s_tready_21 : out STD_LOGIC;
336  s_header_mark_21 : in STD_LOGIC;
337  s_trailer_mark_21 : in STD_LOGIC;
338  s_hdr_crc_tag_21 : in STD_LOGIC;
339  s_poll_chan_21 : out STD_LOGIC;
340  s_chan_enable_21 : in STD_LOGIC;
341 
342  s_tdata_22 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
343  s_tvalid_22 : in STD_LOGIC;
344  s_tlast_22 : in STD_LOGIC;
345  s_tready_22 : out STD_LOGIC;
346  s_header_mark_22 : in STD_LOGIC;
347  s_trailer_mark_22 : in STD_LOGIC;
348  s_hdr_crc_tag_22 : in STD_LOGIC;
349  s_poll_chan_22 : out STD_LOGIC;
350  s_chan_enable_22 : in STD_LOGIC;
351 
352  s_tdata_23 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
353  s_tvalid_23 : in STD_LOGIC;
354  s_tlast_23 : in STD_LOGIC;
355  s_tready_23 : out STD_LOGIC;
356  s_header_mark_23 : in STD_LOGIC;
357  s_trailer_mark_23 : in STD_LOGIC;
358  s_hdr_crc_tag_23 : in STD_LOGIC;
359  s_poll_chan_23 : out STD_LOGIC;
360  s_chan_enable_23 : in STD_LOGIC
361 
362 
363 
364 
365  );
366 end tob_processor;
367 
368 architecture RTL of tob_processor is
369 
370 
371 component channel_mux is
372  Port (clock : in STD_LOGIC;
373  reset : in STD_LOGIC;
374  chan_pointer_reset : in STD_LOGIC;
375  s_tdata_0 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
376  s_tvalid_0 : in STD_LOGIC;
377  s_tlast_0 : in STD_LOGIC;
378  s_tready_0 : out STD_LOGIC;
379  s_header_mark_0 : in STD_LOGIC;
380  s_trailer_mark_0 : in STD_LOGIC;
381  s_hdr_crc_tag_0 : in STD_LOGIC;
382  s_poll_chan_0 : out STD_LOGIC;
383  s_chan_enable_0 : in STD_LOGIC;
384 
385  s_tdata_1 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
386  s_tvalid_1 : in STD_LOGIC;
387  s_tlast_1 : in STD_LOGIC;
388  s_tready_1 : out STD_LOGIC;
389  s_header_mark_1 : in STD_LOGIC;
390  s_trailer_mark_1 : in STD_LOGIC;
391  s_hdr_crc_tag_1 : in STD_LOGIC;
392  s_poll_chan_1 : out STD_LOGIC;
393  s_chan_enable_1 : in STD_LOGIC;
394 
395  s_tdata_2 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
396  s_tvalid_2 : in STD_LOGIC;
397  s_tlast_2 : in STD_LOGIC;
398  s_tready_2 : out STD_LOGIC;
399  s_header_mark_2 : in STD_LOGIC;
400  s_trailer_mark_2 : in STD_LOGIC;
401  s_hdr_crc_tag_2 : in STD_LOGIC;
402  s_poll_chan_2 : out STD_LOGIC;
403  s_chan_enable_2 : in STD_LOGIC;
404 
405  s_tdata_3 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
406  s_tvalid_3 : in STD_LOGIC;
407  s_tlast_3 : in STD_LOGIC;
408  s_tready_3 : out STD_LOGIC;
409  s_header_mark_3 : in STD_LOGIC;
410  s_trailer_mark_3 : in STD_LOGIC;
411  s_hdr_crc_tag_3 : in STD_LOGIC;
412  s_poll_chan_3 : out STD_LOGIC;
413  s_chan_enable_3 : in STD_LOGIC;
414 
415  s_tdata_4 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
416  s_tvalid_4 : in STD_LOGIC;
417  s_tlast_4 : in STD_LOGIC;
418  s_tready_4 : out STD_LOGIC;
419  s_header_mark_4 : in STD_LOGIC;
420  s_trailer_mark_4 : in STD_LOGIC;
421  s_hdr_crc_tag_4 : in STD_LOGIC;
422  s_poll_chan_4 : out STD_LOGIC;
423  s_chan_enable_4 : in STD_LOGIC;
424 
425  s_tdata_5 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
426  s_tvalid_5 : in STD_LOGIC;
427  s_tlast_5 : in STD_LOGIC;
428  s_tready_5 : out STD_LOGIC;
429  s_header_mark_5 : in STD_LOGIC;
430  s_trailer_mark_5 : in STD_LOGIC;
431  s_hdr_crc_tag_5 : in STD_LOGIC;
432  s_poll_chan_5 : out STD_LOGIC;
433  s_chan_enable_5 : in STD_LOGIC;
434 
435  s_tdata_6 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
436  s_tvalid_6 : in STD_LOGIC;
437  s_tlast_6 : in STD_LOGIC;
438  s_tready_6 : out STD_LOGIC;
439  s_header_mark_6 : in STD_LOGIC;
440  s_trailer_mark_6 : in STD_LOGIC;
441  s_hdr_crc_tag_6 : in STD_LOGIC;
442  s_poll_chan_6 : out STD_LOGIC;
443  s_chan_enable_6 : in STD_LOGIC;
444 
445  s_tdata_7 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
446  s_tvalid_7 : in STD_LOGIC;
447  s_tlast_7 : in STD_LOGIC;
448  s_tready_7 : out STD_LOGIC;
449  s_header_mark_7 : in STD_LOGIC;
450  s_trailer_mark_7 : in STD_LOGIC;
451  s_hdr_crc_tag_7 : in STD_LOGIC;
452  s_poll_chan_7 : out STD_LOGIC;
453  s_chan_enable_7 : in STD_LOGIC;
454 
455  s_tdata_8 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
456  s_tvalid_8 : in STD_LOGIC;
457  s_tlast_8 : in STD_LOGIC;
458  s_tready_8 : out STD_LOGIC;
459  s_header_mark_8 : in STD_LOGIC;
460  s_trailer_mark_8 : in STD_LOGIC;
461  s_hdr_crc_tag_8 : in STD_LOGIC;
462  s_poll_chan_8 : out STD_LOGIC;
463  s_chan_enable_8 : in STD_LOGIC;
464 
465  s_tdata_9 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
466  s_tvalid_9 : in STD_LOGIC;
467  s_tlast_9 : in STD_LOGIC;
468  s_tready_9 : out STD_LOGIC;
469  s_header_mark_9 : in STD_LOGIC;
470  s_trailer_mark_9 : in STD_LOGIC;
471  s_hdr_crc_tag_9 : in STD_LOGIC;
472  s_poll_chan_9 : out STD_LOGIC;
473  s_chan_enable_9 : in STD_LOGIC;
474 
475  s_tdata_10 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
476  s_tvalid_10 : in STD_LOGIC;
477  s_tlast_10 : in STD_LOGIC;
478  s_tready_10 : out STD_LOGIC;
479  s_header_mark_10 : in STD_LOGIC;
480  s_trailer_mark_10 : in STD_LOGIC;
481  s_hdr_crc_tag_10 : in STD_LOGIC;
482  s_poll_chan_10 : out STD_LOGIC;
483  s_chan_enable_10 : in STD_LOGIC;
484 
485  s_tdata_11 : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
486  s_tvalid_11 : in STD_LOGIC;
487  s_tlast_11 : in STD_LOGIC;
488  s_tready_11 : out STD_LOGIC;
489  s_header_mark_11 : in STD_LOGIC;
490  s_trailer_mark_11 : in STD_LOGIC;
491  s_hdr_crc_tag_11 : in STD_LOGIC;
492  s_poll_chan_11 : out STD_LOGIC;
493  s_chan_enable_11 : in STD_LOGIC;
494 
495 
496 
497 
498  s_tdata_12 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
499  s_tvalid_12 : in STD_LOGIC;
500  s_tlast_12 : in STD_LOGIC;
501  s_tready_12 : out STD_LOGIC;
502  s_header_mark_12 : in STD_LOGIC;
503  s_trailer_mark_12 : in STD_LOGIC;
504  s_hdr_crc_tag_12 : in STD_LOGIC;
505  s_poll_chan_12 : out STD_LOGIC;
506  s_chan_enable_12 : in STD_LOGIC;
507 
508 
509  s_tdata_13 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
510  s_tvalid_13 : in STD_LOGIC;
511  s_tlast_13 : in STD_LOGIC;
512  s_tready_13 : out STD_LOGIC;
513  s_header_mark_13 : in STD_LOGIC;
514  s_trailer_mark_13 : in STD_LOGIC;
515  s_hdr_crc_tag_13 : in STD_LOGIC;
516  s_poll_chan_13 : out STD_LOGIC;
517  s_chan_enable_13 : in STD_LOGIC;
518 
519  s_tdata_14 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
520  s_tvalid_14 : in STD_LOGIC;
521  s_tlast_14 : in STD_LOGIC;
522  s_tready_14 : out STD_LOGIC;
523  s_header_mark_14 : in STD_LOGIC;
524  s_trailer_mark_14 : in STD_LOGIC;
525  s_hdr_crc_tag_14 : in STD_LOGIC;
526  s_poll_chan_14 : out STD_LOGIC;
527  s_chan_enable_14 : in STD_LOGIC;
528 
529  s_tdata_15 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
530  s_tvalid_15 : in STD_LOGIC;
531  s_tlast_15 : in STD_LOGIC;
532  s_tready_15 : out STD_LOGIC;
533  s_header_mark_15 : in STD_LOGIC;
534  s_trailer_mark_15 : in STD_LOGIC;
535  s_hdr_crc_tag_15 : in STD_LOGIC;
536  s_poll_chan_15 : out STD_LOGIC;
537  s_chan_enable_15 : in STD_LOGIC;
538 
539 
540  s_tdata_16 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
541  s_tvalid_16 : in STD_LOGIC;
542  s_tlast_16 : in STD_LOGIC;
543  s_tready_16 : out STD_LOGIC;
544  s_header_mark_16 : in STD_LOGIC;
545  s_trailer_mark_16 : in STD_LOGIC;
546  s_hdr_crc_tag_16 : in STD_LOGIC;
547  s_poll_chan_16 : out STD_LOGIC;
548  s_chan_enable_16 : in STD_LOGIC;
549 
550  s_tdata_17 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
551  s_tvalid_17 : in STD_LOGIC;
552  s_tlast_17 : in STD_LOGIC;
553  s_tready_17 : out STD_LOGIC;
554  s_header_mark_17 : in STD_LOGIC;
555  s_trailer_mark_17 : in STD_LOGIC;
556  s_hdr_crc_tag_17 : in STD_LOGIC;
557  s_poll_chan_17 : out STD_LOGIC;
558  s_chan_enable_17 : in STD_LOGIC;
559 
560 
561  s_tdata_18 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
562  s_tvalid_18 : in STD_LOGIC;
563  s_tlast_18 : in STD_LOGIC;
564  s_tready_18 : out STD_LOGIC;
565  s_header_mark_18 : in STD_LOGIC;
566  s_trailer_mark_18 : in STD_LOGIC;
567  s_hdr_crc_tag_18 : in STD_LOGIC;
568  s_poll_chan_18 : out STD_LOGIC;
569  s_chan_enable_18 : in STD_LOGIC;
570 
571 
572  s_tdata_19 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
573  s_tvalid_19 : in STD_LOGIC;
574  s_tlast_19 : in STD_LOGIC;
575  s_tready_19 : out STD_LOGIC;
576  s_header_mark_19 : in STD_LOGIC;
577  s_trailer_mark_19 : in STD_LOGIC;
578  s_hdr_crc_tag_19 : in STD_LOGIC;
579  s_poll_chan_19 : out STD_LOGIC;
580  s_chan_enable_19 : in STD_LOGIC;
581 
582 
583  s_tdata_20 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
584  s_tvalid_20 : in STD_LOGIC;
585  s_tlast_20 : in STD_LOGIC;
586  s_tready_20 : out STD_LOGIC;
587  s_header_mark_20 : in STD_LOGIC;
588  s_trailer_mark_20 : in STD_LOGIC;
589  s_hdr_crc_tag_20 : in STD_LOGIC;
590  s_poll_chan_20 : out STD_LOGIC;
591  s_chan_enable_20 : in STD_LOGIC;
592 
593 
594 
595  s_tdata_21 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
596  s_tvalid_21 : in STD_LOGIC;
597  s_tlast_21 : in STD_LOGIC;
598  s_tready_21 : out STD_LOGIC;
599  s_header_mark_21 : in STD_LOGIC;
600  s_trailer_mark_21 : in STD_LOGIC;
601  s_hdr_crc_tag_21 : in STD_LOGIC;
602  s_poll_chan_21 : out STD_LOGIC;
603  s_chan_enable_21 : in STD_LOGIC;
604 
605 
606  s_tdata_22 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
607  s_tvalid_22 : in STD_LOGIC;
608  s_tlast_22 : in STD_LOGIC;
609  s_tready_22 : out STD_LOGIC;
610  s_header_mark_22 : in STD_LOGIC;
611  s_trailer_mark_22 : in STD_LOGIC;
612  s_hdr_crc_tag_22 : in STD_LOGIC;
613  s_poll_chan_22 : out STD_LOGIC;
614  s_chan_enable_22 : in STD_LOGIC;
615 
616  s_tdata_23 : in STD_LOGIC_VECTOR ((bp_width-1) downto 0);
617  s_tvalid_23 : in STD_LOGIC;
618  s_tlast_23 : in STD_LOGIC;
619  s_tready_23 : out STD_LOGIC;
620  s_header_mark_23 : in STD_LOGIC;
621  s_trailer_mark_23 : in STD_LOGIC;
622  s_hdr_crc_tag_23 : in STD_LOGIC;
623  s_poll_chan_23 : out STD_LOGIC;
624  s_chan_enable_23 : in STD_LOGIC;
625 
626 
627 
628 
629 
630 -- pointer : in STD_LOGIC_VECTOR (4 downto 0);
631 
632  m_tdata : out STD_LOGIC_VECTOR (bp_width-1 downto 0);
633  m_tvalid : out STD_LOGIC;
634  m_tlast : out STD_LOGIC;
635  m_tready : in STD_LOGIC;
636  m_header_mark : out STD_LOGIC;
637  m_trailer_mark : out STD_LOGIC;
638  m_hdr_crc_tag : out STD_LOGIC;
639  m_poll_chan_0 : in STD_LOGIC;
640  m_chan_enable : out STD_LOGIC;
641 
642  nxt_chan_0 : in STD_LOGIC;
643  nxt_chan_1 : in STD_LOGIC;
644  nxt_chan_2 : in STD_LOGIC;
645  nxt_chan_3 : in STD_LOGIC;
646  current_chan : out STD_LOGIC_VECTOR (4 downto 0);
647  first_chan : in STD_LOGIC_VECTOR (4 downto 0);
648  last_chan : in STD_LOGIC_VECTOR (4 downto 0)
649 
650  );
651 end component;
652 
653 
654 component ttc_info is
655  Port (
656  reset : in STD_LOGIC; --synchronous to lhc_clk
657  pp_clk : in STD_LOGIC;
658  cttc_user_clk : in STD_LOGIC;
659  seq : in STD_LOGIC_VECTOR (1 downto 0);
660 -- ttc_valid : in STD_LOGIC; --derived from seq statemachine - it would be possible toprovide a strobe for each word
661  ttc_word_0 : in STD_LOGIC_VECTOR (31 downto 0); --synchronous to cttc_user_clk
662  ttc_word_1 : in STD_LOGIC_VECTOR (31 downto 0); --synchronous to cttc_user_clk
663  ttc_word_2 : in STD_LOGIC_VECTOR (31 downto 0); --synchronous to cttc_user_clk
664  ttc_word_3 : in STD_LOGIC_VECTOR (31 downto 0); --synchronous to cttc_user_clk
665 
666  L1ID_error : out STD_LOGIC;
667  CTTC_CRC_error : out STD_LOGIC;
668  header_read_en : in STD_LOGIC;
669  header_fifo_valid : out STD_LOGIC;
670  header_fifo_full : out STD_LOGIC;
671  header_fifo_empty : out STD_LOGIC;
672  header_fifo_level : out STD_LOGIC_VECTOR (8 downto 0);
673 -- master_header : out STD_LOGIC_VECTOR (95 downto 0) --synchronous to pp_clk
674  master_header : out STD_LOGIC_VECTOR (63 downto 0) --synchronous to pp_clk
675  );
676 end component;
677 
678 component ev_builder is
679  generic (
680  CRC20_G_Poly : std_logic_vector(19 downto 0) := x"8349f"; --old poly
681  jfex : integer := 0;
682  bp_width : integer := 64;
683  event_width : integer := 64;
684  header_width : integer := 64
685  );
686  Port ( clock : in STD_LOGIC;
687  reset : in STD_LOGIC;
688  geo_location : in STD_LOGIC_VECTOR (7 downto 0);
689  s_tdata : in STD_LOGIC_VECTOR (bp_width-1 downto 0);
690  s_tvalid : in STD_LOGIC;
691  s_tlast : in STD_LOGIC;
692  s_header_mark : in STD_LOGIC;
693  s_trailer_mark : in STD_LOGIC;
694  s_hdr_crc_tag : in STD_LOGIC;
695  s_tready : out STD_LOGIC;
696  nxt_chan : out STD_LOGIC;
697  empty_0 : in STD_LOGIC;
698  empty_1 : in STD_LOGIC;
699  empty_2 : in STD_LOGIC;
700  empty_3 : in STD_LOGIC;
701 -- empty_stat : out STD_LOGIC;
702  match_0 : in STD_LOGIC;
703  match_1 : in STD_LOGIC;
704  match_2 : in STD_LOGIC;
705  match_3 : in STD_LOGIC;
706  hdr_match : out STD_LOGIC;
707  current_chan : in STD_LOGIC_VECTOR (4 downto 0);
708  num_chan : in STD_LOGIC_VECTOR (4 downto 0);
709  chan_in : in STD_LOGIC_VECTOR (4 downto 0);
710  chan_enable : in STD_LOGIC;
711 
712 -- empty_stat : out std_logic;
713  poll_chan : out std_logic;
714 
715  lead_follow_b : in STD_LOGIC;
716  comb_error : in STD_LOGIC;
717 
718 -- master_header : in STD_LOGIC_VECTOR (95 downto 0); --synchronous to pp_clk
719  master_header : in STD_LOGIC_VECTOR (63 downto 0); --synchronous to pp_clk
720  header_fifo_empty : in STD_LOGIC;
721  L1ID_error : in STD_LOGIC;
722  CTTC_CRC_error : in STD_LOGIC;
723  header_read_en : out STD_LOGIC;
724  header_fifo_valid : in STD_LOGIC;
725  header_fifo_full : in STD_LOGIC;
726  header_sequence : in STD_LOGIC_VECTOR (11 downto 0);
727  header_type : in STD_LOGIC_VECTOR (3 downto 0);
728 
729  m_tvalid : out STD_LOGIC;
730  m_tlast : out STD_LOGIC;
731  m_tdata : out STD_LOGIC_VECTOR (bp_width-1 downto 0);
732  m_header_marker : out STD_LOGIC;
733  m_tail_marker : out STD_LOGIC;
734  m_tready : in STD_LOGIC;
735 
736  first_chan : in STD_LOGIC_vector (4 downto 0);
737  last_chan : in STD_LOGIC_vector (4 downto 0);
738 
739  chan_pointer_reset : out STD_LOGIC;
740  any_chan_active : in std_logic;
741 
742  event_sel : in STD_LOGIC_VECTOR (1 downto 0);
743  rod_slot : in std_logic;
744  flx_backpressure : in STD_LOGIC;
745  flx_bp_enable : in STD_LOGIC;
746 
747  TTC_ignore : in STD_LOGIC;
748 
749  state_out : out STD_LOGIC_VECTOR(5 DOWNTO 0);
750  event_fifo_level : out STD_LOGIC_VECTOR(31 DOWNTO 0);
751  debug_fifo_level : out STD_LOGIC_VECTOR(31 DOWNTO 0);
752  crc20_err : out STD_LOGIC;
753  crc20_err_chan : out STD_LOGIC_VECTOR (4 downto 0);
754  crc9_err : out STD_LOGIC;
755  BCID_mismatch : out STD_LOGIC; --1 cycle pulse: used for counting
756  L1ID_mismatch : out STD_LOGIC; --1 cycle pulse: used for counting
757  timeout_err : out STD_LOGIC; --1 cycle pulse:
758  timeout_1_val : in STD_LOGIC_VECTOR (15 downto 0);
759  timeout_n_val : in STD_LOGIC_VECTOR (15 downto 0);
760  wdog_overflow : out STD_LOGIC;
761  wdog_threshold : in STD_LOGIC_VECTOR (15 downto 0);
762  wdog_disable : in STD_LOGIC;
763  l1id_resync_enable: in STD_LOGIC;
764 
765  tob_timeout_1_disable : in STD_LOGIC;
766  tob_timeout_n_disable : in STD_LOGIC;
767 
768  ttc_rollover : out std_logic;
769 
770  dbg_pkt_count : out std_logic_VECTOR (31 downto 0);
771  dbg_pkt_count_reset : in STD_LOGIC;
772  L1ID_ttc_32_reg_out : out std_logic_VECTOR (31 downto 0);
773  stop_proc : in std_logic;
774 
775  l1id_max_l1id_o : out std_logic_VECTOR (31 downto 0);
776  l1id_measure_max_o : out std_logic_VECTOR (31 downto 0);
777  l1id_measure_last_o : out std_logic_VECTOR (31 downto 0);
778  clr_pkt_wait_timer : in STD_LOGIC;
779  timeout_counter_max : out std_logic_VECTOR (15 downto 0);
780  max_chan : out std_logic_VECTOR (4 downto 0);
781  clr_max_timeout : in STD_LOGIC
782 
783  );
784 
785 end component;
786 
787 component tob_proc_regs is
788 generic (
789  sim : integer := 0;
790  timeout_1_default : std_logic_vector(15 downto 0) := x"0600";
791  timeout_n_default : std_logic_vector(15 downto 0) := x"0030";
792  wdog_thresh_default : std_logic_vector(15 downto 0) := x"2000"
793 
794  );
795 
796  port(
797  ipb_clk : in std_logic;
798  ipb_rst : in std_logic;
799  ipb_in : in ipb_wbus;
800  ipb_out : out ipb_rbus;
801 
802  pp_clock : in std_logic;
803  rt_clk : in std_logic;
804  reset : in std_logic;
805  event_fifo_level : in STD_LOGIC_VECTOR (15 downto 0); --synchronous to the pp_clock
806  debug_fifo_level : in STD_LOGIC_VECTOR (15 downto 0); --synchronous to the pp_clock
807  stage_fifo_level : in std_logic_vector (15 downto 0);
808 -- current_chan : in STD_LOGIC_VECTOR (7 downto 0);
809  first_chan : in STD_LOGIC_vector (4 downto 0);
810  current_state : in STD_LOGIC_VECTOR (7 downto 0);
811  header_mark : in std_logic;
812  header_fifo_valid : in std_logic;
813  hdr_crc_error : in std_logic;
814  ttc_crc_error : in std_logic;
815  full_mode_ctrl : out STD_LOGIC_VECTOR (31 downto 0);
816  full_mode_stat : in STD_LOGIC_VECTOR (31 downto 0);
817  FM_L1id_stat : in std_logic_vector(31 downto 0);
818  m_tdata : in STD_LOGIC_VECTOR (63 downto 0);
819  m_tvalid : in std_logic;
820  m_tlast : in std_logic;
821  m_header_marker : in std_logic;
822 -- master_header : in STD_LOGIC_VECTOR (63 downto 0);
823  L1ID_ttc_32_reg : in STD_LOGIC_VECTOR (31 downto 0);
824  s_tdata : in STD_LOGIC_VECTOR (63 downto 0);
825  s_tvalid : in std_logic;
826  s_tlast : in std_logic;
827  s_header_mark : in std_logic;
828  poll_chan : in std_logic;
829 
830  crc20_err : in STD_LOGIC;
831  crc9_err : in STD_LOGIC;
832  BCID_mismatch : in STD_LOGIC;
833  L1ID_mismatch : in STD_LOGIC;
834  timeout_err : in STD_LOGIC;
835  crc20_err_chan : in STD_LOGIC_VECTOR (4 downto 0);
836 
837  stage_fifo_busy : out STD_LOGIC;
838  stage_fifo_xoff : out STD_LOGIC;
839  stage_fifo_full : in STD_LOGIC;
840  timeout_1_val : out STD_LOGIC_VECTOR (15 downto 0);
841  timeout_n_val : out STD_LOGIC_VECTOR (15 downto 0);
842 
843  wdog_overflow : in STD_LOGIC;
844  wdog_threshold : out STD_LOGIC_VECTOR (15 downto 0);
845  wdog_disable : out STD_LOGIC;
846  wdog_fifo_reset : out STD_LOGIC;
847  l1id_resync_enable: out STD_LOGIC;
848 
849  tob_timeout_1_disable : out STD_LOGIC;
850  tob_timeout_n_disable : out STD_LOGIC;
851 
852  dbg_pkt_count : in STD_LOGIC_VECTOR (31 downto 0);
853  dbg_pkt_count_reset : out STD_LOGIC;
854  flx_backpressure : in STD_LOGIC_vector(11 downto 0);
855  flx_backpressure_bit : out STD_LOGIC;
856  stop_proc : out STD_LOGIC;
857 
858  l1id_max_l1id : in std_logic_VECTOR (31 downto 0);
859  l1id_measure_max : in std_logic_VECTOR (31 downto 0);
860  l1id_measure_last : in std_logic_VECTOR (31 downto 0);
861  clr_pkt_wait_timer : out STD_LOGIC;
862  timeout_counter_max : in std_logic_VECTOR (15 downto 0);
863  max_chan : in std_logic_VECTOR (4 downto 0);
864  clr_max_timeout : out STD_LOGIC;
865 
866  last_chan : in STD_LOGIC_vector (4 downto 0);
867  nxt_chan_0 : in STD_LOGIC;
868  chan_pointer_reset : in STD_LOGIC
869  );
870 end component;
871 
872 
873 COMPONENT ppmux_ila
874 
875 PORT (
876  clk : IN STD_LOGIC;
877 
878  probe0 : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
879  probe1 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
880  probe2 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
881  probe3 : IN STD_LOGIC_VECTOR(63 DOWNTO 0);
882  probe4 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
883  probe5 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
884  probe6 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
885  probe7 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
886  probe8 : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
887  probe9 : IN STD_LOGIC_VECTOR(0 DOWNTO 0)
888 );
889 END COMPONENT ;
890 
891 component pulse_stretch is
892  generic (
893  COUNTER_WIDTH : integer := 4
894  );
895  Port (
896  clock : in STD_LOGIC;
897  reset : in STD_LOGIC;
898  pulse_in : in STD_LOGIC;
899  pulse_out : out STD_LOGIC
900 
901  );
902 end component;
903 
904 
905 component dummy_chan_in is
906  Port ( current_chan : in STD_LOGIC_VECTOR (4 downto 0);
907  chan_out : out STD_LOGIC_VECTOR (4 downto 0);
908  num_chan : in STD_LOGIC_VECTOR (4 downto 0);
909  clock : in STD_LOGIC;
910  reset : in STD_LOGIC
911 );
912 end component;
913 
914 signal ev_in_tdata : STD_LOGIC_VECTOR (bp_width-1 downto 0);
915 signal ev_in_tvalid : std_logic;
916 signal ev_in_tlast : std_logic;
917 signal ev_in_tready : std_logic;
918 signal ev_in_header_mark : std_logic;
919 signal ev_in_trailer_mark : std_logic;
920 signal ev_in_hdr_crc_tag : std_logic;
921 
922 signal nxt_chan_0 : std_logic;
923 signal nxt_chan_1 : std_logic;
924 signal nxt_chan_2 : std_logic;
925 signal nxt_chan_3 : std_logic;
926 
927 signal current_chan : STD_LOGIC_VECTOR (4 downto 0);
928 signal m_poll_chan_0 : std_logic;
929 signal dum_chin : STD_LOGIC_VECTOR (4 downto 0);
930 signal reset : std_logic;
931 signal crc20_err : STD_LOGIC;
932 signal crc9_err : STD_LOGIC;
933 signal BCID_mismatch : STD_LOGIC;
934 signal L1ID_mismatch : STD_LOGIC;
935 signal timeout_err : STD_LOGIC;
936 signal crc20_err_chan : STD_LOGIC_VECTOR (4 downto 0);
937 
938 signal wdog_fifo_reset_i : STD_LOGIC;
939 
940 --ttc signals
941 --signal master_header : STD_LOGIC_VECTOR (95 downto 0);
942 --signal master_header : STD_LOGIC_VECTOR (63 downto 0);
943 --signal header_read_en : STD_LOGIC;
944 --signal header_fifo_valid : STD_LOGIC;
945 signal header_fifo_empty : STD_LOGIC;
946 signal L1ID_error : STD_LOGIC;
947 signal CTTC_CRC_error : STD_LOGIC;
948 signal header_fifo_full : STD_LOGIC;
949 
950 signal ev_chan_enable : STD_LOGIC;
951 -- signal TTC_ignore_vio : STD_LOGIC;
952 
953 signal current_state : STD_LOGIC_VECTOR (5 downto 0);
954 signal event_fifo_level : STD_LOGIC_VECTOR(31 DOWNTO 0);
955 signal debug_fifo_level : STD_LOGIC_VECTOR(31 DOWNTO 0);
956 
957 signal m_tvalid_i : STD_LOGIC;
958 signal m_tlast_i : STD_LOGIC;
959 signal m_tdata_i : STD_LOGIC_VECTOR(63 DOWNTO 0);
960 signal m_header_marker_i : STD_LOGIC;
961 signal timeout_1_val : STD_LOGIC_VECTOR(15 DOWNTO 0);
962 signal timeout_n_val : STD_LOGIC_VECTOR(15 DOWNTO 0);
963 signal tob_timeout_1_disable : STD_LOGIC;
964 signal tob_timeout_n_disable : STD_LOGIC;
965 
966 signal chan_pointer_reset : STD_LOGIC;
967 signal any_chan_active : std_logic;
968 
969 signal full_mode_ctrl_i : std_logic_vector(31 downto 0);
970 signal flx_bp_enable : std_logic;
971 signal flx_backpressure_bit : std_logic;
972 
973 signal wdog_overflow : STD_LOGIC;
974 signal wdog_threshold : STD_LOGIC_VECTOR (15 downto 0);
975 signal wdog_disable : STD_LOGIC;
976 signal l1id_resync_enable : STD_LOGIC;
977 
978 signal dbg_pkt_count : STD_LOGIC_VECTOR (31 downto 0);
979 signal dbg_pkt_count_reset : STD_LOGIC;
980 
981 signal L1ID_ttc_32_reg : STD_LOGIC_VECTOR (31 downto 0);
982 
983 signal stop_proc : std_logic; --stop processor on staging fifo xoff or busy
984 
985 signal l1id_max_l1id : std_logic_VECTOR (31 downto 0);
986 signal l1id_measure_max : std_logic_VECTOR (31 downto 0);
987 signal l1id_measure_last : std_logic_VECTOR (31 downto 0);
988 signal clr_pkt_wait_timer : std_logic;
989 
990 signal timeout_counter_max : std_logic_VECTOR (15 downto 0);
991 signal max_chan : std_logic_VECTOR (4 downto 0);
992 signal clr_max_timeout : STD_LOGIC;
993 
994 begin
995 
996 reset <= proc_reset or system_reset or wdog_overflow;
997 
998 
999  input_mux : channel_mux
1000  port map (clock => pp_clock,
1001  reset => reset,
1002  chan_pointer_reset => chan_pointer_reset,
1003  s_tdata_0 => s_tdata_0,
1004  s_tvalid_0 => s_tvalid_0,
1005  s_tlast_0 => s_tlast_0,
1006  s_tready_0 => s_tready_0,
1007  s_header_mark_0 => s_header_mark_0,
1008  s_trailer_mark_0 => s_trailer_mark_0,
1009  s_hdr_crc_tag_0 => s_hdr_crc_tag_0,
1010  s_poll_chan_0 => s_poll_chan_0,
1011  s_chan_enable_0 => s_chan_enable_0,
1012 
1013  s_tdata_1 => s_tdata_1,
1014  s_tvalid_1 => s_tvalid_1,
1015  s_tlast_1 => s_tlast_1,
1016  s_tready_1 => s_tready_1,
1017  s_header_mark_1 => s_header_mark_1,
1018  s_trailer_mark_1 => s_trailer_mark_1,
1019  s_hdr_crc_tag_1 => s_hdr_crc_tag_1,
1020  s_poll_chan_1 => s_poll_chan_1,
1021  s_chan_enable_1 => s_chan_enable_1,
1022 
1023  s_tdata_2 => s_tdata_2,
1024  s_tvalid_2 => s_tvalid_2,
1025  s_tlast_2 => s_tlast_2,
1026  s_tready_2 => s_tready_2,
1027  s_header_mark_2 => s_header_mark_2,
1028  s_trailer_mark_2 => s_trailer_mark_2,
1029  s_hdr_crc_tag_2 => s_hdr_crc_tag_2,
1030  s_poll_chan_2 => s_poll_chan_2,
1031  s_chan_enable_2 => s_chan_enable_2,
1032 
1033  s_tdata_3 => s_tdata_3,
1034  s_tvalid_3 => s_tvalid_3,
1035  s_tlast_3 => s_tlast_3,
1036  s_tready_3 => s_tready_3,
1037  s_header_mark_3 => s_header_mark_3,
1038  s_trailer_mark_3 => s_trailer_mark_3,
1039  s_hdr_crc_tag_3 => s_hdr_crc_tag_3,
1040  s_poll_chan_3 => s_poll_chan_3,
1041  s_chan_enable_3 => s_chan_enable_3,
1042 
1043  s_tdata_4 => s_tdata_4,
1044  s_tvalid_4 => s_tvalid_4,
1045  s_tlast_4 => s_tlast_4,
1046  s_tready_4 => s_tready_4,
1047  s_header_mark_4 => s_header_mark_4,
1048  s_trailer_mark_4 => s_trailer_mark_4,
1049  s_hdr_crc_tag_4 => s_hdr_crc_tag_4,
1050  s_poll_chan_4 => s_poll_chan_4,
1051  s_chan_enable_4 => s_chan_enable_4,
1052 
1053  s_tdata_5 => s_tdata_5,
1054  s_tvalid_5 => s_tvalid_5,
1055  s_tlast_5 => s_tlast_5,
1056  s_tready_5 => s_tready_5,
1057  s_header_mark_5 => s_header_mark_5,
1058  s_trailer_mark_5 => s_trailer_mark_5,
1059  s_hdr_crc_tag_5 => s_hdr_crc_tag_5,
1060  s_poll_chan_5 => s_poll_chan_5,
1061  s_chan_enable_5 => s_chan_enable_5,
1062 
1063  s_tdata_6 => s_tdata_6,
1064  s_tvalid_6 => s_tvalid_6,
1065  s_tlast_6 => s_tlast_6,
1066  s_tready_6 => s_tready_6,
1067  s_header_mark_6 => s_header_mark_6,
1068  s_trailer_mark_6 => s_trailer_mark_6,
1069  s_hdr_crc_tag_6 => s_hdr_crc_tag_6,
1070  s_poll_chan_6 => s_poll_chan_6,
1071  s_chan_enable_6 => s_chan_enable_6,
1072 
1073  s_tdata_7 => s_tdata_7,
1074  s_tvalid_7 => s_tvalid_7,
1075  s_tlast_7 => s_tlast_7,
1076  s_tready_7 => s_tready_7,
1077  s_header_mark_7 => s_header_mark_7,
1078  s_trailer_mark_7 => s_trailer_mark_7,
1079  s_hdr_crc_tag_7 => s_hdr_crc_tag_7,
1080  s_poll_chan_7 => s_poll_chan_7,
1081  s_chan_enable_7 => s_chan_enable_7,
1082 
1083  s_tdata_8 => s_tdata_8,
1084  s_tvalid_8 => s_tvalid_8,
1085  s_tlast_8 => s_tlast_8,
1086  s_tready_8 => s_tready_8,
1087  s_header_mark_8 => s_header_mark_8,
1088  s_trailer_mark_8 => s_trailer_mark_8,
1089  s_hdr_crc_tag_8 => s_hdr_crc_tag_8,
1090  s_poll_chan_8 => s_poll_chan_8,
1091  s_chan_enable_8 => s_chan_enable_8,
1092 
1093  s_tdata_9 => s_tdata_9,
1094  s_tvalid_9 => s_tvalid_9,
1095  s_tlast_9 => s_tlast_9,
1096  s_tready_9 => s_tready_9,
1097  s_header_mark_9 => s_header_mark_9,
1098  s_trailer_mark_9 => s_trailer_mark_9,
1099  s_hdr_crc_tag_9 => s_hdr_crc_tag_9,
1100  s_poll_chan_9 => s_poll_chan_9,
1101  s_chan_enable_9 => s_chan_enable_9,
1102 
1103  s_tdata_10 => s_tdata_10,
1104  s_tvalid_10 => s_tvalid_10,
1105  s_tlast_10 => s_tlast_10,
1106  s_tready_10 => s_tready_10,
1107  s_header_mark_10 => s_header_mark_10,
1108  s_trailer_mark_10 => s_trailer_mark_10,
1109  s_hdr_crc_tag_10 => s_hdr_crc_tag_10,
1110  s_poll_chan_10 => s_poll_chan_10,
1111  s_chan_enable_10 => s_chan_enable_10,
1112 
1113 
1114 
1115 
1116  s_tdata_11 => s_tdata_11,
1117  s_tvalid_11 => s_tvalid_11,
1118  s_tlast_11 => s_tlast_11,
1119  s_tready_11 => s_tready_11,
1120  s_header_mark_11 => s_header_mark_11,
1121  s_trailer_mark_11 => s_trailer_mark_11,
1122  s_hdr_crc_tag_11 => s_hdr_crc_tag_11,
1123  s_poll_chan_11 => s_poll_chan_11,
1124  s_chan_enable_11 => s_chan_enable_11,
1125 
1126  s_tdata_12 => s_tdata_12,
1127  s_tvalid_12 => s_tvalid_12,
1128  s_tlast_12 => s_tlast_12,
1129  s_tready_12 => s_tready_12,
1130  s_header_mark_12 => s_header_mark_12,
1131  s_trailer_mark_12 => s_trailer_mark_12,
1132  s_hdr_crc_tag_12 => s_hdr_crc_tag_12,
1133  s_poll_chan_12 => s_poll_chan_12,
1134  s_chan_enable_12 => s_chan_enable_12,
1135 
1136  s_tdata_13 => s_tdata_13,
1137  s_tvalid_13 => s_tvalid_13,
1138  s_tlast_13 => s_tlast_13,
1139  s_tready_13 => s_tready_13,
1140  s_header_mark_13 => s_header_mark_13,
1141  s_trailer_mark_13 => s_trailer_mark_13,
1142  s_hdr_crc_tag_13 => s_hdr_crc_tag_13,
1143  s_poll_chan_13 => s_poll_chan_13,
1144  s_chan_enable_13 => s_chan_enable_13,
1145 
1146  s_tdata_14 => s_tdata_14,
1147  s_tvalid_14 => s_tvalid_14,
1148  s_tlast_14 => s_tlast_14,
1149  s_tready_14 => s_tready_14,
1150  s_header_mark_14 => s_header_mark_14,
1151  s_trailer_mark_14 => s_trailer_mark_14,
1152  s_hdr_crc_tag_14 => s_hdr_crc_tag_14,
1153  s_poll_chan_14 => s_poll_chan_14,
1154  s_chan_enable_14 => s_chan_enable_14,
1155 
1156 
1157 
1158 
1159  s_tdata_15 => s_tdata_15,
1160  s_tvalid_15 => s_tvalid_15,
1161  s_tlast_15 => s_tlast_15,
1162  s_tready_15 => s_tready_15,
1163  s_header_mark_15 => s_header_mark_15,
1164  s_trailer_mark_15 => s_trailer_mark_15,
1165  s_hdr_crc_tag_15 => s_hdr_crc_tag_15,
1166  s_poll_chan_15 => s_poll_chan_15,
1167  s_chan_enable_15 => s_chan_enable_15,
1168 
1169 
1170 
1171 
1172  s_tdata_16 => s_tdata_16,
1173  s_tvalid_16 => s_tvalid_16,
1174  s_tlast_16 => s_tlast_16,
1175  s_tready_16 => s_tready_16,
1176  s_header_mark_16 => s_header_mark_16,
1177  s_trailer_mark_16 => s_trailer_mark_16,
1178  s_hdr_crc_tag_16 => s_hdr_crc_tag_16,
1179  s_poll_chan_16 => s_poll_chan_16,
1180  s_chan_enable_16 => s_chan_enable_16,
1181 
1182 
1183 
1184 
1185  s_tdata_17 => s_tdata_17,
1186  s_tvalid_17 => s_tvalid_17,
1187  s_tlast_17 => s_tlast_17,
1188  s_tready_17 => s_tready_17,
1189  s_header_mark_17 => s_header_mark_17,
1190  s_trailer_mark_17 => s_trailer_mark_17,
1191  s_hdr_crc_tag_17 => s_hdr_crc_tag_17,
1192  s_poll_chan_17 => s_poll_chan_17,
1193  s_chan_enable_17 => s_chan_enable_17,
1194 
1195 
1196 
1197 
1198  s_tdata_18 => s_tdata_18,
1199  s_tvalid_18 => s_tvalid_18,
1200  s_tlast_18 => s_tlast_18,
1201  s_tready_18 => s_tready_18,
1202  s_header_mark_18 => s_header_mark_18,
1203  s_trailer_mark_18 => s_trailer_mark_18,
1204  s_hdr_crc_tag_18 => s_hdr_crc_tag_18,
1205  s_poll_chan_18 => s_poll_chan_18,
1206  s_chan_enable_18 => s_chan_enable_18,
1207 
1208 
1209 
1210 
1211  s_tdata_19 => s_tdata_19,
1212  s_tvalid_19 => s_tvalid_19,
1213  s_tlast_19 => s_tlast_19,
1214  s_tready_19 => s_tready_19,
1215  s_header_mark_19 => s_header_mark_19,
1216  s_trailer_mark_19 => s_trailer_mark_19,
1217  s_hdr_crc_tag_19 => s_hdr_crc_tag_19,
1218  s_poll_chan_19 => s_poll_chan_19,
1219  s_chan_enable_19 => s_chan_enable_19,
1220 
1221 
1222 
1223 
1224  s_tdata_20 => s_tdata_20,
1225  s_tvalid_20 => s_tvalid_20,
1226  s_tlast_20 => s_tlast_20,
1227  s_tready_20 => s_tready_20,
1228  s_header_mark_20 => s_header_mark_20,
1229  s_trailer_mark_20 => s_trailer_mark_20,
1230  s_hdr_crc_tag_20 => s_hdr_crc_tag_20,
1231  s_poll_chan_20 => s_poll_chan_20,
1232  s_chan_enable_20 => s_chan_enable_20,
1233 
1234 
1235 
1236 
1237  s_tdata_21 => s_tdata_21,
1238  s_tvalid_21 => s_tvalid_21,
1239  s_tlast_21 => s_tlast_21,
1240  s_tready_21 => s_tready_21,
1241  s_header_mark_21 => s_header_mark_21,
1242  s_trailer_mark_21 => s_trailer_mark_21,
1243  s_hdr_crc_tag_21 => s_hdr_crc_tag_21,
1244  s_poll_chan_21 => s_poll_chan_21,
1245  s_chan_enable_21 => s_chan_enable_21,
1246 
1247 
1248 
1249 
1250  s_tdata_22 => s_tdata_22,
1251  s_tvalid_22 => s_tvalid_22,
1252  s_tlast_22 => s_tlast_22,
1253  s_tready_22 => s_tready_22,
1254  s_header_mark_22 => s_header_mark_22,
1255  s_trailer_mark_22 => s_trailer_mark_22,
1256  s_hdr_crc_tag_22 => s_hdr_crc_tag_22,
1257  s_poll_chan_22 => s_poll_chan_22,
1258  s_chan_enable_22 => s_chan_enable_22,
1259 
1260 
1261 
1262  s_tdata_23 => s_tdata_23,
1263  s_tvalid_23 => s_tvalid_23,
1264  s_tlast_23 => s_tlast_23,
1265  s_tready_23 => s_tready_23,
1266  s_header_mark_23 => s_header_mark_23,
1267  s_trailer_mark_23 => s_trailer_mark_23,
1268  s_hdr_crc_tag_23 => s_hdr_crc_tag_23,
1269  s_poll_chan_23 => s_poll_chan_23,
1270  s_chan_enable_23 => s_chan_enable_23,
1271 
1272 
1273 
1274  m_tdata => ev_in_tdata,
1275  m_tvalid => ev_in_tvalid,
1276  m_tlast => ev_in_tlast,
1277  m_tready => '1', --ev_in_tready, --2023_10_24 temporary mod to check timing
1278  m_header_mark => ev_in_header_mark,
1279  m_trailer_mark => ev_in_trailer_mark,
1280  m_hdr_crc_tag => ev_in_hdr_crc_tag,
1281  m_poll_chan_0 => m_poll_chan_0,
1282  m_chan_enable => ev_chan_enable,
1283 
1284 
1285 
1286 
1287  nxt_chan_0 => nxt_chan_0,
1288  nxt_chan_1 => '0',
1289  nxt_chan_2 => '0', --nxt_chan_2,
1290  nxt_chan_3 => '0', --nxt_chan_3,
1291 
1292  current_chan => current_chan,
1293  first_chan => first_chan(4 downto 0),
1294  last_chan => last_chan(4 downto 0)
1295 
1296  );
1297 
1298  event_builder_0 : ev_builder
1299  generic map (
1300  jfex => jfex,
1301  CRC20_G_Poly => CRC20_G_Poly
1302  )
1303  port map (clock => pp_clock,
1304  reset => reset,
1305  geo_location => geo_location,
1306  s_tdata => ev_in_tdata,
1307  s_tvalid => ev_in_tvalid,
1308  s_tlast => ev_in_tlast,
1309  s_header_mark => ev_in_header_mark,
1310  s_trailer_mark => ev_in_trailer_mark,
1311  s_hdr_crc_tag => ev_in_hdr_crc_tag,
1312 
1313  s_tready => ev_in_tready,
1314  nxt_chan => nxt_chan_0,
1315  empty_0 => '0',
1316  empty_1 => '0',
1317  empty_2 => '0',
1318  empty_3 => '0',
1319 -- empty_stat
1320 
1321  match_0 => '0',
1322  match_1 => '0',
1323  match_2 => '0',
1324  match_3 => '0',
1325 -- hdr_match
1326  current_chan => current_chan,
1327 -- num_chan => x"b",
1328  num_chan => last_chan(4 downto 0),
1329  chan_in => dum_chin,
1330 
1331  chan_enable => ev_chan_enable,
1332  first_chan => first_chan(4 downto 0),
1333  last_chan => last_chan(4 downto 0),
1334  chan_pointer_reset => chan_pointer_reset,
1335  any_chan_active => any_chan_active,
1336  event_sel => event_sel,
1337  rod_slot => rod_slot,
1338 
1339  flx_backpressure => flx_backpressure_bit,
1340  flx_bp_enable => flx_bp_enable,
1341 
1342  TTC_ignore => TTC_ignore,
1343 
1344  poll_chan => m_poll_chan_0,
1345 
1346  lead_follow_b => '1',
1347  comb_error => '0',
1348  master_header => master_header,
1349  header_fifo_empty => header_fifo_empty,
1350  L1ID_error => L1ID_error,
1351  CTTC_CRC_error => CTTC_CRC_error,
1352  header_read_en => header_read_en,
1353  header_fifo_valid => header_fifo_valid,
1354  header_fifo_full => header_fifo_full,
1355  header_sequence => header_sequence,
1356  header_type => header_type,
1357 
1358  m_tvalid => m_tvalid_i,
1359  m_tlast => m_tlast_i,
1360  m_tdata => m_tdata_i,
1361  m_header_marker => m_header_marker_i,
1362  m_tail_marker => m_tail_marker,
1363  m_tready => '1',
1364  state_out => current_state,
1365  event_fifo_level => event_fifo_level,
1366  debug_fifo_level => debug_fifo_level,
1367  crc20_err => crc20_err,
1368  crc20_err_chan => crc20_err_chan,
1369  crc9_err => crc9_err,
1370  BCID_mismatch => BCID_mismatch,
1371  L1ID_mismatch => L1ID_mismatch,
1372  timeout_err => timeout_err,
1373  timeout_1_val => timeout_1_val,
1374  timeout_n_val => timeout_n_val,
1375 
1376  tob_timeout_1_disable => tob_timeout_1_disable,
1377  tob_timeout_n_disable => tob_timeout_n_disable,
1378 
1379  wdog_overflow => wdog_overflow,
1380  wdog_threshold => wdog_threshold,
1381  wdog_disable => wdog_disable,
1382  l1id_resync_enable => l1id_resync_enable,
1383  ttc_rollover => ttc_rollover,
1384 
1385  dbg_pkt_count => dbg_pkt_count,
1386  dbg_pkt_count_reset=> dbg_pkt_count_reset,
1387  L1ID_ttc_32_reg_out => L1ID_ttc_32_reg,
1388  stop_proc => stop_proc,
1389 
1390  l1id_max_l1id_o => l1id_max_l1id,
1391  l1id_measure_max_o => l1id_measure_max,
1392  l1id_measure_last_o => l1id_measure_last,
1393  clr_pkt_wait_timer => clr_pkt_wait_timer,
1394  timeout_counter_max => timeout_counter_max,
1395  max_chan => max_chan,
1396  clr_max_timeout => clr_max_timeout
1397  );
1398 
1399  timeout_err_out <= timeout_err;
1400  m_tvalid <= m_tvalid_i;
1401  m_tlast <= m_tlast_i;
1402  m_tdata <= m_tdata_i;
1403  m_header_marker <= m_header_marker_i;
1404 
1405 
1406  pulse_stretcher : pulse_stretch
1407  generic map (
1408  COUNTER_WIDTH => 4
1409  )
1410  Port map (
1411  clock => pp_clock,
1412  reset => system_reset,
1413  pulse_in => l1id_mismatch,
1414  pulse_out => l1id_mis_stretch
1415  );
1416 
1417 
1418 gen_reg: if SIM=0 generate
1419 status_regs : tob_proc_regs
1420  generic map (
1421  sim => sim,
1422  timeout_1_default => timeout_1_default,
1423  timeout_n_default => timeout_n_default
1424  )
1425  port map (
1426  ipb_clk => ipb_clk,
1427  ipb_rst => ipb_rst,
1428  ipb_in => ipb_in,
1429  ipb_out => ipb_out,
1430  pp_clock => pp_clock,
1431  rt_clk => rt_clk,
1432  reset => system_reset,
1433  event_fifo_level => event_fifo_level(15 downto 0),
1434  debug_fifo_level => debug_fifo_level(15 downto 0),
1435  stage_fifo_level => stage_fifo_level,
1436 -- current_chan(4 downto 0) => current_chan,
1437 -- current_chan(7 downto 5) => "000",
1438  first_chan => first_chan(4 downto 0),
1439  current_state(5 downto 0) => current_state,
1440  current_state(7 downto 6) => "00",
1441  header_mark => ev_in_header_mark,
1442  header_fifo_valid => header_fifo_valid,
1443  hdr_crc_error => ev_in_hdr_crc_tag,
1444  ttc_crc_error => CTTC_CRC_error,
1445  full_mode_ctrl => full_mode_ctrl_i,
1446  full_mode_stat => full_mode_stat,
1447  FM_L1id_stat => FM_L1id_stat,
1448  m_tdata => m_tdata_i,
1449  m_tvalid => m_tvalid_i,
1450  m_tlast => m_tlast_i,
1451  m_header_marker => m_header_marker_i,
1452 -- master_header => master_header,
1453  L1ID_ttc_32_reg => L1ID_ttc_32_reg,
1454  --input capture--
1455  s_tdata => ev_in_tdata,
1456  s_tvalid => ev_in_tvalid,
1457  s_tlast => ev_in_tlast,
1458  s_header_mark => ev_in_header_mark,
1459  poll_chan => m_poll_chan_0,
1460  ---
1461  crc20_err => crc20_err,
1462  crc20_err_chan => crc20_err_chan,
1463  crc9_err => crc9_err,
1464  BCID_mismatch => BCID_mismatch,
1465  L1ID_mismatch => L1ID_mismatch,
1466  timeout_err => timeout_err,
1467  stage_fifo_busy => stage_fifo_busy,
1468  stage_fifo_xoff => stage_fifo_xoff,
1469  stage_fifo_full => stage_fifo_full,
1470  timeout_1_val => timeout_1_val,
1471  timeout_n_val => timeout_n_val,
1472 
1473  tob_timeout_1_disable => tob_timeout_1_disable,
1474  tob_timeout_n_disable => tob_timeout_n_disable,
1475 
1476  wdog_overflow => wdog_overflow,
1477  wdog_threshold => wdog_threshold,
1478  wdog_disable => wdog_disable,
1479  l1id_resync_enable => l1id_resync_enable,
1480  wdog_fifo_reset => wdog_fifo_reset_i,
1481 
1482  dbg_pkt_count => dbg_pkt_count,
1483  dbg_pkt_count_reset => dbg_pkt_count_reset,
1484  flx_backpressure => flx_backpressure,
1485  flx_backpressure_bit => flx_backpressure_bit,
1486  stop_proc => stop_proc,
1487  l1id_max_l1id => l1id_max_l1id,
1488  l1id_measure_max => l1id_measure_max,
1489  l1id_measure_last => l1id_measure_last,
1490  clr_pkt_wait_timer => clr_pkt_wait_timer,
1491 
1492  timeout_counter_max => timeout_counter_max,
1493  max_chan => max_chan,
1494  clr_max_timeout => clr_max_timeout,
1495 
1496  last_chan => last_chan,
1497  nxt_chan_0 => nxt_chan_0,
1498  chan_pointer_reset => chan_pointer_reset
1499 
1500  );
1501 end generate gen_reg;
1502 
1503 full_mode_ctrl <= full_mode_ctrl_i;
1504 flx_bp_enable <= full_mode_ctrl_i(4);
1505 wdog_fifo_reset <= wdog_fifo_reset_i;
1506 
1507 --------felix backpressure selection mux -------
1508 
1509 
1510 
1511 flx_backpressure_tob <= flx_backpressure_bit;
1512 
1513 
1514 
1515  chan_in_gen : dummy_chan_in
1516  Port map (
1517  current_chan => current_chan,
1518  chan_out => dum_chin,
1519  -- num_chan => x"b",
1520  num_chan => last_chan(4 downto 0),
1521  clock => pp_clock,
1522  reset => reset
1523  );
1524 
1525 
1526 
1527 
1528 
1529 -- input_mux_ila : ppmux_ila
1530 -- PORT MAP (
1531 -- clk => pp_clock,
1532 
1533 -- probe0 => current_chan,
1534 -- probe1(0) => ev_chan_enable,
1535 -- probe2(0) => ev_in_header_mark,
1536 -- probe3 => ev_in_tdata,
1537 -- probe4(0) => ev_in_tlast,
1538 -- probe5(0) => ev_in_trailer_mark,
1539 -- probe6(0) => ev_in_tvalid,
1540 -- probe7(0) => m_poll_chan_0,
1541 -- probe8(0) => '0',
1542 -- probe9(0) => ev_in_hdr_crc_tag
1543 -- );
1544 
1545 
1546 end RTL;