AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Files Variables
fed_itf.vhd
1 ------------------------------------------------------
2 -- data IN from FED
3 --
4 -- Ver 1.00
5 --
6 -- Dominique Gigi May 2015
7 ------------------------------------------------------
8 -- This is the TOP level of the core for the sender part
9 --
10 ------------------------------------------------------
11 LIBRARY ieee;
12 library work;
13 USE ieee.std_logic_1164.all;
14 use ieee.numeric_std.all;
15 use ieee.std_logic_unsigned.all;
16 use work.mydefs.all;
17 
18 
19 entity fed_itf is
20  generic (generator : boolean := false);
21 port (
22  reset_sysCLK : in std_logic;
23  Greset_sysCLK : in std_logic;
24  sys_clk : in std_logic;
25 
26 -- link data write enable ACTIVE LOW
27  LinkWe : in STD_LOGIC;
28 -- link data header/trailer marker when '0'
29  LinkCtrl : in STD_LOGIC;
30 -- link data
31  LinkData : in STD_LOGIC_VECTOR (63 downto 0);
32 -- link data buffer almost full ACTIVE LOW
33  LinkAlmostFull : out STD_LOGIC;
34 -- link down ACTIVE LOW
35  LinkDown : out STD_LOGIC;
36 --
37  src_ID : in STD_LOGIC_VECTOR (15 downto 0);
38 -- enables error injection to test error recovery
39  inject_err : in STD_LOGIC_VECTOR (17 downto 0);
40 -- Link status data read out
41  read_ce : in STD_LOGIC;
42  addr : in STD_LOGIC_VECTOR (15 downto 0);
43  status_data : out STD_LOGIC_VECTOR (63 downto 0);
44 
45 -- Interface for internal logic
46  reset_CLK : in std_logic;
47  Greset_CLK : in std_logic;
48  clock : in std_logic; -- clock from internal logic
49  block_free : in std_logic; -- almost one block is free
50 
51  data_fed : out std_logic_vector(63 downto 0);
52  block_sz_fed : out std_logic_vector(15 downto 0);
53  wr_ena : out std_logic;
54  start_evt : out std_logic; -- this block is the first for the current event
55  stop_evt : out std_logic; -- this block is the last for the current event -- both can be set
56  end_blk_fed : out std_logic; -- indicate end of the packet (max 4KBytes)
57  -- interface slave to read and write
58  wr_cmd : in std_logic;
59  func : in std_logic_vector(31 downto 0);
60  data_wr : in std_logic_vector(31 downto 0);
61  data_rd : out std_logic_vector(63 downto 0);
62  cnt_evt : out std_logic; -- pulse for each event (on sys_clk);
63  cnt_pckt_rcv : in std_logic_vector(31 downto 0);
64  cnt_pckt_snd : in std_logic_vector(31 downto 0);
65  -- status
66  retransmit_ena : in std_logic;
67  status_state_build_p : in std_logic_vector(31 downto 0);
68  status_state_core : in std_logic_vector(31 downto 0);
69  Serdes_status : in std_logic_vector(31 downto 0)
70  );
71 
72 end fed_itf;
73 
74 architecture behavioral of fed_itf is
75 
76 type fill_blk_type is ( idle,
77  read_fifo,
78  update_para,
79  dummy_a,
80  dummy_b,
81  dummy_c -- dummy state implement du to the CRC check , which take 2 clock cylces more
82  );
83 signal fill_blk,fill_blkNext:fill_blk_type;
84 
85 component FIFO_sync
86  port
87  (
88  aclr : in std_logic; -- active low
89  clk_w : in std_logic;
90  wen : in std_logic;
91  dataw : in std_logic_vector(65 downto 0);
92  almost_f : out std_logic; -- active low
93  clk_r : in std_logic;
94  datar : out std_logic_vector(65 downto 0);
95  ren : in std_logic;
96  empty : out std_logic -- active low
97  );
98 end component;
99 
100 component event_generator
101  port (
102  reset : IN std_logic;
103  low_clk : IN std_logic; -- frequency of 50 Mhz
104  PCIe_clk : IN std_logic;
105  PCIe_func : IN std_logic_vector(15 downto 0);
106  PCIe_wen : IN std_logic;
107  PCIe_dti : IN std_logic_vector(31 downto 0);
108  PCIe_dto : out std_logic_vector(31 downto 0);
109  PCIe_cs : IN std_logic;
110  evt_clk : IN std_logic;
111  wen : OUT std_logic;
112  data : OUT std_logic_vector(63 downto 0);
113  uctrl : OUT std_logic;
114  Back_p : IN std_logic -- Back_p when '0'
115  );
116 end component;
117 
118 component CRC_SLINKx
119  Port (
120  D : in std_logic_vector(63 downto 0);
121  CRC_out : out std_logic_vector(15 downto 0);
122  clk : in std_logic;
123  clear : in std_logic;
124  enable : in std_logic);
125 end component;
126 
127 component freq_measure
128 port (
129  reset : in std_logic;
130  sysclk : in std_logic;-- clock used by the FED to send data and to measure the backpressure
131  base_clk : in std_logic;-- clock base used to measure the sysclk
132  frequency : out std_logic_vector(31 downto 0)-- measure of the frequency)
133 );
134 end component;
135 
136 signal G_rst_rd : std_logic;
137 signal datar_rreg : std_logic_vector(63 downto 0);
138 signal data_out : std_logic_vector(63 downto 0);
139 signal datar : std_logic_vector(65 downto 0);
140 signal datar_reg : std_logic_vector(63 downto 0);
141 signal start_evt_mem : std_logic;
142 signal stop_evt_mem : std_logic;
143 signal end_frag : std_logic;
144 signal finish_blk : std_logic;
145 signal empt_ff : std_logic;
146 
147 signal rd_ff_reg : std_logic;
148 signal del_rd_ff : std_logic_vector(1 downto 0);
149 signal blk_size : std_logic_vector(15 downto 0);
150 signal blk_full : std_logic;
151 signal blk_full_anti : std_logic;
152 
153 signal End_pckt_lgc : std_logic;
154 signal last_word : std_logic;
155 signal sel_test_mode : std_logic;
156 signal wen_tm : std_logic;
157 signal data_tm : std_logic_vector(63 downto 0);
158 signal uctrl_tm : std_logic;
159 signal backpressure_mux : std_logic;
160 signal wen_mux : std_logic;
161 signal data_mux : std_logic_vector(63 downto 0);
162 signal uctrl_mux : std_logic;
163 signal PCIe_dto : std_logic_vector(31 downto 0);
164 signal local_reg : std_logic_vector(31 downto 0);
165 signal LINKDOWN_cell : std_logic;
166 
167 -- use to pipe frgament during the CRC check
168 signal data_r_crc : std_logic_vector(63 downto 0);
169 signal wen_ra : std_logic;
170 
171 signal CRC_Rst : std_logic;
172 signal CRC_Check : std_logic;
173 signal ena_CRC : std_logic;
174 signal ena_CRC_reg : std_logic;
175 signal CRC_frag : std_logic_vector(15 downto 0);
176 signal CRC_cmp : std_logic_vector(15 downto 0);
177 signal data_rb_mux : std_logic_vector(63 downto 0);
178 signal backpressure : std_logic;
179 
180 -- statistic values
181 signal block_counter : std_logic_vector(31 downto 0);
182 signal event_counter : std_logic_vector(31 downto 0);
183 signal data_counter : std_logic_vector(63 downto 0);
184 signal Retransmit_counter : std_logic_vector(31 downto 0);
185 signal cnt_back_p : std_logic_vector(31 downto 0);
186 signal FED_CRC_error_cnt : std_logic_vector(31 downto 0);
187 signal state_machine_status: std_logic_vector(2 downto 0);
188 
189 
190 signal blk_size_reg : std_logic_vector(15 downto 0);
191 signal start_evt_mem_reg : std_logic;
192 signal stop_evt_mem_reg : std_logic;
193 signal End_pckt_lgc_reg : std_logic;
194 
195 signal freq_measure_reg : std_logic_vector(31 downto 0);
196 signal rsyc_test_mode : std_logic_vector(1 downto 0);
197 signal rsyc_DAQON : std_logic_vector(1 downto 0);
198 
199  --***********************************************************
200  --********************** BEGIN ****************************
201  --***********************************************************
202 begin
203 
204 
205 -- Set the TEST mode and DAQ_ON with function (6)
206 -- this function will come from optical link send by DAQ side
207 process(Greset_CLK,clock)
208 begin
209  if Greset_CLK = '0' then
210  sel_test_mode <= '0';
211  LINKDOWN_cell <= '0';
212  elsif rising_edge(clock) then
213  if func(6) = '1' and wr_cmd = '1' then
214  sel_test_mode <= data_wr(31);
215  LINKDOWN_cell <= data_wr(30);
216  end if;
217  end if;
218 end process;
219 
220 process(sys_clk)
221 begin
222  if rising_edge(sys_clk) then
223  rsyc_test_mode(1) <= rsyc_test_mode(0);
224  rsyc_test_mode(0) <= sel_test_mode;
225  END IF;
226 end process;
227 
228 
229 local_reg(31) <= sel_test_mode;
230 local_reg(30) <= LINKDOWN_cell;
231 local_reg(29) <= Backpressure;
232 local_reg(28) <= '1' when block_free = '1' else '0';
233 local_reg(27 downto 3) <= (others => '0');
234 local_reg(2 downto 0) <= state_machine_status(2 downto 0);
235 
236 process(Greset_sysCLK,sys_clk)
237 begin
238  if rising_edge(sys_clk) then
239  rsyc_DAQON(1) <= rsyc_DAQON(0);
240  rsyc_DAQON(0) <= LINKDOWN_cell;
241  end if;
242 end process;
243 
244 LinkDown <= rsyc_DAQON(1);
245 
246 -- measure the frequency used by the fed to send data
247 req_i1:freq_measure
248 port map(
249  reset => Greset_sysCLK,
250  sysclk => sys_clk, -- clock used by the FED to send data and to measure the backpressure
251  base_clk => clock,
252  frequency => freq_measure_reg -- measure of the frequency)
253 );
254 
255 process(Greset_sysCLK,sys_clk)
256 begin
257  if Greset_sysCLK = '0' then
258  cnt_back_p <= (others => '0');
259  elsif rising_edge(sys_clk) then
260  if backpressure_mux = '0' then
261  cnt_back_p <= cnt_back_p + '1';
262  end if;
263  end if;
264 end process;
265 
266 --multiplex data local and Event_gen status/data for read command coming from optical link send by DAQ side
267 
268 process(clock)
269 begin
270  if rising_edge(clock) then
271  data_rd(63 downto 32) <= (others => '0');
272  if func(6) = '1' then
273  data_rd(31 downto 0) <= local_reg;
274  elsif func(7) = '1' then
275  data_rd <= data_counter;
276  elsif func(8) = '1' then
277  data_rd(31 downto 0) <= event_counter;
278  elsif func(9) = '1' then
279  data_rd(31 downto 0) <= block_counter;
280  elsif func(10) = '1' then
281  data_rd(31 downto 0) <= cnt_pckt_rcv;
282  elsif func(11) = '1' then
283  data_rd(31 downto 0) <= status_state_core;
284  elsif func(12) = '1' then
285  data_rd(31 downto 0) <= cnt_pckt_snd;
286  elsif func(13) = '1' then
287  data_rd(31 downto 0) <= status_state_build_p;
288  elsif func(14) = '1' then
289  data_rd(31 downto 0) <= cnt_back_p;
290  elsif func(15) = '1' then
291  data_rd(31 downto 0) <= version;
292  elsif func(16) = '1' then
293  data_rd(31 downto 0) <= Serdes_status;
294  elsif func(17) = '1' then
295  data_rd(31 downto 0) <= Retransmit_counter;
296  elsif func(18) = '1' then
297  data_rd(31 downto 0) <= freq_measure_reg;
298  else
299  data_rd(31 downto 0) <= PCIe_dto;
300  end if;
301  end if;
302 end process;
303 
304 -- status going back to FED side
305 process(sys_clk)
306 begin
307  if rising_edge(sys_clk) then
308  status_data(63 downto 00) <= (others => '0');
309  if addr = x"0001" then
310  status_data(31 downto 0) <= local_reg;
311  elsif addr = x"0002" then
312  status_data <= data_counter;
313  elsif addr = x"0003" then
314  status_data(31 downto 0) <= event_counter;
315  elsif addr = x"0004" then
316  status_data(31 downto 0) <= block_counter;
317  elsif addr = x"0005" then
318  status_data(31 downto 0) <= cnt_pckt_rcv;
319  elsif addr = x"0006" then
320  status_data(31 downto 0) <= status_state_core;
321  elsif addr = x"0007" then
322  status_data(31 downto 0) <= cnt_pckt_snd;
323  elsif addr = x"0008" then
324  status_data(31 downto 0) <= status_state_build_p;
325  elsif addr = x"0009" then
326  status_data(31 downto 0) <= cnt_back_p;
327  elsif addr = x"000A" then
328  status_data(31 downto 0) <= version;
329  elsif addr = x"000B" then
330  status_data(31 downto 0) <= Serdes_status;
331  elsif addr = x"000C" then
332  status_data(31 downto 0) <= Retransmit_counter;
333  elsif addr = x"000D" then
334  status_data(31 downto 0) <= FED_CRC_error_cnt;
335  end if;
336  end if;
337 end process;
338 
339 -- retransmit counter
340 process(Greset_CLK,clock)
341 begin
342  if Greset_CLK = '0' then
343  Retransmit_counter <= (others => '0');
344  elsif rising_edge(clock) then
345  if retransmit_ena = '1' then
346  Retransmit_counter <= Retransmit_counter + '1';
347  end if;
348  end if;
349 end process;
350 
351 -- local Event generator used to test the link
352 generator_inst:if generator generate
353  i1:event_generator
354  port map(
355  reset => Greset_CLK,
356  low_clk => clock, -- frequency of ??? Mhz
357  PCIe_clk => clock,
358  PCIe_func => func(15 downto 0),
359  PCIe_wen => wr_cmd,
360  PCIe_dti => data_wr,
361  PCIe_dto => PCIe_dto,
362  PCIe_cs => sel_test_mode,
363  evt_clk => sys_clk,
364  wen => wen_tm,
365  data => data_tm,
366  uctrl => uctrl_tm,
367  Back_p => backpressure_mux
368  );
369 
370 end generate;
371 
372 --******************************************************************************
373 -- multiplexer for event DATA
374 -- mux external (FED) and local data path (Event generator) ********************
375 
376 wen_mux <= wen_tm when rsyc_test_mode(1) = '1' and generator else not(LinkWe);
377 data_mux <= data_tm when rsyc_test_mode(1) = '1' and generator else LinkData;
378 uctrl_mux <= uctrl_tm when rsyc_test_mode(1) = '1' and generator else LinkCtrl;
379 
380 --******************************************************************************
381 process(Greset_sysCLK,sys_clk)
382 begin
383  if Greset_sysCLK = '0' then
384  data_counter <= (others => '0');
385  elsif rising_edge(sys_clk) then
386  if wen_mux = '1' then
387  data_counter <= data_counter + '1';
388  end if;
389  end if;
390 end process;
391 
392 --indicate the last word of the EVENT
393 end_frag <= '1' when data_mux(63 downto 60) = x"A" and uctrl_mux = '0' else '0';
394 
395 -- pulse to count the number of event dicover
396 process(Greset_sysCLK,sys_clk)
397 begin
398 if Greset_sysCLK = '0' then
399  cnt_evt <= '0';
400 elsif rising_edge(sys_clk) then
401  cnt_evt <= '0';
402  if end_frag = '1' then
403  cnt_evt <= '1';
404  end if;
405 end if;
406 end process;
407 
408 -- internal FIFO used to chnage the DATA clock domaine
409 internal_FIFO:FIFO_sync --Show A Head ON
410 port map
411  (
412  aclr => Greset_sysCLK,
413  clk_w => sys_clk,
414  wen => wen_mux,
415  dataw(63 downto 0) => data_mux,
416  dataw(64) => uctrl_mux ,
417  dataw(65) => end_frag ,
418  almost_f => backpressure_mux ,
419 
420  clk_r => clock,
421  datar => datar,
422  ren => rd_ff_reg,
423  empty => empt_ff
424  );
425 
426 -- LinkAlmostFull LFF is valid only in no TEST mode otherwise ALLTIME active (low)
427 Backpressure <= '0' when rsyc_test_mode(1) = '1' else backpressure_mux;
428 LinkAlmostFull <= Backpressure;
429 
430 --******************************************************************************
431 -- -******* This state machine is used to read the FIFO and fill the blocks in the CORE_LOGIC.VHD file
432 --state machine clock
433 FED_itf_state_clk:process(Greset_CLK,clock)
434 begin
435 if Greset_CLK = '0' then
436  fill_blk <= idle;
437 elsif rising_edge(clock) then
438  fill_blk <= fill_blkNext;
439 end if;
440 end process;
441 
442 FED_itf_state_machine:process(fill_blk,empt_ff,block_free,blk_full,last_word)
443 begin
444 fill_blkNext <= fill_blk;
445 state_machine_status <= (others => '0');
446 Case fill_blk is
447  -- wait data and free block in CORE_LOGIC.VHD
448 
449  when idle =>
450  state_machine_status(0) <='1';
451  if empt_ff = '0' and block_free = '1' then
452  fill_blkNext <= read_fifo;
453  end if;
454 
455  -- continue until the last word of the EVENT or until no free BLOCK
456  when read_fifo =>
457  state_machine_status(1) <='1';
458  if blk_full = '1' or last_word = '1' then --stop_evt_mem = '1' then
459  fill_blkNext <= update_para;
460  end if;
461 
462  -- unpdate flags and indicate end of block (block full or end_of_event)
463  when update_para =>
464  state_machine_status(2) <='1';
465  fill_blkNext <= dummy_a;
466 
467  when dummy_a =>
468  fill_blkNext <= dummy_b;
469 
470  when dummy_b =>
471  fill_blkNext <= dummy_c; -- take 3 clock to finish to clsoe the buffer, if no the block_free value can be wrong
472 
473  when dummy_c =>
474  fill_blkNext <= idle;
475 
476  when others =>
477  fill_blkNext <= idle;
478  end case;
479 end process;
480 --******************************************************************************
481 
482 last_word <= '1' when rd_ff_reg = '1' and datar(65) = '1' else '0';
483 
484 G_rst_rd <= '0' when Greset_CLK = '0' or empt_ff = '1' or blk_full = '1' else '1';
485 
486 -- automatic read FIFO until the the last word of the EVENT or end of block (change state FILL_BLK)
487 process(G_rst_rd,clock)
488 begin
489 if G_rst_rd = '0' then
490  rd_ff_reg <= '0';
491 elsif rising_edge(clock) then
492  rd_ff_reg <= '0';
493  if fill_blk = read_fifo and last_word = '0' then
494  rd_ff_reg <= '1';
495  end if;
496 end if;
497 end process;
498 
499 --******************************************************************************
500 -- CRC check
501 process(Greset_CLK,clock)
502 begin
503  if Greset_CLK = '0' then
504  CRC_Rst <= '1';
505  ena_crc <= '0';
506  event_counter <= (others => '0');
507  elsif rising_edge(clock) then
508 
509  if datar(64) = '0' and datar(63 downto 60) = x"A" and rd_ff_reg = '1' then -- UCTRL= 0 + trailer + DATA_valid
510  -- remove the CRC in the trailer to compute the CRC
511  data_r_crc(63 downto 32) <= datar(63 downto 32);
512  data_r_crc(31 downto 16) <= (others => '0');
513  data_r_crc(15 downto 0) <= datar(15 downto 0);
514  else
515  data_r_crc <= datar(63 downto 00);
516  end if;
517  wen_ra <= rd_ff_reg;
518  datar_reg <= datar(63 downto 00);
519 
520  -- create the envelop of the event + counter status
521  if datar(64) = '0' and datar(63 downto 60) = x"5" and rd_ff_reg = '1' then
522  event_counter <= event_counter + '1';
523  end if;
524 
525  -- specify the place of the Trailer
526  ena_CRC_reg <= ena_CRC;
527 
528  ena_crc <= '0';
529  if datar(64) = '0' and datar(63 downto 60) = x"A" and rd_ff_reg = '1' then
530  ena_crc <= '1';
531  crc_frag <= datar(31 downto 16);
532  end if;
533 
534  -- reset the CRC machine between 2 fragments
535  if ena_crc = '1' then
536  CRC_Rst <= '1';
537  elsif datar(64) = '0' and datar(63 downto 60) = x"5" and rd_ff_reg = '1' then
538  CRC_Rst <= '0';
539  end if;
540 
541  end if;
542 end process;
543 
544 -- compute the CRC
545 i_crc_check:CRC_SLINKx
546  Port map(
547  clear => CRC_Rst,
548  clk => clock,
549  D => data_r_crc,
550  enable => wen_ra,
551  CRC_out => crc_cmp
552  );
553 
554 -- compare the CRC received and the CRC computed
555 crc_check <= '0' when crc_cmp = crc_frag else '1';
556 
557 -- count number of FED crc error
558 process(Greset_CLK,clock)
559 begin
560  if Greset_CLK = '0' then
561  FED_CRC_error_cnt <= (others => '0');
562  elsif rising_edge(clock) then
563  if ena_CRC_reg = '1' and crc_check = '1' then
564  FED_CRC_error_cnt <= FED_CRC_error_cnt + '1';
565  end if;
566  end if;
567 end process;
568 
569 -- generate FLAG to indicate the beginning and the end of the event for each BLOCK
570 process(Greset_CLK,clock)
571 begin
572 if Greset_CLK = '0' then
573  start_evt_mem <= '0';
574  stop_evt_mem <= '0';
575 elsif rising_edge(clock) then
576  if datar(64) = '0' and datar(63 downto 60) = x"5" and rd_ff_reg = '1' then
577  start_evt_mem <= '1';
578  elsif last_word = '1' then
579  stop_evt_mem <= '1';
580  elsif fill_blk = update_para then --finish_blk = '1' then
581  start_evt_mem <= '0';
582  stop_evt_mem <= '0';
583  end if;
584 end if;
585 end process;
586 
587 -- compute the size of valid data in the BLOCK
588 process(Greset_CLK,clock)
589 begin
590 if Greset_CLK = '0' then
591  blk_size <= (others => '0');
592 elsif rising_edge(clock) then
593  if fill_blk = idle then
594  blk_size <= (others => '0');
595  elsif rd_ff_reg = '1' and blk_full = '0' then
596  blk_size <= blk_size + '1';
597  end if;
598 end if;
599 end process;
600 
601 -- count the number of block used
602 process(Greset_CLK,clock)
603 begin
604  if Greset_CLK = '0' then
605  block_counter <= (others => '0');
606  elsif rising_edge(clock) then
607  if blk_full = '1' or last_word = '1' then
608  block_counter <= block_counter + '1';
609  end if;
610  end if;
611 end process;
612 
613 --flag when the BLOCK is full
614 process(Greset_CLK,clock)
615 begin
616 if Greset_CLK = '0' then
617  blk_full <= '0';
618 elsif rising_edge(clock) then
619  if blk_size = x"01FF" and rd_ff_reg = '1' then --blk_size = 0x200
620  blk_full <= '1';
621  elsif End_pckt_lgc = '1' then
622  blk_full <= '0';
623  end if;
624 end if;
625 end process;
626 
627 End_pckt_lgc <= '1' when fill_blk = update_para else '0';
628 
629 --Pipe data for the CRC check
630 
631 process(clock)
632 begin
633  if rising_edge(clock) then
634  datar_rreg(63 downto 0) <= datar_reg(63 downto 0);
635  blk_size_reg <= blk_size;
636  start_evt_mem_reg <= start_evt_mem;
637  stop_evt_mem_reg <= stop_evt_mem;
638  End_pckt_lgc_reg <= End_pckt_lgc;
639  end if;
640 end process;
641 
642 
643 data_out(63 downto 32) <= datar_rreg(63 downto 32);
644 data_out(31 downto 16) <= crc_cmp when ena_CRC_reg = '1' else datar_rreg(31 downto 16);
645 data_out(15 downto 3) <= datar_rreg(15 downto 3);
646 data_out(2) <= crc_check when ena_CRC_reg = '1' else datar_rreg(2);
647 data_out(1 downto 0) <= datar_rreg(1 downto 0) ;
648 
649 process(clock)
650 begin
651  if rising_edge(clock) then
652  del_rd_ff(1) <= del_rd_ff(0);
653  del_rd_ff(0) <= rd_ff_reg;
654  end if;
655 end process;
656 
657 --Output value to Optical interface
658 block_sz_fed <= blk_size_reg; -- number of data in the block ready to send
659 data_fed <= data_out;
660 wr_ena <= del_rd_ff(1);
661 start_evt <= start_evt_mem_reg; -- flag is set if this block is the first of the event
662 stop_evt <= stop_evt_mem_reg; -- flag is set if this block is the last of the event
663 end_blk_fed <= End_pckt_lgc_reg; -- flag is set at the end of the event
664 
665 end behavioral;