eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
rdout_err_cnt.vhd
Go to the documentation of this file.
1 
8 
9 library IEEE;
10 use IEEE.STD_LOGIC_1164.all;
11 
12 library ipbus_lib;
13 use ipbus_lib.ipbus.all;
14 
15 library infrastructure_lib;
16 use infrastructure_lib.packet_mux_type.all;
17 
19 entity rdout_err_cnt is
20  port (
21  clk_320 : in std_logic;
22  rst_320 : in std_logic;
23  rst_err_cntrs : in std_logic; -- reset all memory error counters
24  rst_status_cntrs : in std_logic; -- reset all packet status counters
25 
26  tob_fifo_error_A_bus : in std_logic_vector(3 downto 0); -- status to be read by IPBus (if rd & wr pointers crash) to be counted.
27  tob_fifo_error_B_bus : in std_logic_vector(3 downto 0);
28  merged_fifo_error_A_bus : in std_logic_vector(1 downto 0); -- merged TOB FIFO (0), debug FIFO (1) count errors
29  merged_fifo_error_B_bus : in std_logic_vector(1 downto 0); -- merged TOB FIFO (0), debug FIFO (1)
30  raw_fifo_error_bus : in std_logic_vector(3 downto 0);
31 
32 -- TOB MGT status
33  tob_mgt_packet_received_bus : in std_logic_vector(3 downto 0);
34  tob_mgt_safe_mode_bus : in std_logic_vector(3 downto 0);
35  tob_mgt_packet_err_bus : in std_logic_vector(3 downto 0);
36  tob_mgt_length_err_bus : in std_logic_vector(3 downto 0);
37  tob_mgt_bcn_err_bus : in std_logic_vector(3 downto 0);
38 
39 -- Raw MGT status
40  raw_mgt_packet_received_bus : in std_logic_vector(3 downto 0);
41  raw_mgt_safe_mode_bus : in std_logic_vector(3 downto 0);
42  raw_mgt_packet_err_bus : in std_logic_vector(3 downto 0);
43  raw_mgt_length_err_bus : in std_logic_vector(3 downto 0);
44 
45 -- TOB merging counts per Processor FPGA
46  TOB_packet_merged_A_bus : in std_logic_vector(3 downto 0);
47  TOB_packet_missing_A_bus : in std_logic_vector(3 downto 0);
48  debug_packet_created_A_bus : in std_logic_vector(3 downto 0);
49  TOB_packet_merged_B_bus : in std_logic_vector(3 downto 0);
50  TOB_packet_missing_B_bus : in std_logic_vector(3 downto 0);
51  debug_packet_created_B_bus : in std_logic_vector(3 downto 0);
52  L1A_seen_bus : in std_logic_vector(1 downto 0);
53 
54 -- MUX counters
55  mux_a_pkt_bus : in std_logic_vector(5 downto 0);
56  mux_b_pkt_bus : in std_logic_vector(5 downto 0);
57 
58  tob_fifo_err_cnt_A_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
59  tob_fifo_err_cnt_B_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
60  merged_fifo_err_cnt_A_bus_out : out mgt_data_array(1 downto 0); -- 32-bit error counter
61  merged_fifo_err_cnt_B_bus_out : out mgt_data_array(1 downto 0); -- 32-bit error counter
62  raw_fifo_err_cnt_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
63 
64  tob_mgt_packet_received_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
65  tob_mgt_safe_mode_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
66  tob_mgt_packet_err_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
67  tob_mgt_length_err_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
68  tob_mgt_bcn_err_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
69 
70  raw_mgt_packet_received_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
71  raw_mgt_safe_mode_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
72  raw_mgt_packet_err_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
73  raw_mgt_length_err_cnt_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
74 
75  TOB_packet_merged_cnt_A_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
76  TOB_packet_missing_cnt_A_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
77  debug_packet_created_cnt_A_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
78  L1A_cnt_merger_A : out std_logic_vector(31 downto 0);
79  TOB_packet_merged_cnt_B_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
80  TOB_packet_missing_cnt_B_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
81  debug_packet_created_cnt_B_bus_out : out mgt_data_array(3 downto 0); -- 32-bit error counter
82  L1A_cnt_merger_B : out std_logic_vector(31 downto 0);
83 
84  mux_a_pkt_cnt_bus_out : out mgt_data_array(5 downto 0);
85  mux_b_pkt_cnt_bus_out : out mgt_data_array(5 downto 0)
86 
87  );
88 end rdout_err_cnt;
89 
91 architecture Behavioral of rdout_err_cnt is
92 
93  signal error_counter_rst_i : std_logic;
94  signal status_counter_rst_i : std_logic;
95 
96 begin
97  error_counter_rst_i <= rst_320 OR rst_err_cntrs; -- reset all error counters
98  status_counter_rst_i <= rst_320 OR rst_status_cntrs; -- reset all status counters
99 
100 L1A_cnt_merger_A_block : entity infrastructure_lib.cntr_generic
101  generic map (width => 32, WRAPAROUND => False)
102  port map (
103  CE => L1A_seen_bus(0), -- if a valid data, then increment the address
104  CLK => clk_320,
105  RST => error_counter_rst_i,
106  Q => L1A_cnt_merger_A
107  );
108 
109 L1A_cnt_merger_B_block : entity infrastructure_lib.cntr_generic
110  generic map (width => 32, WRAPAROUND => False)
111  port map (
112  CE => L1A_seen_bus(1), -- if a valid data, then increment the address
113  CLK => clk_320,
114  RST => error_counter_rst_i,
115  Q => L1A_cnt_merger_B
116  );
117 
118 GENERATE_1 : for i in 0 to 3 generate -- generate for 4
119 
120  U2_tob_fifo_error_A : entity infrastructure_lib.cntr_generic -- generate for 4 tob_fifo_error_A
121  generic map (width => 32, WRAPAROUND => False)
122  port map (
123  CE => tob_fifo_error_A_bus(i), -- if a valid data, then increment the address
124  CLK => clk_320,
125  RST => error_counter_rst_i,
126  Q => tob_fifo_err_cnt_A_bus_out(i)
127  );
128 
129  U3_tob_fifo_error_B : entity infrastructure_lib.cntr_generic -- generate for 4 tob_fifo_error_B
130  generic map (width => 32, WRAPAROUND => False)
131  port map (
132  CE => tob_fifo_error_B_bus(i), -- if a valid data, then increment the address
133  CLK => clk_320,
134  RST => error_counter_rst_i,
135  Q => tob_fifo_err_cnt_B_bus_out(i)
136  );
137 
138  U4_raw_fifo_error : entity infrastructure_lib.cntr_generic -- generate for 4 raw_fifo_error
139  generic map (width => 32, WRAPAROUND => False)
140  port map (
141  CE => raw_fifo_error_bus(i), -- if a valid data, then increment the address
142  CLK => clk_320,
143  RST => error_counter_rst_i,
144  Q => raw_fifo_err_cnt_out(i)
145  );
146 
147 end generate GENERATE_1;
148 
149 GENERATE_2 : for i in 0 to 1 generate -- generate for 2
150 
151  U5_merged_fifo_error_A : entity infrastructure_lib.cntr_generic -- generate for 2 merged_fifo_error_A
152  generic map (width => 32, WRAPAROUND => False)
153  port map (
154  CE => merged_fifo_error_A_bus(i), -- if a valid data, then increment the address
155  CLK => clk_320,
156  RST => error_counter_rst_i,
157  Q => merged_fifo_err_cnt_A_bus_out(i)
158  );
159 
160  U6_merged_fifo_error_B : entity infrastructure_lib.cntr_generic -- generate for 2 merged_fifo_error_B
161  generic map (width => 32, WRAPAROUND => False)
162  port map (
163  CE => merged_fifo_error_B_bus(i), -- if a valid data, then increment the address
164  CLK => clk_320,
165  RST => error_counter_rst_i,
166  Q => merged_fifo_err_cnt_B_bus_out(i)
167  );
168 
169 end generate GENERATE_2;
170 
171 GENERATE_3 : for i in 0 to 3 generate -- generate for 4
172 
173  U2_TOB_packet_merged_A : entity infrastructure_lib.cntr_generic -- generate for packet generation
174  generic map (width => 32, WRAPAROUND => False)
175  port map (
176  CE => TOB_packet_merged_A_bus(i), -- if a valid data, then increment the address
177  CLK => clk_320,
178  RST => status_counter_rst_i,
179  Q => TOB_packet_merged_cnt_A_bus_out(i)
180  );
181 
182  U3_TOB_packet_missing_A : entity infrastructure_lib.cntr_generic -- generate for 4 tob_fifo_error_B
183  generic map (width => 32, WRAPAROUND => False)
184  port map (
185  CE => TOB_packet_missing_A_bus(i), -- if a valid data, then increment the address
186  CLK => clk_320,
187  RST => status_counter_rst_i,
188  Q => TOB_packet_missing_cnt_A_bus_out(i)
189  );
190 
191  U4_debug_packet_created_A : entity infrastructure_lib.cntr_generic -- generate for 4 raw_fifo_error
192  generic map (width => 32, WRAPAROUND => False)
193  port map (
194  CE => debug_packet_created_A_bus(i), -- if a valid data, then increment the address
195  CLK => clk_320,
196  RST => status_counter_rst_i,
197  Q => debug_packet_created_cnt_A_bus_out(i)
198  );
199 
200  U5_TOB_packet_merged_B : entity infrastructure_lib.cntr_generic -- generate for 4 tob_fifo_error_A
201  generic map (width => 32, WRAPAROUND => False)
202  port map (
203  CE => TOB_packet_merged_B_bus(i), -- if a valid data, then increment the address
204  CLK => clk_320,
205  RST => status_counter_rst_i,
206  Q => TOB_packet_merged_cnt_B_bus_out(i)
207  );
208 
209  U6_TOB_packet_missing_B : entity infrastructure_lib.cntr_generic -- generate for 4 tob_fifo_error_B
210  generic map (width => 32, WRAPAROUND => False)
211  port map (
212  CE => TOB_packet_missing_B_bus(i), -- if a valid data, then increment the address
213  CLK => clk_320,
214  RST => status_counter_rst_i,
215  Q => TOB_packet_missing_cnt_B_bus_out(i)
216  );
217 
218  U7_debug_packet_created_B : entity infrastructure_lib.cntr_generic -- generate for 4 raw_fifo_error
219  generic map (width => 32, WRAPAROUND => False)
220  port map (
221  CE => debug_packet_created_B_bus(i), -- if a valid data, then increment the address
222  CLK => clk_320,
223  RST => status_counter_rst_i,
224  Q => debug_packet_created_cnt_B_bus_out(i)
225  );
226 
227 end generate GENERATE_3;
228 
229 GENERATE_4 : for i in 0 to 3 generate -- generate for 4
230 
231  tob_mgt_packet_received : entity infrastructure_lib.cntr_generic
232  generic map (width => 32, WRAPAROUND => False)
233  port map (
234  CE => tob_mgt_packet_received_bus(i),
235  CLK => clk_320,
236  RST => status_counter_rst_i,
237  Q => tob_mgt_packet_received_cnt_bus_out(i));
238 
239  tob_mgt_safe_mode : entity infrastructure_lib.cntr_generic
240  generic map (width => 32, WRAPAROUND => False)
241  port map (
242  CE => tob_mgt_safe_mode_bus(i),
243  CLK => clk_320,
244  RST => status_counter_rst_i,
245  Q => tob_mgt_safe_mode_cnt_bus_out(i));
246 
247  tob_mgt_packet_err : entity infrastructure_lib.cntr_generic
248  generic map (width => 32, WRAPAROUND => False)
249  port map (
250  CE => tob_mgt_packet_err_bus(i),
251  CLK => clk_320,
252  RST => status_counter_rst_i,
253  Q => tob_mgt_packet_err_cnt_bus_out(i));
254 
255  tob_mgt_length_err : entity infrastructure_lib.cntr_generic
256  generic map (width => 32, WRAPAROUND => False)
257  port map (
258  CE => tob_mgt_length_err_bus(i),
259  CLK => clk_320,
260  RST => status_counter_rst_i,
261  Q => tob_mgt_length_err_cnt_bus_out(i));
262 
263  tob_mgt_bcn_err : entity infrastructure_lib.cntr_generic
264  generic map (width => 32, WRAPAROUND => False)
265  port map (
266  CE => tob_mgt_bcn_err_bus(i),
267  CLK => clk_320,
268  RST => status_counter_rst_i,
269  Q => tob_mgt_bcn_err_cnt_bus_out(i));
270 
271  raw_mgt_packet_received : entity infrastructure_lib.cntr_generic
272  generic map (width => 32, WRAPAROUND => False)
273  port map (
274  CE => raw_mgt_packet_received_bus(i),
275  CLK => clk_320,
276  RST => status_counter_rst_i,
277  Q => raw_mgt_packet_received_cnt_bus_out(i));
278 
279  raw_mgt_safe_mode : entity infrastructure_lib.cntr_generic
280  generic map (width => 32, WRAPAROUND => False)
281  port map (
282  CE => raw_mgt_safe_mode_bus(i),
283  CLK => clk_320,
284  RST => status_counter_rst_i,
285  Q => raw_mgt_safe_mode_cnt_bus_out(i));
286 
287  raw_mgt_packet_err : entity infrastructure_lib.cntr_generic
288  generic map (width => 32, WRAPAROUND => False)
289  port map (
290  CE => raw_mgt_packet_err_bus(i),
291  CLK => clk_320,
292  RST => status_counter_rst_i,
293  Q => raw_mgt_packet_err_cnt_bus_out(i));
294 
295  raw_mgt_length_err : entity infrastructure_lib.cntr_generic
296  generic map (width => 32, WRAPAROUND => False)
297  port map (
298  CE => raw_mgt_length_err_bus(i),
299  CLK => clk_320,
300  RST => status_counter_rst_i,
301  Q => raw_mgt_length_err_cnt_bus_out(i));
302 
303 end generate GENERATE_4;
304 
305 GENERATE_5 : for i in 0 to 5 generate -- generate for 6
306 
307  mux_a_pkt_cnt : entity infrastructure_lib.cntr_generic
308  generic map (width => 32, WRAPAROUND => False)
309  port map (
310  CE => mux_a_pkt_bus(i),
311  CLK => clk_320,
312  RST => status_counter_rst_i,
313  Q => mux_a_pkt_cnt_bus_out(i));
314 
315  mux_b_pkt_cnt : entity infrastructure_lib.cntr_generic
316  generic map (width => 32, WRAPAROUND => False)
317  port map (
318  CE => mux_b_pkt_bus(i),
319  CLK => clk_320,
320  RST => status_counter_rst_i,
321  Q => mux_b_pkt_cnt_bus_out(i));
322 
323 end generate GENERATE_5;
324 
325 end Behavioral;
Generic Counter for process FPGA.
in CLK STD_LOGIC
Clock signal input.
in CE STD_LOGIC
Enable signal input.
out Q STD_LOGIC_VECTOR( width- 1 downto 0)
Counter Output signal.
in RST STD_LOGIC
Reset signal input.
Control FPGA readout counter registers.
Control FPGA readout counter registers.