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