10 use ieee.std_logic_1164.
all;
11 use ieee.numeric_std.
all;
13 library infrastructure_lib;
19 clk_320 : in std_logic;
20 rst_xoff_cntr : in std_logic;
24 tob_fifo_prog_full_thresh_negate : in std_logic_vector(15 downto 0);
28 raw_fifo_prog_full_thresh_negate : in std_logic_vector(15 downto 0);
32 tob_fifo_XOFF_thresh_negate : in std_logic_vector(15 downto 0);
36 merged_fifo_XOFF_thresh_negate : in std_logic_vector(15 downto 0);
40 raw_fifo_XOFF_thresh_negate : in std_logic_vector(15 downto 0);
44 dbg_fifo_XOFF_thresh_negate : in std_logic_vector(15 downto 0);
48 tob_fifo_fill_level_B_bus : in fifo_status_array(3 downto 0);
51 merged_fifo_fill_level_B_bus: in fifo_status_array(1 downto 0);
55 fifo_bc_count : out std_logic_vector(31 downto 0);
57 tob_busy_cnt_32b_A : out mgt_data_array(3 downto 0);
58 tob_busy_cnt_32b_B : out mgt_data_array(3 downto 0);
59 raw_busy_cnt_32b : out mgt_data_array(3 downto 0);
61 tob_busy_active_cnt_32b_A : out mgt_data_array(3 downto 0);
62 tob_busy_active_cnt_32b_B : out mgt_data_array(3 downto 0);
63 raw_busy_active_cnt_32b : out mgt_data_array(3 downto 0);
65 tob_busy_assert_cnt_32b_A : out mgt_data_array(3 downto 0);
66 tob_busy_assert_cnt_32b_B : out mgt_data_array(3 downto 0);
67 raw_busy_assert_cnt_32b : out mgt_data_array(3 downto 0);
69 tob_xoff_cnt_32b_A : out mgt_data_array(3 downto 0);
70 tob_xoff_cnt_32b_B : out mgt_data_array(3 downto 0);
71 raw_xoff_cnt_32b : out mgt_data_array(3 downto 0);
72 merged_xoff_cnt_32b_A : out mgt_data_array(1 downto 0);
73 merged_xoff_cnt_32b_B : out mgt_data_array(1 downto 0);
75 tob_xoff_active_cnt_32b_A : out mgt_data_array(3 downto 0);
76 tob_xoff_active_cnt_32b_B : out mgt_data_array(3 downto 0);
77 raw_xoff_active_cnt_32b : out mgt_data_array(3 downto 0);
78 merged_xoff_active_cnt_32b_A: out mgt_data_array(1 downto 0);
79 merged_xoff_active_cnt_32b_B: out mgt_data_array(1 downto 0);
81 tob_xoff_assert_cnt_32b_A : out mgt_data_array(3 downto 0);
82 tob_xoff_assert_cnt_32b_B : out mgt_data_array(3 downto 0);
83 raw_xoff_assert_cnt_32b : out mgt_data_array(3 downto 0);
84 merged_xoff_assert_cnt_32b_A: out mgt_data_array(1 downto 0);
85 merged_xoff_assert_cnt_32b_B: out mgt_data_array(1 downto 0);
88 tob_mgt_xoff_bus : out std_logic_vector(3 downto 0);
89 raw_mgt_xoff_bus : out std_logic_vector(3 downto 0);
91 tob_busy_bus : out std_logic_vector(3 downto 0);
92 raw_busy_bus : out std_logic_vector(3 downto 0);
94 Block_A_pause : out std_logic_vector(1 downto 0);
95 Block_B_pause : out std_logic_vector(1 downto 0)
102 signal busy_bus, busy_bus_a, busy_bus_b, busy_count_bus, busy_reset_bus, busy_assert_bus: std_logic_vector(11 downto 0);
103 signal xoff_bus, xoff_bus_a, xoff_bus_b, xoff_count_bus, xoff_reset_bus, xoff_assert_bus: std_logic_vector(15 downto 0);
104 signal fifo_bc_count_35b: std_logic_vector(34 downto 0);
105 signal busy_cnt_35b, busy_active_cnt_35b: cntr_35b_array(11 downto 0);
106 signal xoff_cnt_35b, xoff_active_cnt_35b: cntr_35b_array(15 downto 0);
107 signal busy_assert_cnt_32b: mgt_data_array(11 downto 0);
108 signal xoff_assert_cnt_32b: mgt_data_array(15 downto 0);
109 signal merge_debug_XOFF_thresh_assert, merge_debug_XOFF_thresh_negate: fifo_status_array(1 downto 0);
114 merge_debug_XOFF_thresh_negate <= dbg_fifo_XOFF_thresh_negate & merged_fifo_XOFF_thresh_negate;
116 tob_busy_bus <= busy_bus(3 downto 0) OR busy_bus(7 downto 4);
117 raw_busy_bus <= busy_bus(11 downto 8);
119 tob_mgt_xoff_bus <= xoff_bus(3 downto 0) OR xoff_bus(7 downto 4);
120 raw_mgt_xoff_bus <= xoff_bus(11 downto 8);
121 Block_A_pause <= xoff_bus(13 downto 12);
122 Block_B_pause <= xoff_bus(15 downto 14);
125 generic map (width =>
35, WRAPAROUND => False
)
129 RST => rst_xoff_cntr,
130 Q => fifo_bc_count_35b
133 fifo_bc_count <= fifo_bc_count_35b(34 downto 3);
135 GENERATE_1 : for i in 0 to 3 generate
136 tob_busy_a :
process (clk_320)
138 if rising_edge (clk_320) then
147 tob_busy_b :
process (clk_320)
149 if rising_edge (clk_320) then
151 busy_bus(i+4) <= '1' ;
152 elsif unsigned(tob_fifo_fill_level_B_bus(i)) < unsigned(tob_fifo_prog_full_thresh_negate) then
153 busy_bus(i+4) <= '0' ;
158 raw_busy :
process (clk_320)
160 if rising_edge (clk_320) then
162 busy_bus(i+8) <= '1' ;
164 busy_bus(i+8) <= '0' ;
169 tob_xoff_a :
process (clk_320)
171 if rising_edge (clk_320) then
180 tob_xoff_b :
process (clk_320)
182 if rising_edge (clk_320) then
183 if unsigned(tob_fifo_fill_level_B_bus(i)) >= unsigned(tob_fifo_xoff_thresh_assert) then
184 xoff_bus(i+4) <= '1' ;
185 elsif unsigned(tob_fifo_fill_level_B_bus(i)) < unsigned(tob_fifo_xoff_thresh_negate) then
186 xoff_bus(i+4) <= '0' ;
191 raw_xoff :
process (clk_320)
193 if rising_edge (clk_320) then
195 xoff_bus(i+8) <= '1' ;
197 xoff_bus(i+8) <= '0' ;
203 tob_busy_cnt_32b_A(i) <= busy_cnt_35b(i)(34 downto 3);
204 tob_busy_cnt_32b_B(i) <= busy_cnt_35b(i+4)(34 downto 3);
205 raw_busy_cnt_32b(i) <= busy_cnt_35b(i+8)(34 downto 3);
207 tob_busy_active_cnt_32b_A(i) <= busy_active_cnt_35b(i)(34 downto 3);
208 tob_busy_active_cnt_32b_B(i) <= busy_active_cnt_35b(i+4)(34 downto 3);
209 raw_busy_active_cnt_32b(i) <= busy_active_cnt_35b(i+8)(34 downto 3);
211 tob_busy_assert_cnt_32b_A(i) <= busy_assert_cnt_32b(i);
212 tob_busy_assert_cnt_32b_B(i) <= busy_assert_cnt_32b(i+4);
213 raw_busy_assert_cnt_32b(i) <= busy_assert_cnt_32b(i+8);
215 tob_xoff_cnt_32b_A(i) <= xoff_cnt_35b(i)(34 downto 3);
216 tob_xoff_cnt_32b_B(i) <= xoff_cnt_35b(i+4)(34 downto 3);
217 raw_xoff_cnt_32b(i) <= xoff_cnt_35b(i+8)(34 downto 3);
219 tob_xoff_active_cnt_32b_A(i) <= xoff_active_cnt_35b(i)(34 downto 3);
220 tob_xoff_active_cnt_32b_B(i) <= xoff_active_cnt_35b(i+4)(34 downto 3);
221 raw_xoff_active_cnt_32b(i) <= xoff_active_cnt_35b(i+8)(34 downto 3);
223 tob_xoff_assert_cnt_32b_A(i) <= xoff_assert_cnt_32b(i);
224 tob_xoff_assert_cnt_32b_B(i) <= xoff_assert_cnt_32b(i+4);
225 raw_xoff_assert_cnt_32b(i) <= xoff_assert_cnt_32b(i+8);
226 end generate GENERATE_1;
228 GENERATE_2 : for i in 0 to 1 generate
229 merged_xoff_a :
process (clk_320)
231 if rising_edge (clk_320) then
233 xoff_bus(i+12) <= '1' ;
235 xoff_bus(i+12) <= '0' ;
240 merged_xoff_b :
process (clk_320)
242 if rising_edge (clk_320) then
243 if unsigned(merged_fifo_fill_level_B_bus(i)) > unsigned(merge_debug_XOFF_thresh_assert(i)) then
244 xoff_bus(i+14) <= '1' ;
245 elsif unsigned(merged_fifo_fill_level_B_bus(i)) < unsigned(merge_debug_XOFF_thresh_negate(i)) then
246 xoff_bus(i+14) <= '0' ;
252 merged_xoff_cnt_32b_A(i) <= xoff_cnt_35b(i+12)(34 downto 3);
253 merged_xoff_cnt_32b_B(i) <= xoff_cnt_35b(i+14)(34 downto 3);
255 merged_xoff_active_cnt_32b_A(i) <= xoff_active_cnt_35b(i+12)(34 downto 3);
256 merged_xoff_active_cnt_32b_B(i) <= xoff_active_cnt_35b(i+14)(34 downto 3);
258 merged_xoff_assert_cnt_32b_A(i) <= xoff_assert_cnt_32b(i+12);
259 merged_xoff_assert_cnt_32b_B(i) <= xoff_assert_cnt_32b(i+14);
260 end generate GENERATE_2;
262 busy_xoff_registers:
process(clk_320)
264 if rising_edge(clk_320) then
265 xoff_bus_a <= xoff_bus;
266 xoff_bus_b <= xoff_bus_a;
267 xoff_count_bus <= xoff_bus_b;
268 busy_bus_a <= busy_bus;
269 busy_bus_b <= busy_bus_a;
270 busy_count_bus <= busy_bus_b;
271 if (rst_xoff_cntr = '1') then
272 xoff_reset_bus <= (Others => '1');
273 xoff_assert_bus <= (Others => '0');
274 busy_reset_bus <= (Others => '1');
275 busy_assert_bus <= (Others => '0');
277 xoff_reset_bus <= xoff_bus and not xoff_bus_a;
278 xoff_assert_bus <= xoff_bus and not xoff_bus_a;
279 busy_reset_bus <= busy_bus and not busy_bus_a;
280 busy_assert_bus <= busy_bus and not busy_bus_a;
283 end process busy_xoff_registers;
285 GENERATE_3 : for i in 0 to 11 generate
287 generic map (width =>
35, WRAPAROUND => False
)
289 CE => busy_count_bus
(i
),
291 RST => rst_xoff_cntr,
292 Q => busy_cnt_35b
(i
));
294 busy_active_count :
entity infrastructure_lib.
cntr_generic
295 generic map (width =>
35, WRAPAROUND => False
)
297 CE => busy_count_bus
(i
),
299 RST => busy_reset_bus
(i
),
300 Q => busy_active_cnt_35b
(i
));
302 busy_assert_counter :
entity infrastructure_lib.
cntr_generic
303 generic map (width =>
32, WRAPAROUND => False
)
305 CE => busy_assert_bus
(i
),
307 RST => rst_xoff_cntr,
308 Q => busy_assert_cnt_32b
(i
));
309 end generate GENERATE_3;
311 GENERATE_4 : for i in 0 to 15 generate
313 generic map (width =>
35, WRAPAROUND => False
)
315 CE => xoff_count_bus
(i
),
317 RST => rst_xoff_cntr,
318 Q => xoff_cnt_35b
(i
));
320 xoff_active_count :
entity infrastructure_lib.
cntr_generic
321 generic map (width =>
35, WRAPAROUND => False
)
323 CE => xoff_count_bus
(i
),
325 RST => xoff_reset_bus
(i
),
326 Q => xoff_active_cnt_35b
(i
));
328 xoff_assert_counter :
entity infrastructure_lib.
cntr_generic
329 generic map (width =>
32, WRAPAROUND => False
)
331 CE => xoff_assert_bus
(i
),
333 RST => rst_xoff_cntr,
334 Q => xoff_assert_cnt_32b
(i
));
335 end generate GENERATE_4;
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 Readout FIFO level Monitor.
Control Readout FIFO level Monitor.
in tob_fifo_fill_level_A_bus fifo_status_array( 3 downto 0)
TOB FIFO status block B XOFF & BUSY.
in dbg_fifo_XOFF_thresh_assert std_logic_vector( 15 downto 0)
XOFF debug FIFO partial full flag assert thresholds.
in merged_fifo_XOFF_thresh_assert std_logic_vector( 15 downto 0)
XOFF merged FIFO partial full flag assert thresholds.
in raw_fifo_prog_full_thresh_assert std_logic_vector( 15 downto 0)
BUSY input RAW FIFO partial full flag assert thresholds.
in raw_fifo_fill_level_bus fifo_status_array( 3 downto 0)
Raw FIFO status block XOFF & BUSY.
in tob_fifo_XOFF_thresh_assert std_logic_vector( 15 downto 0)
XOFF TOB FIFO partial full flag thresholds.
in merged_fifo_fill_level_A_bus fifo_status_array( 1 downto 0)
Aurora merged_fifo status bits PAUSE.
in raw_fifo_XOFF_thresh_assert std_logic_vector( 15 downto 0)
XOFF input RAW FIFO partial full flag assert thresholds.
in tob_fifo_prog_full_thresh_assert std_logic_vector( 15 downto 0)
BUSY TOB FIFO partial full flag thresholds.