Belle II KLM Scint Firmware  1
SingleBusProcessing.vhd
1 library IEEE;
2 use IEEE.STD_LOGIC_1164.ALL;
3 use IEEE.NUMERIC_STD.ALL;
4 use IEEE.STD_LOGIC_MISC.ALL;
5 use IEEE.STD_LOGIC_UNSIGNED.ALL;
6 Library work;
7 use work.klm_scint_pkg.all;
8 
21 
23  generic (
24  baseline_g : std_logic_vector(11 downto 0) := "110000000000"; -- 3072
25  SLOW_CTRL_BUFF : integer := 5;
26  N_BITS_AVG_g : integer
27  );
28  port (
29  clk : in std_logic := '0';
30  rst : in std_logic := '0';
31  ped_sub_ena : in std_logic;
32  disambig_tb5 : in std_logic;
33  -- use_self_trig : in std_logic;
34  measure_peds : in std_logic;
35  stream_peds : in std_logic;
36  ena : in std_logic := '0';
37  win_samp_start : in slv14(4 downto 0) := (others => (others=>'0'));
38  trig_bits : in slv5(4 downto 0) := (others=> "00000");
39  asic_mask : in std_logic_vector(4 downto 0) := (others => '0');
40  first_dig_win : in std_logic_vector(8 downto 0);
41  last_dig_win : in std_logic_vector(8 downto 0);
42 
43  -- pedestal data
44  ped_fetch_asic_no : out std_logic_vector(2 downto 0) := (others => '0');
45  ped_fetch_chan : out std_logic_vector(3 downto 0) := (others => '0');
46  ped_win_samp_start : out std_logic_vector(13 downto 0) := (others => '0');
47  ped_fetch_ena : out std_logic := '0';
48  ped_fetch_ack : in std_logic := '0';
49  ped_fifo_wr_asic : in std_logic_vector(4 downto 0) := (others => '0');
50  ped_fifo_wr_chan : in std_logic_vector(3 downto 0) := (others => '0');
51  ped_fifo_wr_ena : in std_logic := '0';
52  ped_fifo_din : in std_logic_vector(11 downto 0) := (others => '0');
53 
54  -- wires for/to/from TargetX
55  -- bus_mask : out std_logic_vector(13 downto 0) := (others => '0');
56  BUS_RD_ENA : out std_logic := '0';
57  BUS_RAMP : out std_logic := '0';
58  BUS_CLR : out std_logic := '0';
59  BUS_DO : in std_logic_vector(14 downto 0) := (others => '0');
60  SR_CLR : out std_logic := '0';
61  SR_CLK : out std_logic_vector(4 downto 0) := (others => '0');
62  SR_SEL : out std_logic := '0'; -- set high & pulse sr_clk once to load test pattern
63  BUS_RD_WINSEL : out std_logic_vector(8 downto 0) := (others => '0');
64  SAMPLESEL : out std_logic_vector(4 downto 0) := (others => '0');
65  SAMPLESEL_ANY : out std_logic_vector(4 downto 0) := (others => '0');
66 
67 
68  -- wires to HitDataSerializer
69  rx_features_ack : in std_logic := '0';
70  rx_features_ena : out std_logic := '0';
71  last_hit : out std_logic := '0';
72  -- null_hit : out std_logic := '0';
73  peak : out std_logic_vector(11 downto 0) := (others => '0');
74  le_time : out std_logic_vector(13 downto 0) := (others => '0');
75  daq_chan : out std_logic_vector(6 downto 0) := (others => '0');
76 
77  -- SCROD config registers
78  ramp_length : in std_logic_vector(11 downto 6);
79  -- force_test_pattern : in std_logic := '0';
80  t_samp_addr_settle : in std_logic_vector(3 downto 0) := "0110";-- 6
81  t_setup_ss_any : in std_logic_vector(3 downto 0) := "0110";-- 6
82  t_strobe_settle : in std_logic_vector(3 downto 0) := "0100";-- 4
83  t_sr_clk_high : in std_logic_vector(3 downto 0) := "0010";-- 2
84  t_sr_clk_low : in std_logic_vector(3 downto 0) := "0010";-- 2
85  t_sr_clk_strobe : in std_logic_vector(3 downto 0) := "0110";-- 6
86  N_readout_samples : in std_logic_vector(7 downto 0);
87  LE_time_thresh : in std_logic_vector(11 downto 0) := "110100010110"; -- 3350
88 
89  -- status registers
90  debug_we : out std_logic := '0';
91  debug_wave : out std_logic_vector(11 downto 0) := (others => '0');
92  DigStoreProcBusy : out std_logic := '0';
93  DigNShiftBusy : out std_logic := '0';
94  DigBusy : out std_logic := '0';
95  ShiftOutWinBusy : out std_logic := '0';
96  ShiftOutSampBusy : out std_logic := '0';
97  FeatExtBusy : out std_logic := '0';
98  PedFetchQueueBusy : out std_logic := '0';
99 
100  -- Ped calc mode
101  prime_fifos : in std_logic := '0';
102  summing_ena : in std_logic := '0';
103  avg_peds_ena : in std_logic := '0';
104  avg_peds_busy : out std_logic := '0';
105  wr_peds2sram_ena : out std_logic := '0';
106  wr_peds2sram_ack : in std_logic := '0';
107  even_ped : out std_logic_vector(11 downto 0) := (others => '0');
108  odd_ped : out std_logic_vector(11 downto 0) := (others => '0');
109  sram_asic_addr : out std_logic_vector(2 downto 0) := (others => '0');
110  sram_chan_addr : out std_logic_vector(3 downto 0) := (others => '0');
111  sram_samp_addr : out std_logic_vector(4 downto 1) := (others => '0');
112  -- avg_peds_debug : out std_logic_vector(2 downto 0) := "000";
113  fe_dbg : out std_logic_vector(1 downto 0) := "00";
114 
115 
116  -- signals for measuring single-photon spectra
117  -- SPS_hist_rd_ena : in std_logic := '0';
118  sps_reset : in std_logic := '0';
119  SPS_hist_rd_addr : in std_logic_vector(9 downto 0) := (others => '0');
120  SPS_hist_rd_data : out std_logic_vector(15 downto 0) := (others => '0')
121  );
122 end SingleBusProcessing;
123 
124 
125 architecture Behavioral of SingleBusProcessing is
126 
127 -- SYNCHRONOUS SIGNALS BY PROCESS WHICH DRIVES THEM
128 
129  -- SC_buffering:
130  signal all_fifos_empty : std_logic_vector(SLOW_CTRL_BUFF downto 0);
131 
132  -- fifo_rst_fan5:
133  signal fifo_rst_r1 : std_logic_vector(4 downto 0) := (others=>'0');
134 
135  -- fifo_rst_fan3:
136  signal fifo_rst_r2 : std_logic_vector(14 downto 0) := (others=>'0');
137 
138  -- rst_buff:
139  signal proc_reset : std_logic := '0';
140 
141  -- ped_fifo_ch_mux:
142  signal ped_fifo_wr_ena_q1 : std_logic_vector(14 downto 0) := (others=>'0');
143  signal ped_fifo_wr_ena_q2 : std_logic_vector(14 downto 0) := (others=>'0');
144  signal ped_fifo_din_q1 : std_logic_vector(11 downto 0) := (others=>'0');
145  signal ped_fifo_din_q2 : std_logic_vector(11 downto 0) := (others=>'0');
146 
147  -- wave_fifo_ch_wr:
148  type wave_fifo_din_t is record wr_ena : std_logic_vector(14 downto 0); din : slv12(14 downto 0); end record;
149  constant WAVE_DIN_BUFF_DEPTH : integer := 3;
150  type buff_wave_fifo_din_t is array (WAVE_DIN_BUFF_DEPTH - 1 downto 0) of wave_fifo_din_t;
151  constant wave_fifo_din_t0 : wave_fifo_din_t := (wr_ena => (others=>'0'), din => (others=>(others=>'0')));
152  signal wave_fifo : buff_wave_fifo_din_t := (others => wave_fifo_din_t0);
153 
154  -- ch_mask_proc:
155  signal new_mask_q1 : slv15(4 downto 0) := (others => "000000000000000");
156 
157  -- fifo_dout_buff:
158  signal fifo_dout_q1 : slv24(14 downto 0) := (others=>(others=>'0'));
159  signal fifos_valid_q1 : std_logic := '0';
160 
161  -- fifo_rd_mux:
162  signal fifo_rd_ena_q1 : std_logic_vector(14 downto 0) := (others=>'0');
163  signal fifos_valid_q2 : std_logic := '0';
164  signal fifo_dout_q2 : std_logic_vector(23 downto 0) := (others=>'0');
165 
166  -- dsp_ena_buff:
167  signal dig_store_proc_ena : std_logic_vector(1 downto 0) := (others => '0');
168 
169  -- dsp_FSM:
170  type SingleBusProcessing_machine is (IDLE, WAIT_DIG_N_SHIFT);
171  signal single_bus_state : SingleBusProcessing_machine := IDLE;
172  signal digNshift_ena : std_logic := '0';
173  signal digNshift_done : std_logic := '0';
174  signal thr_chk_ena : std_logic := '0';
175  signal ped_queue_ena : std_logic := '0';
176 
177 -- ASYNCHRONOUSLY DRIVEN SIGNALS
178  signal proc_ena : std_logic;
179  signal tb5arr : std_logic_vector(4 downto 0);
180 
181 -- SIGNALS DRIVEN BY INSTANTIATED ENTITIES
182 
183  -- TrigBit2Mask_i:
184  signal chan_mask : slv15(4 downto 0) := (others => "000000000000000");
185 
186  -- DigitizeAndShiftOutData_i:
187  signal digNshift_busy : std_logic := '0';
188  signal main_samp_in_0 : slv12(14 downto 0) := (others=>"000000000000"); -- to threshold check
189  signal samples_valid : std_logic := '0';
190  signal wave_fifo_wr_asic_q0 : std_logic_vector(4 downto 0) := "00001"; -- DigitizeAndShiftOutData to ThresholdCheck
191 
192  -- ThresholdCheck_i:
193  signal thr_chk_busy : std_logic := '0';
194  signal wave_fifo_wr_asic_q1 : std_logic_vector(4 downto 0) := "00001"; -- ThresholdCheck to WaveAndPedStaging
195  signal new_mask_q0 : slv15(4 downto 0) := (others => "000000000000000");
196 
197  -- WaveAndPedStaging_i:
198  signal fifo_dout_q0 : slv24(14 downto 0) := (others=>(others=>'0'));
199  signal fifos_valid_q0 : std_logic_vector(14 downto 0) := (others => '0');
200  signal fifos_empty : std_logic_vector(14 downto 0) := (others=>'0');
201 
202  -- ProcWaveform_i:
203  signal fifo_rst : std_logic := '0';
204  signal fifo_asic_sel : std_logic_vector(4 downto 0) := "00001";
205  signal fifo_chan_sel : std_logic_vector(3 downto 0) := (others=>'0');
206  signal fifo_rd_ena_q0 : std_logic := '0';
207 
208  -- PedFetchQueue_i:
209  signal ped_queue_busy : std_logic := '0';
210 
211 
212  attribute keep : string;
213  attribute keep of fifo_rst : signal is "true";
214  attribute keep of all_fifos_empty : signal is "true";
215 
216 begin
217 
218 --------------------- ASYNCHRONOUS LOGIC ---------------------------------------------
219 
220  proc_ena <= digNshift_done and not ped_queue_busy;
221  ped_win_samp_start <= first_dig_win & "00000"; --#TODO change to first_dig_win_samp in calc ROI
222  PedFetchQueueBusy <= ped_queue_busy;
223  DigNShiftBusy <= digNshift_busy;
224  tb5arr <= trig_bits(4)(4) & trig_bits(3)(4) & trig_bits(2)(4) & trig_bits(1)(4) & trig_bits(0)(4);
225 
226 --------------------- SYNCHRONOUS LOGIC ---------------------------------------------
227 
228  SC_buffering: process(clk, fifos_empty, all_fifos_empty)
229  begin
230  if rising_edge(clk) then
231  all_fifos_empty(0) <= and_reduce(fifos_empty);
232  all_fifos_empty(all_fifos_empty'left downto 1) <= all_fifos_empty(all_fifos_empty'left-1 downto 0);
233  end if;
234  end process;
235 
236  fifo_rst_fan5: process(clk, fifo_rst)
237  begin
238  if rising_edge(clk) then
239  for i in 0 to 4 loop
240  fifo_rst_r1(i) <= fifo_rst;
241  end loop;
242  end if;
243  end process;
244 
245  fifo_rst_fan3: process(clk, fifo_rst_r1)
246  begin
247  if rising_edge(clk) then
248  for i in 0 to 4 loop
249  for j in 0 to 2 loop
250  fifo_rst_r2(3*i + j) <= fifo_rst_r1(i);
251  end loop;
252  end loop;
253  end if;
254  end process;
255 
256  rst_buff: process(clk, rst)
257  begin
258  if rising_edge(clk) then
259  proc_reset <= rst;
260  end if;
261  end process;
262 
263  ped_fifo_ch_mux: process(clk, ped_fifo_wr_ena, ped_fifo_wr_chan, ped_fifo_din)
264  begin
265  if rising_edge(clk) then
266  ped_fifo_wr_ena_q1 <= (others => '0');
267  ped_fifo_wr_ena_q1(to_integer(unsigned(ped_fifo_wr_chan))) <= ped_fifo_wr_ena;
268  ped_fifo_wr_ena_q2 <= ped_fifo_wr_ena_q1;
269  ped_fifo_din_q1 <= ped_fifo_din;
270  ped_fifo_din_q2 <= ped_fifo_din_q1;
271  end if;
272  end process ped_fifo_ch_mux;
273 
274  wave_fifo_ch_wr: process(clk, wave_fifo)
275  begin
276  if rising_edge(clk) then
277  wave_fifo(wave_fifo'left downto 1) <= wave_fifo(wave_fifo'left - 1 downto 0);
278  end if;
279  end process wave_fifo_ch_wr;
280 
281  -- ch_mask_proc: process(clk, new_mask_q0, use_ftsw_trig, chan_mask)
282  -- begin
283  -- if rising_edge(clk) then
284  -- if use_ftsw_trig = '1' then
285  -- new_mask_q1 <= new_mask_q0;
286  -- else
287  -- new_mask_q1 <= chan_mask;
288  -- end if;
289  -- end if;
290  -- end process;
291 
292  ch_mask_proc: process(clk, new_mask_q0, disambig_tb5, chan_mask, tb5arr)
293  begin
294  if rising_edge(clk) then
295  if disambig_tb5 = '1' then
296  for i in 0 to 4 loop
297  if tb5arr(i) = '1' then
298  new_mask_q1(i) <= new_mask_q0(i);
299  else
300  new_mask_q1(i) <= chan_mask(i);
301  end if;
302  end loop;
303  else
304  new_mask_q1 <= chan_mask;
305  end if;
306  end if;
307  end process;
308 
309  fifo_dout_buff: process(clk, fifo_dout_q0, fifos_valid_q0)
310  begin
311  if rising_edge(clk) then
312  fifo_dout_q1 <= fifo_dout_q0;
313  fifos_valid_q1 <= or_reduce(fifos_valid_q0);
314  end if;
315  end process;
316 
317  fifo_rd_mux : process(clk, fifo_chan_sel, fifo_dout_q1, fifos_valid_q1)
318  begin
319  if rising_edge(clk) then
320  fifo_rd_ena_q1 <= (others => '0');
321  fifos_valid_q2 <= fifos_valid_q1;
322  case fifo_chan_sel is
323  when "0000" =>
324  fifo_rd_ena_q1(0) <= fifo_rd_ena_q0;
325  fifo_dout_q2 <= fifo_dout_q1(0);
326  when "0001" =>
327  fifo_rd_ena_q1(1) <= fifo_rd_ena_q0;
328  fifo_dout_q2 <= fifo_dout_q1(1);
329  when "0010" =>
330  fifo_rd_ena_q1(2) <= fifo_rd_ena_q0;
331  fifo_dout_q2 <= fifo_dout_q1(2);
332  when "0011" =>
333  fifo_rd_ena_q1(3) <= fifo_rd_ena_q0;
334  fifo_dout_q2 <= fifo_dout_q1(3);
335  when "0100" =>
336  fifo_rd_ena_q1(4) <= fifo_rd_ena_q0;
337  fifo_dout_q2 <= fifo_dout_q1(4);
338  when "0101" =>
339  fifo_rd_ena_q1(5) <= fifo_rd_ena_q0;
340  fifo_dout_q2 <= fifo_dout_q1(5);
341  when "0110" =>
342  fifo_rd_ena_q1(6) <= fifo_rd_ena_q0;
343  fifo_dout_q2 <= fifo_dout_q1(6);
344  when "0111" =>
345  fifo_rd_ena_q1(7) <= fifo_rd_ena_q0;
346  fifo_dout_q2 <= fifo_dout_q1(7);
347  when "1000" =>
348  fifo_rd_ena_q1(8) <= fifo_rd_ena_q0;
349  fifo_dout_q2 <= fifo_dout_q1(8);
350  when "1001" =>
351  fifo_rd_ena_q1(9) <= fifo_rd_ena_q0;
352  fifo_dout_q2 <= fifo_dout_q1(9);
353  when "1010" =>
354  fifo_rd_ena_q1(10) <= fifo_rd_ena_q0;
355  fifo_dout_q2 <= fifo_dout_q1(10);
356  when "1011" =>
357  fifo_rd_ena_q1(11) <= fifo_rd_ena_q0;
358  fifo_dout_q2 <= fifo_dout_q1(11);
359  when "1100" =>
360  fifo_rd_ena_q1(12) <= fifo_rd_ena_q0;
361  fifo_dout_q2 <= fifo_dout_q1(12);
362  when "1101" =>
363  fifo_rd_ena_q1(13) <= fifo_rd_ena_q0;
364  fifo_dout_q2 <= fifo_dout_q1(13);
365  when "1110" =>
366  fifo_rd_ena_q1(14) <= fifo_rd_ena_q0;
367  fifo_dout_q2 <= fifo_dout_q1(14);
368  when Others =>
369  fifos_valid_q2 <= '0';
370  end case;
371  end if;
372  end process fifo_rd_mux;
373 
374  --detect start rising edge
375  dsp_ena_buff: process (clk, ena, dig_store_proc_ena)
376  begin
377  if rising_edge(clk) then
378  dig_store_proc_ena <= dig_store_proc_ena(0) & ena;
379  end if;
380  end process;
381 
382  -- Digitize_Store_And_Process_Event
383  dsp_FSM: process(clk, dig_store_proc_ena, asic_mask,
384  digNshift_ena, digNshift_busy)
385  begin
386  if rising_edge(clk) then
387  if rst = '1' then
388  single_bus_state <= IDLE;
389  DigStoreProcBusy <= '0';
390  digNshift_ena <= '0';
391  thr_chk_ena <= '0';
392  ped_queue_ena <= '0';
393  else
394 
395  Case single_bus_state is
396 
397  When IDLE =>
398  digNshift_ena <= '0';
399  ped_queue_ena <= '0';
400  if dig_store_proc_ena = "01" and or_reduce(asic_mask) = '1' then
401  digNshift_done <= '0';
402  DigStoreProcBusy <= '1';
403  ped_queue_ena <= (ped_sub_ena or stream_peds) and not measure_peds;
404  single_bus_state <= WAIT_DIG_N_SHIFT;
405  thr_chk_ena <= '1';
406  digNshift_ena <= '1';
407  else
408  DigStoreProcBusy <= '0';
409  single_bus_state <= IDLE;
410  end if;
411 
412 
413  When WAIT_DIG_N_SHIFT =>
414  digNshift_ena <= '0';
415  thr_chk_ena <= '0';
416  ped_queue_ena <= '0';
417  if digNshift_ena = '1' or digNshift_busy = '1' then
418  single_bus_state <= WAIT_DIG_N_SHIFT;
419  else
420  digNshift_done <= '1'; -- wired to proc_ena
421  single_bus_state <= IDLE;
422  end if;
423 
424  -- When OTHERS =>
425  -- single_bus_state <= IDLE;
426 
427  end case;
428  end if;
429  end if;
430  end process;
431 
432 
433 ---------------------BEGIN MODULES ---------------------------------------------
434  TrigBit2Mask_i: for i in 0 to 4 generate
435  U0_i : entity work.TrigBit2Mask
436  port map (
437  clk => clk,
438  bits => trig_bits(i),-- input(i) = 5bit "trigger bits" for ASIC i
439  ch_mask => chan_mask(i)
440  );
441  end generate;
442 
443  DigitizeAndShiftOutData_i: entity work.DigitizeAndShiftOutData
444  port map (
445  clk => clk,
446  rst => proc_reset,
447  ena => digNshift_ena,
448  busy => digNshift_busy,
449 
450  -- event information (state machine input parameters)
451  win_samp_start_asic => win_samp_start,
452  asic_mask => asic_mask,
453  first_dig_win => first_dig_win,
454  last_dig_win => last_dig_win,
455 
456  -- wires to ThresholdCheck
457  sample_data => main_samp_in_0,
458  samples_valid => samples_valid,
459  current_asic => wave_fifo_wr_asic_q0,
460 
461  -- control registers
462  ramp_length => ramp_length,
463  -- force_test_pattern => force_test_pattern,
464  t_samp_addr_settle => t_samp_addr_settle,
465  t_setup_ss_any => t_setup_ss_any,
466  t_strobe_settle => t_strobe_settle,
467  t_sr_clk_high => t_sr_clk_high,
468  t_sr_clk_low => t_sr_clk_low,
469  t_sr_clk_strobe => t_sr_clk_strobe,
470  N_readout_samples => N_readout_samples,
471 
472  -- status registers
473  DigBusy => DigBusy,
474  ShiftOutWinBusy => ShiftOutWinBusy,
475  ShiftOutSampBusy => ShiftOutSampBusy,
476 
477  -- pins to TargetX
478  ---- digitization control
479  BUS_RD_ENA => BUS_RD_ENA,
480  BUS_CLR => BUS_CLR,
481  BUS_RAMP => BUS_RAMP,
482  BUS_RD_WINSEL => BUS_RD_WINSEL,
483 
484  ---- shift register data and control
485  BUS_DO => BUS_DO,
486  SR_CLR => SR_CLR,
487  SR_CLK => SR_CLK,
488  SR_SEL => SR_SEL,
489  SAMPLESEL => SAMPLESEL,
490  SAMPLESEL_ANY => SAMPLESEL_ANY
491  );
492 
493  ThresholdCheck_i : entity work.ThresholdCheck
494  -- generic map (
495  -- tb5_disambig_thr_g => tb5_disambig_thr_g,
496  -- PED_AVG_g => PED_AVG_g
497  -- )
498  port map (
499  clk => clk,
500  rst => proc_reset,
501  ena => thr_chk_ena,
502  busy => thr_chk_busy,
503 
504  -- wires from ShiftOutSample
505  sample_data => main_samp_in_0,
506  samples_valid => samples_valid,
507  digNshift_done => digNshift_done,
508 
509  -- input parameters
510  chan_mask => chan_mask,
511  asic => wave_fifo_wr_asic_q0,
512 
513  -- wires to WaveAndPedStaging
514  wave_fifo_wr_ena => wave_fifo(wave_fifo'right).wr_ena,
515  wave_fifo_din => wave_fifo(wave_fifo'right).din,
516  wave_fifo_wr_asic => wave_fifo_wr_asic_q1,
517 
518  -- threshold results for downstream processing
519  new_mask => new_mask_q0
520  );
521 
522  WaveAndPedStaging_i : for i in 0 to 14 generate
523  WaveAndPedStaging_ii : entity work.WaveAndPedStaging
524  port map (
525  clk => clk,
526  reset => fifo_rst_r2(i),
527  prime_fifos => prime_fifos,
528  summing_ena => summing_ena,
529 
530  wave_fifo_wr_asic => wave_fifo_wr_asic_q1,
531  wave_fifo_wr_ena => wave_fifo(wave_fifo'left).wr_ena(i),
532  main_samp_in => wave_fifo(wave_fifo'left).din(i),
533  ped_fifo_wr_asic => ped_fifo_wr_asic,
534  ped_fifo_wr_ena => ped_fifo_wr_ena_q2(i),
535  ped_fifo_din => ped_fifo_din_q2,
536  fifo_rd_asic => fifo_asic_sel,
537  fifo_rd_ena => fifo_rd_ena_q1(i),
538  fifo_dout => fifo_dout_q0(i),
539  fifo_drdy => fifos_valid_q0(i),
540  fifos_empty => fifos_empty(i)
541  );
542  end generate;
543 
544  ProcWaveform_i : entity work.ProcWaveform
545  generic map (
546  baseline_g => baseline_g,
547  N_BITS_AVG_g => N_BITS_AVG_g
548  )
549  port map (
550  clk => clk,
551  rst => proc_reset,
552  ena => proc_ena,
553 
554  -- control registers
555  ped_sub_ena => ped_sub_ena,
556  -- use_ftsw_trig => use_ftsw_trig,
557  -- use_loop_trig => use_loop_trig,
558  measure_peds => measure_peds,
559  stream_peds => stream_peds,
560  N_readout_samples => N_readout_samples,
561  LE_time_thresh => LE_time_thresh,
562 
563  -- status registers
564  busy => FeatExtBusy,
565  debug_we => debug_we,
566  debug_wave => debug_wave,
567 
568  -- event info
569  win_samp_start => win_samp_start,
570  ch_mask => new_mask_q1,
571 
572  -- fifo access
573  fifo_rst => fifo_rst,
574  fifo_asic_sel => fifo_asic_sel,
575  fifo_chan_sel => fifo_chan_sel,
576  fifo_rd_ena => fifo_rd_ena_q0,
577  fifo_dout => fifo_dout_q2,
578  fifo_drdy => fifos_valid_q2,
579  fifos_empty => all_fifos_empty(all_fifos_empty'left),
580 
581  -- wires to HitDataSerializer
582  rx_features_ack => rx_features_ack,
583  rx_features_ena => rx_features_ena,
584  last_hit => last_hit,
585  -- null_hit => null_hit,
586  peak => peak,
587  le_time => le_time,
588  daq_chan => daq_chan,
589 
590  -- wires needed for pedestal measurement
591  avg_peds_ena => avg_peds_ena,
592  avg_peds_busy => avg_peds_busy,
593  wr_peds2sram_ena => wr_peds2sram_ena,
594  wr_peds2sram_ack => wr_peds2sram_ack,
595  even_ped => even_ped,
596  odd_ped => odd_ped,
597  sram_asic_addr => sram_asic_addr,
598  sram_chan_addr => sram_chan_addr,
599  sram_samp_addr => sram_samp_addr,
600  fe_dbg => fe_dbg,
601  sps_reset => sps_reset,
602  SPS_hist_rd_addr => SPS_hist_rd_addr,
603  SPS_hist_rd_data => SPS_hist_rd_data
604  );
605 
606  PedFetchQueue_i : entity work.PedFetchQueue
607  port map (
608  clk => clk,
609  rst => proc_reset,
610  ena => ped_queue_ena,
611  busy => ped_queue_busy,
612 
613  -- event info
614  ch_mask => chan_mask,
615  new_mask => new_mask_q1,
616  thr_chk_busy => thr_chk_busy,
617 
618  -- wires to PedestalFetcher
619  fetch_ena => ped_fetch_ena,
620  fetch_ack => ped_fetch_ack,
621  asic_addr => ped_fetch_asic_no,
622  chan_addr => ped_fetch_chan
623  );
624 
625 end Behavioral;