10 use IEEE.STD_LOGIC_1164.
all;
13 use ipbus_lib.ipbus.
all;
15 library infrastructure_lib;
21 clk_320 : in std_logic;
22 rst_320 : in std_logic;
23 rst_err_cntrs : in std_logic;
24 rst_status_cntrs : in std_logic;
26 tob_fifo_error_A_bus : in std_logic_vector(3 downto 0);
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);
29 merged_fifo_error_B_bus : in std_logic_vector(1 downto 0);
30 raw_fifo_error_bus : in std_logic_vector(3 downto 0);
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);
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);
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);
55 mux_a_pkt_bus : in std_logic_vector(5 downto 0);
56 mux_b_pkt_bus : in std_logic_vector(5 downto 0);
58 tob_fifo_err_cnt_A_bus_out : out mgt_data_array(3 downto 0);
59 tob_fifo_err_cnt_B_bus_out : out mgt_data_array(3 downto 0);
60 merged_fifo_err_cnt_A_bus_out : out mgt_data_array(1 downto 0);
61 merged_fifo_err_cnt_B_bus_out : out mgt_data_array(1 downto 0);
62 raw_fifo_err_cnt_out : out mgt_data_array(3 downto 0);
64 tob_mgt_packet_received_cnt_bus_out : out mgt_data_array(3 downto 0);
65 tob_mgt_safe_mode_cnt_bus_out : out mgt_data_array(3 downto 0);
66 tob_mgt_packet_err_cnt_bus_out : out mgt_data_array(3 downto 0);
67 tob_mgt_length_err_cnt_bus_out : out mgt_data_array(3 downto 0);
68 tob_mgt_bcn_err_cnt_bus_out : out mgt_data_array(3 downto 0);
70 raw_mgt_packet_received_cnt_bus_out : out mgt_data_array(3 downto 0);
71 raw_mgt_safe_mode_cnt_bus_out : out mgt_data_array(3 downto 0);
72 raw_mgt_packet_err_cnt_bus_out : out mgt_data_array(3 downto 0);
73 raw_mgt_length_err_cnt_bus_out : out mgt_data_array(3 downto 0);
75 TOB_packet_merged_cnt_A_bus_out : out mgt_data_array(3 downto 0);
76 TOB_packet_missing_cnt_A_bus_out : out mgt_data_array(3 downto 0);
77 debug_packet_created_cnt_A_bus_out : out mgt_data_array(3 downto 0);
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);
80 TOB_packet_missing_cnt_B_bus_out : out mgt_data_array(3 downto 0);
81 debug_packet_created_cnt_B_bus_out : out mgt_data_array(3 downto 0);
82 L1A_cnt_merger_B : out std_logic_vector(31 downto 0);
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)
93 signal error_counter_rst_i : std_logic;
94 signal status_counter_rst_i : std_logic;
97 error_counter_rst_i <= rst_320 OR rst_err_cntrs;
98 status_counter_rst_i <= rst_320 OR rst_status_cntrs;
100 L1A_cnt_merger_A_block :
entity infrastructure_lib.
cntr_generic
101 generic map (width =>
32, WRAPAROUND => False
)
103 CE => L1A_seen_bus
(0),
105 RST => error_counter_rst_i,
106 Q => L1A_cnt_merger_A
109 L1A_cnt_merger_B_block :
entity infrastructure_lib.
cntr_generic
110 generic map (width =>
32, WRAPAROUND => False
)
112 CE => L1A_seen_bus
(1),
114 RST => error_counter_rst_i,
115 Q => L1A_cnt_merger_B
118 GENERATE_1 : for i in 0 to 3 generate
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
)
123 CE => tob_fifo_error_A_bus
(i
),
125 RST => error_counter_rst_i,
126 Q => tob_fifo_err_cnt_A_bus_out
(i
)
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
)
132 CE => tob_fifo_error_B_bus
(i
),
134 RST => error_counter_rst_i,
135 Q => tob_fifo_err_cnt_B_bus_out
(i
)
138 U4_raw_fifo_error :
entity infrastructure_lib.
cntr_generic --
generate for 4 raw_fifo_error
139 generic map (width =>
32, WRAPAROUND => False
)
141 CE => raw_fifo_error_bus
(i
),
143 RST => error_counter_rst_i,
144 Q => raw_fifo_err_cnt_out
(i
)
147 end generate GENERATE_1;
149 GENERATE_2 : for i in 0 to 1 generate
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
)
154 CE => merged_fifo_error_A_bus
(i
),
156 RST => error_counter_rst_i,
157 Q => merged_fifo_err_cnt_A_bus_out
(i
)
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
)
163 CE => merged_fifo_error_B_bus
(i
),
165 RST => error_counter_rst_i,
166 Q => merged_fifo_err_cnt_B_bus_out
(i
)
169 end generate GENERATE_2;
171 GENERATE_3 : for i in 0 to 3 generate
173 U2_TOB_packet_merged_A :
entity infrastructure_lib.
cntr_generic --
generate for packet generation
174 generic map (width =>
32, WRAPAROUND => False
)
176 CE => TOB_packet_merged_A_bus
(i
),
178 RST => status_counter_rst_i,
179 Q => TOB_packet_merged_cnt_A_bus_out
(i
)
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
)
185 CE => TOB_packet_missing_A_bus
(i
),
187 RST => status_counter_rst_i,
188 Q => TOB_packet_missing_cnt_A_bus_out
(i
)
191 U4_debug_packet_created_A :
entity infrastructure_lib.
cntr_generic --
generate for 4 raw_fifo_error
192 generic map (width =>
32, WRAPAROUND => False
)
194 CE => debug_packet_created_A_bus
(i
),
196 RST => status_counter_rst_i,
197 Q => debug_packet_created_cnt_A_bus_out
(i
)
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
)
203 CE => TOB_packet_merged_B_bus
(i
),
205 RST => status_counter_rst_i,
206 Q => TOB_packet_merged_cnt_B_bus_out
(i
)
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
)
212 CE => TOB_packet_missing_B_bus
(i
),
214 RST => status_counter_rst_i,
215 Q => TOB_packet_missing_cnt_B_bus_out
(i
)
218 U7_debug_packet_created_B :
entity infrastructure_lib.
cntr_generic --
generate for 4 raw_fifo_error
219 generic map (width =>
32, WRAPAROUND => False
)
221 CE => debug_packet_created_B_bus
(i
),
223 RST => status_counter_rst_i,
224 Q => debug_packet_created_cnt_B_bus_out
(i
)
227 end generate GENERATE_3;
229 GENERATE_4 : for i in 0 to 3 generate
231 tob_mgt_packet_received :
entity infrastructure_lib.
cntr_generic
232 generic map (width =>
32, WRAPAROUND => False
)
234 CE => tob_mgt_packet_received_bus
(i
),
236 RST => status_counter_rst_i,
237 Q => tob_mgt_packet_received_cnt_bus_out
(i
));
239 tob_mgt_safe_mode :
entity infrastructure_lib.
cntr_generic
240 generic map (width =>
32, WRAPAROUND => False
)
242 CE => tob_mgt_safe_mode_bus
(i
),
244 RST => status_counter_rst_i,
245 Q => tob_mgt_safe_mode_cnt_bus_out
(i
));
247 tob_mgt_packet_err :
entity infrastructure_lib.
cntr_generic
248 generic map (width =>
32, WRAPAROUND => False
)
250 CE => tob_mgt_packet_err_bus
(i
),
252 RST => status_counter_rst_i,
253 Q => tob_mgt_packet_err_cnt_bus_out
(i
));
255 tob_mgt_length_err :
entity infrastructure_lib.
cntr_generic
256 generic map (width =>
32, WRAPAROUND => False
)
258 CE => tob_mgt_length_err_bus
(i
),
260 RST => status_counter_rst_i,
261 Q => tob_mgt_length_err_cnt_bus_out
(i
));
263 tob_mgt_bcn_err :
entity infrastructure_lib.
cntr_generic
264 generic map (width =>
32, WRAPAROUND => False
)
266 CE => tob_mgt_bcn_err_bus
(i
),
268 RST => status_counter_rst_i,
269 Q => tob_mgt_bcn_err_cnt_bus_out
(i
));
271 raw_mgt_packet_received :
entity infrastructure_lib.
cntr_generic
272 generic map (width =>
32, WRAPAROUND => False
)
274 CE => raw_mgt_packet_received_bus
(i
),
276 RST => status_counter_rst_i,
277 Q => raw_mgt_packet_received_cnt_bus_out
(i
));
279 raw_mgt_safe_mode :
entity infrastructure_lib.
cntr_generic
280 generic map (width =>
32, WRAPAROUND => False
)
282 CE => raw_mgt_safe_mode_bus
(i
),
284 RST => status_counter_rst_i,
285 Q => raw_mgt_safe_mode_cnt_bus_out
(i
));
287 raw_mgt_packet_err :
entity infrastructure_lib.
cntr_generic
288 generic map (width =>
32, WRAPAROUND => False
)
290 CE => raw_mgt_packet_err_bus
(i
),
292 RST => status_counter_rst_i,
293 Q => raw_mgt_packet_err_cnt_bus_out
(i
));
295 raw_mgt_length_err :
entity infrastructure_lib.
cntr_generic
296 generic map (width =>
32, WRAPAROUND => False
)
298 CE => raw_mgt_length_err_bus
(i
),
300 RST => status_counter_rst_i,
301 Q => raw_mgt_length_err_cnt_bus_out
(i
));
303 end generate GENERATE_4;
305 GENERATE_5 : for i in 0 to 5 generate
308 generic map (width =>
32, WRAPAROUND => False
)
310 CE => mux_a_pkt_bus
(i
),
312 RST => status_counter_rst_i,
313 Q => mux_a_pkt_cnt_bus_out
(i
));
316 generic map (width =>
32, WRAPAROUND => False
)
318 CE => mux_b_pkt_bus
(i
),
320 RST => status_counter_rst_i,
321 Q => mux_b_pkt_cnt_bus_out
(i
));
323 end generate GENERATE_5;
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.