1 ----------------------------------------------------------------------------------
5 -- Create Date: 14:
07:
47 10/07/2013
7 -- Module Name: TCPIP_if - Behavioral
16 -- Revision 0.
01 -
File Created
17 -- Additional Comments:
19 ----------------------------------------------------------------------------------
21 use IEEE.STD_LOGIC_1164.
ALL;
22 use IEEE.STD_LOGIC_ARITH.
ALL;
23 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
24 use IEEE.std_logic_misc.
all;
25 use IEEE.numeric_std.
all;
28 -- Uncomment the following library declaration if using
29 -- arithmetic functions with or values
30 --use IEEE.NUMERIC_STD.ALL;
32 -- Uncomment the following library declaration if instantiating
33 -- any Xilinx primitives in this code.
35 use UNISIM.VComponents.
all;
37 use UNIMACRO.vcomponents.
all;
40 generic (simulation : := false;
en_KEEPALIVE : := '0');
49 enSFP : IN (3 downto 0);
50 SFP_down : OUT (2 downto 0);
53 evt_data_rdy : in (2 downto 0);
54 EventData_in : in array3X67;
55 EventData_we : in (2 downto 0);
56 EventData_re : out (2 downto 0);
--
57 evt_buf_full : out (2 downto 0);
58 buf_rqst : in (3 downto 0);
60 MonBufOverWrite : in ;
65 mon_evt_cnt : out (31 downto 0);
66 WrtMonBlkDone : in (2 downto 0);
67 WrtMonEvtDone : in (2 downto 0);
68 KiloByte_toggle : in (2 downto 0);
69 EoB_toggle : in (2 downto 0);
71 wport_rdy : in (2 downto 0);
72 wport_FIFO_full : in (2 downto 0);
73 -- signal to ddr_if, AMC_if to start moving data
74 EventBufAddr_we : out (2 downto 0);
75 EventBufAddr : out array3X14;
76 -- ddr wportB signals in sysclk domain
78 TCP_dout : out (31 downto 0);
-- TCP data are written in unit of 32-bit words
79 TCP_channel : out (1 downto 0);
-- Each entry has four 32bit words, each address saves two entries. Addresses are kept in ddr_wportB
81 TCP_wcount : in (2 downto 0);
83 TCP_raddr : out (28 downto 0);
-- 28-26 encoded request source 25-0 address in 64 word
84 TCP_length : out (12 downto 0);
-- in 64 word, actual length -
1
87 TCP_din_type : in (2 downto 0);
-- TCP data destination
88 TCP_din : in (31 downto 0);
-- TCP data are written in unit of 32-bit words
106 cs_out : out (511 downto 0);
111 ipb_addr : in (31 downto 0);
112 ipb_wdata : in (31 downto 0);
113 ipb_rdata : out (31 downto 0)
119 generic (simulation : := false; en_KEEPALIVE : := '
0');
129 MY_PORT :
IN (
15 downto 0);
130 MY_IP :
IN (
31 downto 0);
131 MY_ETH :
IN (
47 downto 0);
132 -- CWND_max : IN (31 downto 0);
133 RTOmin :
IN (
15 downto 0);
134 rate_limit :
IN (
7 downto 0);
135 TSclock :
IN (
31 downto 0);
136 EVENTdata :
IN (
66 downto 0);
137 EventBufAddr :
IN (
13 downto 0);
138 EventBufAddr_we :
IN ;
141 DDR2TCPdata :
IN (
32 downto 0);
142 RETXdata_we :
IN (
1 downto 0);
143 RETXdata_chksum :
IN (
15 downto 0);
144 re_RETX_ddr_wq :
IN ;
145 RETX_ddr_data_we :
IN ;
147 KiloByte_toggle :
in ;
150 PhyEmacRxC :
IN (
3 downto 0);
151 PhyEmacRxD :
IN (
31 downto 0);
154 RETX_ddr_out :
OUT (
31 downto 0);
155 RETX_ddr_wrqst :
OUT ;
156 RETX_ddr_LEN_max :
IN (
4 downto 0);
157 RETX_ddr_LEN :
OUT (
4 downto 0);
158 RETX_ddr_rrqst :
OUT ;
160 RETXdataAddr :
OUT (
25 downto 0);
161 RETXdataLEN :
OUT (
12 downto 0);
162 UNA_MonBuf :
OUT (
10 downto 0);
163 UNA_TCPBuf :
OUT (
10 downto 0);
164 EmacPhyTxC :
OUT (
3 downto 0);
165 EmacPhyTxD :
OUT (
31 downto 0);
166 ipb_addr :
in (
31 downto 0);
167 ipb_rdata :
out (
31 downto 0);
168 cs_out :
OUT (
511 downto 0)
182 GTX_TXD :
OUT (
31 downto 0);
183 GTX_TXHEADER :
OUT (
1 downto 0);
185 GTX_RXD :
IN (
31 downto 0);
187 GTX_RXHEADER :
IN (
1 downto 0);
188 GTX_RXHEADERVLD :
IN ;
190 GTX_RXGEARBOXSLIP_OUT :
OUT ;
191 EmacPhyTxC :
IN (
3 downto 0);
192 EmacPhyTxD :
IN (
31 downto 0);
193 PhyEmacRxC :
OUT (
3 downto 0);
194 PhyEmacRxD :
OUT (
31 downto 0)
208 EXAMPLE_SIM_GTRESET_SPEEDUP : :=
"TRUE";
-- simulation setting for GT SecureIP model
209 EXAMPLE_SIMULATION : :=
0;
-- Set to 1 for simulation
210 STABLE_CLOCK_PERIOD : :=
20;
--Period of the stable clock driving this state-machine, unit is [ns]
211 EXAMPLE_USE_CHIPSCOPE : :=
0 -- Set to 1 to use Chipscope
to drive resets
218 DONT_RESET_ON_DATA_ERROR_IN :
in ;
219 GT0_TX_FSM_RESET_DONE_OUT :
out ;
220 GT0_RX_FSM_RESET_DONE_OUT :
out ;
221 GT0_DATA_VALID_IN :
in ;
222 GT1_TX_FSM_RESET_DONE_OUT :
out ;
223 GT1_RX_FSM_RESET_DONE_OUT :
out ;
224 GT1_DATA_VALID_IN :
in ;
225 GT2_TX_FSM_RESET_DONE_OUT :
out ;
226 GT2_RX_FSM_RESET_DONE_OUT :
out ;
227 GT2_DATA_VALID_IN :
in ;
229 --_________________________________________________________________________
231 --____________________________CHANNEL PORTS________________________________
232 ---------------------------- Channel - DRP Ports --------------------------
233 GT0_DRPADDR_IN :
in (
8 downto 0);
235 GT0_DRPDI_IN :
in (
15 downto 0);
236 GT0_DRPDO_OUT :
out (
15 downto 0);
238 GT0_DRPRDY_OUT :
out ;
240 ------------------------------- Loopback Ports -----------------------------
241 GT0_LOOPBACK_IN :
in (
2 downto 0);
242 ------------------------------ Power-Down Ports ----------------------------
243 GT0_RXPD_IN :
in (
1 downto 0);
244 GT0_TXPD_IN :
in (
1 downto 0);
245 --------------------- RX Initialization and Reset Ports --------------------
246 GT0_RXUSERRDY_IN :
in ;
247 -------------------------- RX Margin Analysis Ports ------------------------
248 GT0_EYESCANDATAERROR_OUT :
out ;
249 ------------------------- Receive Ports - CDR Ports ------------------------
250 GT0_RXCDRLOCK_OUT :
out ;
251 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
252 GT0_RXUSRCLK_IN :
in ;
253 GT0_RXUSRCLK2_IN :
in ;
254 ------------------ Receive Ports - FPGA RX interface Ports -----------------
255 GT0_RXDATA_OUT :
out (
31 downto 0);
256 ------------------- Receive Ports - Pattern Checker Ports ------------------
257 GT0_RXPRBSERR_OUT :
out ;
258 GT0_RXPRBSSEL_IN :
in (
2 downto 0);
259 ------------------- Receive Ports - Pattern Checker ports ------------------
260 GT0_RXPRBSCNTRESET_IN :
in ;
261 --------------------------- Receive Ports - RX AFE -------------------------
263 ------------------------ Receive Ports - RX AFE Ports ----------------------
265 ------------------- Receive Ports - RX Buffer Bypass Ports -----------------
266 GT0_RXBUFRESET_IN :
in ;
267 GT0_RXBUFSTATUS_OUT :
out (
2 downto 0);
268 --------------- Receive Ports - RX Fabric Output Control Ports -------------
269 GT0_RXOUTCLK_OUT :
out ;
270 ---------------------- Receive Ports - RX Gearbox Ports --------------------
271 GT0_RXDATAVALID_OUT :
out ;
272 GT0_RXHEADER_OUT :
out (
1 downto 0);
273 GT0_RXHEADERVALID_OUT :
out ;
274 --------------------- Receive Ports - RX Gearbox Ports --------------------
275 GT0_RXGEARBOXSLIP_IN :
in ;
276 ------------- Receive Ports - RX Initialization and Reset Ports ------------
277 GT0_GTRXRESET_IN :
in ;
278 GT0_RXPMARESET_IN :
in ;
279 ------------------ Receive Ports - RX Margin Analysis ports ----------------
280 GT0_RXLPMEN_IN :
in ;
281 -------------- Receive Ports -RX Initialization and Reset Ports ------------
282 GT0_RXRESETDONE_OUT :
out ;
283 --------------------- TX Initialization and Reset Ports --------------------
284 GT0_GTTXRESET_IN :
in ;
285 GT0_TXUSERRDY_IN :
in ;
286 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
287 GT0_TXUSRCLK_IN :
in ;
288 GT0_TXUSRCLK2_IN :
in ;
289 --------------- Transmit Ports - TX Configurable Driver Ports --------------
290 GT0_TXDIFFCTRL_IN :
in (
3 downto 0);
291 GT0_TXINHIBIT_IN :
in ;
292 GT0_TXMAINCURSOR_IN :
in (
6 downto 0);
293 ------------------ Transmit Ports - TX Data Path interface -----------------
294 GT0_TXDATA_IN :
in (
31 downto 0);
295 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
296 GT0_GTXTXN_OUT :
out ;
297 GT0_GTXTXP_OUT :
out ;
298 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
299 GT0_TXOUTCLK_OUT :
out ;
300 GT0_TXOUTCLKFABRIC_OUT :
out ;
301 GT0_TXOUTCLKPCS_OUT :
out ;
302 --------------------- Transmit Ports - TX Gearbox Ports --------------------
303 GT0_TXHEADER_IN :
in (
1 downto 0);
304 GT0_TXSEQUENCE_IN :
in (
6 downto 0);
305 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
306 GT0_TXRESETDONE_OUT :
out ;
307 ------------------ Transmit Ports - pattern Generator Ports ----------------
308 GT0_TXPRBSSEL_IN :
in (
2 downto 0);
311 --____________________________CHANNEL PORTS________________________________
312 ---------------------------- Channel - DRP Ports --------------------------
313 GT1_DRPADDR_IN :
in (
8 downto 0);
315 GT1_DRPDI_IN :
in (
15 downto 0);
316 GT1_DRPDO_OUT :
out (
15 downto 0);
318 GT1_DRPRDY_OUT :
out ;
320 ------------------------------- Loopback Ports -----------------------------
321 GT1_LOOPBACK_IN :
in (
2 downto 0);
322 ------------------------------ Power-Down Ports ----------------------------
323 GT1_RXPD_IN :
in (
1 downto 0);
324 GT1_TXPD_IN :
in (
1 downto 0);
325 --------------------- RX Initialization and Reset Ports --------------------
326 GT1_RXUSERRDY_IN :
in ;
327 -------------------------- RX Margin Analysis Ports ------------------------
328 GT1_EYESCANDATAERROR_OUT :
out ;
329 ------------------------- Receive Ports - CDR Ports ------------------------
330 GT1_RXCDRLOCK_OUT :
out ;
331 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
332 GT1_RXUSRCLK_IN :
in ;
333 GT1_RXUSRCLK2_IN :
in ;
334 ------------------ Receive Ports - FPGA RX interface Ports -----------------
335 GT1_RXDATA_OUT :
out (
31 downto 0);
336 ------------------- Receive Ports - Pattern Checker Ports ------------------
337 GT1_RXPRBSERR_OUT :
out ;
338 GT1_RXPRBSSEL_IN :
in (
2 downto 0);
339 ------------------- Receive Ports - Pattern Checker ports ------------------
340 GT1_RXPRBSCNTRESET_IN :
in ;
341 --------------------------- Receive Ports - RX AFE -------------------------
343 ------------------------ Receive Ports - RX AFE Ports ----------------------
345 ------------------- Receive Ports - RX Buffer Bypass Ports -----------------
346 GT1_RXBUFRESET_IN :
in ;
347 GT1_RXBUFSTATUS_OUT :
out (
2 downto 0);
348 --------------- Receive Ports - RX Fabric Output Control Ports -------------
349 GT1_RXOUTCLK_OUT :
out ;
350 ---------------------- Receive Ports - RX Gearbox Ports --------------------
351 GT1_RXDATAVALID_OUT :
out ;
352 GT1_RXHEADER_OUT :
out (
1 downto 0);
353 GT1_RXHEADERVALID_OUT :
out ;
354 --------------------- Receive Ports - RX Gearbox Ports --------------------
355 GT1_RXGEARBOXSLIP_IN :
in ;
356 ------------- Receive Ports - RX Initialization and Reset Ports ------------
357 GT1_GTRXRESET_IN :
in ;
358 GT1_RXPMARESET_IN :
in ;
359 ------------------ Receive Ports - RX Margin Analysis ports ----------------
360 GT1_RXLPMEN_IN :
in ;
361 -------------- Receive Ports -RX Initialization and Reset Ports ------------
362 GT1_RXRESETDONE_OUT :
out ;
363 --------------------- TX Initialization and Reset Ports --------------------
364 GT1_GTTXRESET_IN :
in ;
365 GT1_TXUSERRDY_IN :
in ;
366 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
367 GT1_TXUSRCLK_IN :
in ;
368 GT1_TXUSRCLK2_IN :
in ;
369 --------------- Transmit Ports - TX Configurable Driver Ports --------------
370 GT1_TXDIFFCTRL_IN :
in (
3 downto 0);
371 GT1_TXINHIBIT_IN :
in ;
372 GT1_TXMAINCURSOR_IN :
in (
6 downto 0);
373 ------------------ Transmit Ports - TX Data Path interface -----------------
374 GT1_TXDATA_IN :
in (
31 downto 0);
375 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
376 GT1_GTXTXN_OUT :
out ;
377 GT1_GTXTXP_OUT :
out ;
378 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
379 GT1_TXOUTCLK_OUT :
out ;
380 GT1_TXOUTCLKFABRIC_OUT :
out ;
381 GT1_TXOUTCLKPCS_OUT :
out ;
382 --------------------- Transmit Ports - TX Gearbox Ports --------------------
383 GT1_TXHEADER_IN :
in (
1 downto 0);
384 GT1_TXSEQUENCE_IN :
in (
6 downto 0);
385 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
386 GT1_TXRESETDONE_OUT :
out ;
387 ------------------ Transmit Ports - pattern Generator Ports ----------------
388 GT1_TXPRBSSEL_IN :
in (
2 downto 0);
391 --____________________________CHANNEL PORTS________________________________
392 ---------------------------- Channel - DRP Ports --------------------------
393 GT2_DRPADDR_IN :
in (
8 downto 0);
395 GT2_DRPDI_IN :
in (
15 downto 0);
396 GT2_DRPDO_OUT :
out (
15 downto 0);
398 GT2_DRPRDY_OUT :
out ;
400 ------------------------------- Loopback Ports -----------------------------
401 GT2_LOOPBACK_IN :
in (
2 downto 0);
402 ------------------------------ Power-Down Ports ----------------------------
403 GT2_RXPD_IN :
in (
1 downto 0);
404 GT2_TXPD_IN :
in (
1 downto 0);
405 --------------------- RX Initialization and Reset Ports --------------------
406 GT2_RXUSERRDY_IN :
in ;
407 -------------------------- RX Margin Analysis Ports ------------------------
408 GT2_EYESCANDATAERROR_OUT :
out ;
409 ------------------------- Receive Ports - CDR Ports ------------------------
410 GT2_RXCDRLOCK_OUT :
out ;
411 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
412 GT2_RXUSRCLK_IN :
in ;
413 GT2_RXUSRCLK2_IN :
in ;
414 ------------------ Receive Ports - FPGA RX interface Ports -----------------
415 GT2_RXDATA_OUT :
out (
31 downto 0);
416 ------------------- Receive Ports - Pattern Checker Ports ------------------
417 GT2_RXPRBSERR_OUT :
out ;
418 GT2_RXPRBSSEL_IN :
in (
2 downto 0);
419 ------------------- Receive Ports - Pattern Checker ports ------------------
420 GT2_RXPRBSCNTRESET_IN :
in ;
421 --------------------------- Receive Ports - RX AFE -------------------------
423 ------------------------ Receive Ports - RX AFE Ports ----------------------
425 ------------------- Receive Ports - RX Buffer Bypass Ports -----------------
426 GT2_RXBUFRESET_IN :
in ;
427 GT2_RXBUFSTATUS_OUT :
out (
2 downto 0);
428 --------------- Receive Ports - RX Fabric Output Control Ports -------------
429 GT2_RXOUTCLK_OUT :
out ;
430 ---------------------- Receive Ports - RX Gearbox Ports --------------------
431 GT2_RXDATAVALID_OUT :
out ;
432 GT2_RXHEADER_OUT :
out (
1 downto 0);
433 GT2_RXHEADERVALID_OUT :
out ;
434 --------------------- Receive Ports - RX Gearbox Ports --------------------
435 GT2_RXGEARBOXSLIP_IN :
in ;
436 ------------- Receive Ports - RX Initialization and Reset Ports ------------
437 GT2_GTRXRESET_IN :
in ;
438 GT2_RXPMARESET_IN :
in ;
439 ------------------ Receive Ports - RX Margin Analysis ports ----------------
440 GT2_RXLPMEN_IN :
in ;
441 -------------- Receive Ports -RX Initialization and Reset Ports ------------
442 GT2_RXRESETDONE_OUT :
out ;
443 --------------------- TX Initialization and Reset Ports --------------------
444 GT2_GTTXRESET_IN :
in ;
445 GT2_TXUSERRDY_IN :
in ;
446 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
447 GT2_TXUSRCLK_IN :
in ;
448 GT2_TXUSRCLK2_IN :
in ;
449 --------------- Transmit Ports - TX Configurable Driver Ports --------------
450 GT2_TXDIFFCTRL_IN :
in (
3 downto 0);
451 GT2_TXINHIBIT_IN :
in ;
452 GT2_TXMAINCURSOR_IN :
in (
6 downto 0);
453 ------------------ Transmit Ports - TX Data Path interface -----------------
454 GT2_TXDATA_IN :
in (
31 downto 0);
455 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
456 GT2_GTXTXN_OUT :
out ;
457 GT2_GTXTXP_OUT :
out ;
458 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
459 GT2_TXOUTCLK_OUT :
out ;
460 GT2_TXOUTCLKFABRIC_OUT :
out ;
461 GT2_TXOUTCLKPCS_OUT :
out ;
462 --------------------- Transmit Ports - TX Gearbox Ports --------------------
463 GT2_TXHEADER_IN :
in (
1 downto 0);
464 GT2_TXSEQUENCE_IN :
in (
6 downto 0);
465 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
466 GT2_TXRESETDONE_OUT :
out ;
467 ------------------ Transmit Ports - pattern Generator Ports ----------------
468 GT2_TXPRBSSEL_IN :
in (
2 downto 0);
471 --____________________________COMMON PORTS________________________________
472 ---------------------- Common Block - Ref Clock Ports ---------------------
473 GT0_GTREFCLK0_COMMON_IN :
in ;
474 ------------------------- Common Block - QPLL Ports ------------------------
475 GT0_QPLLLOCK_OUT :
out ;
476 GT0_QPLLLOCKDETCLK_IN :
in ;
477 GT0_QPLLRESET_IN :
in
487 d :
IN (
31 downto 0);
488 s :
OUT (
15 downto 0)
495 en_stop :
IN (
4 downto 0);
496 cmsCRC_err :
IN (
2 downto 0);
497 EventData_in :
IN array3X67;
498 EventData_we :
IN (
2 downto 0);
499 inc_err :
OUT array3X5;
507 di :
IN (
5 downto 0);
509 wa :
IN (
4 downto 0);
510 ra :
IN (
4 downto 0);
512 do :
OUT (
5 downto 0)
518 di :
IN (
5 downto 0);
520 wa :
IN (
4 downto 0);
521 ra :
IN (
4 downto 0);
522 do :
OUT (
5 downto 0)
531 crc_d :
IN (
63 downto 0);
533 crc :
OUT (
15 downto 0);
535 dout :
OUT (
63 downto 0);
539 signal resetSyncRegs : (2 downto 0) := (others => '0');
540 signal ClientClk2XresetSyncRegs : (2 downto 0) := (others => '0');
541 signal refclk : := '0';
542 signal REFCLK2XPLLRST : := '0';
543 signal refclk2x_in : := '0';
544 signal ClientClk2x_dcm : := '0';
545 signal ClientClk2x : := '0';
546 signal ClientClk_dcm : := '0';
547 signal ClientClk : := '0';
548 signal ClientClk_lock : := '0';
549 signal ClientClkToggle : := '0';
550 signal ClientClkToggle_q : := '0';
551 signal FIFO_rst : := '0';
552 signal FIFO_en : := '0';
553 signal TX_high : := '0';
554 signal us_cntr : (9 downto 0) := (others => '0');
555 signal ms_cntr : (10 downto 0) := (others => '0');
556 signal strobe_us : := '0';
557 signal strobe_ms : := '0';
558 signal TSclock : (31 downto 0) := (others => '0');
559 signal evt_FIFO_full : (2 downto 0) := (others => '0');
560 signal evt_FIFO_empty : (2 downto 0) := (others => '0');
561 signal evt_FIFO_we : (2 downto 0) := (others => '0');
562 signal evt_FIFO_re : (2 downto 0) := (others => '0');
563 signal evt_FIFO_rep : (2 downto 0) := (others => '0');
564 signal evt_FIFO_data_avl : (2 downto 0) := (others => '0');
565 signal evt_FIFO_di : array3X67 := (others => (others => '0'));
566 signal evt_FIFO_do : array3X67 := (others => (others => '0'));
567 signal evt_FIFO_RDCOUNT : array3X9 := (others => (others => '0'));
568 signal evt_FIFO_WRCOUNT : array3X9 := (others => (others => '0'));
569 signal EVENTdata_avl : (2 downto 0) := (others => '0');
570 signal EVENTdata_addr : array3X13 := (others => (others => '0'));
571 signal re_RETX_ddr_wq : (2 downto 0) := (others => '0');
572 signal RETX_ddr_data_we : (2 downto 0) := (others => '0');
573 signal RETX_ddr_wrqst : (2 downto 0) := (others => '0');
574 signal RETX_ddr_rrqst : (2 downto 0) := (others => '0');
575 signal RETX_ddr_out : array3X32 := (others => (others => '0'));
576 signal RETX_ddr_LEN_max : array3X5 := (others => (others => '0'));
577 signal RETX_ddr_LEN : array3X5 := (others => (others => '0'));
578 signal RETXdata_we : array3X2 := (others => (others => '0'));
579 signal DDR2TCPdata : (32 downto 0) := (others => '0');
580 signal rst_RETXdata_chksum : := '0';
581 signal RETXdata_chksum_out : (15 downto 0) := (others => '0');
582 signal RETXdata_checksum : array3x16 := (others => (others => '0'));
583 signal RETXdataLEN : array3X13 := (others => (others => '0'));
584 signal RETXdataAddr : array3X26 := (others => (others => '0'));
585 signal RETXdata_space : (2 downto 0) := (others => '0');
586 signal RETXdataRqst : (2 downto 0) := (others => '0');
587 signal RETXdataACK : (2 downto 0) := (others => '0');
588 signal ReleaseLen : array3X11 := (others => (others => '0'));
589 signal Release_space : (2 downto 0) := (others => '0');
590 signal ReleaseBuffer : (2 downto 0) := (others => '0');
591 signal Release_rqst: (2 downto 0) := (others => '0');
592 signal rrqstMask : (5 downto 0) := (others => '0');
593 signal TCP_rrqst_i : (2 downto 0) := (others => '0');
595 signal rst_odd : := '0';
596 --signal DDR2TCPdata_vld : := '0';
597 signal TCP_rFIFO_do_vld : := '0';
598 signal ld_RETXdata_chksum : (2 downto 0) := (others => '0');
599 signal ld_RETXdata_chksum_r : (2 downto 0) := (others => '0');
600 signal ld_RETXdata_chksum_r2 : (2 downto 0) := (others => '0');
601 signal TCP_rFIFO_wa0SyncRegs : (3 downto 0) := (others => '0');
602 signal TCP_rFIFO_wa1SyncRegs : (3 downto 0) := (others => '0');
603 signal TCP_rFIFO_wa2SyncRegs : (3 downto 0) := (others => '0');
604 signal TCP_rFIFO_di : (35 downto 0) := (others => '0');
605 signal TCP_rFIFO_do : (35 downto 0) := (others => '0');
606 signal TCP_rFIFO_wa : (4 downto 0) := (others => '0');
607 signal TCP_rFIFO_ra : (4 downto 0) := (others => '0');
608 signal RETX_ddr_rp_rst : := '0';
609 signal RETX_ddr_rp_we : := '0';
610 signal RETX_ddr_rp_di : (17 downto 0) := (others => '0');
611 signal RETX_ddr_rp_do : (17 downto 0) := (others => '0');
612 signal RETX_ddr_rp_a : (4 downto 0) := (others => '0');
613 signal TCP_length_i : (20 downto 0) := (others => '0');
614 signal TCP_raddr_i : (28 downto 0) := (others => '0');
615 signal TCP_rlength : (12 downto 0) := (others => '0');
616 --signal rdDDRqueue_we : := '0';
617 --signal rdDDRqueue_re : := '0';
618 --signal rdDDRqueue_a : (2 downto 0) := (
others => '0');
619 --signal rdDDRqueue_di : (2 downto 0) := (
others => '0');
620 --signal rdDDRqueue_do : (2 downto 0) := (
others => '0');
621 --signal rdDDRqueue_dout : (2 downto 0) := (
others => '0');
622 --signal rdDDRqueue_dout_vld : := '0';
623 signal TCP_wFIFO_re : := '0';
624 signal TCP_w_busy : := '0';
625 signal TCP_wFIFO_we : := '0';
626 signal TCP_w_sel : (1 downto 0) := (others => '0');
627 signal TCP_w_wc : (3 downto 0) := (others => '0');
628 signal TCP_wFIFO_DI : (33 downto 0) := (others => '0');
629 signal TCP_wFIFO_DO : (33 downto 0) := (others => '0');
630 signal TCP_wFIFO_RDCOUNT : (8 downto 0) := (others => '0');
631 signal TCP_wFIFO_WRCOUNT : (8 downto 0) := (others => '0');
632 signal inh_TX : (2 downto 0) := (others => '0');
633 signal inh_TX_q : (2 downto 0) := (others => '0');
634 signal reset_TXSyncRegs : (2 downto 0) := (others => '0');
635 signal SFP_TXOUTCLK : (2 downto 0) := (others => '0');
636 signal txusrclk : := '0';
637 signal qplllock : := '0';
638 signal qpllreset : := '0';
639 signal GTX_TX_READ : := '0';
640 signal LINK_down : (2 downto 0) := (others => '0');
641 signal EnTCPIP : (2 downto 0) := (others => '0');
642 signal SFP_rxoutclk : (2 downto 0) := (others => '0');
643 signal SFP_rxusrclk : (2 downto 0) := (others => '0');
644 signal SFP_txuserrdy : (2 downto 0) := (others => '0');
645 signal SFP_rxresetdone : (2 downto 0) := (others => '0');
646 signal SFP_rxuserrdy : (2 downto 0) := (others => '0');
647 signal SFP_drprdy : (2 downto 0) := (others => '0');
648 signal SFP_drpen : (2 downto 0) := (others => '0');
649 signal SFP_drpwe : (2 downto 0) := (others => '0');
650 signal SFP_rxdfeagchold : (2 downto 0) := (others => '0');
651 signal SFP_adapt_done : (2 downto 0) := (others => '0');
652 signal SFP_rxmonitor : array3X7 := (others => (others => '0'));
653 signal SFP_drpdo : array3X16 := (others => (others => '0'));
654 signal SFP_rxmonitorsel : array3X2 := (others => (others => '0'));
655 signal SFP_drpaddr : array3X9 := (others => (others => '0'));
656 signal SFP_drpdi : array3X16 := (others => (others => '0'));
657 signal SFP_RX_FSM_RESET_DONE : (2 downto 0) := (others => '0');
658 signal SFP_TX_FSM_RESET_DONE : (2 downto 0) := (others => '0');
659 signal SFP_RXDVLD : (2 downto 0) := (others => '0');
660 signal SFP_RXHEADERVLD : (2 downto 0) := (others => '0');
661 signal SFP_RXGEARBOXSLIP : (2 downto 0) := (others => '0');
662 signal SFP_RXGOOD : (2 downto 0) := (others => '0');
663 signal SFP_TXD : array3X32 := (others => (others => '0'));
664 signal SFP_TXD_inv : array3X32 := (others => (others => '0'));
665 signal SFP_TXHEADER : array3X2 := (others => (others => '0'));
666 signal SFP_RXD : array3X32 := (others => (others => '0'));
667 signal SFP_RXD_inv : array3X32 := (others => (others => '0'));
668 signal SFP_RXHEADER : array3X2 := (others => (others => '0'));
669 signal SFP_EmacPhyTxD : array3X32 := (others => (others => '0'));
670 signal SFP_EmacPhyTxC : array3X4 := (others => (others => '0'));
671 signal SFP_PhyEmacRxD : array3X32 := (others => (others => '0'));
672 signal SFP_PhyEmacRxC : array3X4 := (others => (others => '0'));
673 --signal PCS_status : array3X32 := (others => (others => '0'));
674 signal EmacPhyTxD : array3X32 := (others => (others => '0'));
675 signal EmacPhyTxC : array3X4 := (others => (others => '0'));
676 signal PhyEmacRxD : array3X32 := (others => (others => '0'));
677 signal PhyEmacRxC : array3X4 := (others => (others => '0'));
678 signal TCPIP2SFP_sel : array3X2 := (others => (others => '0'));
679 signal SFP2TCPIP : array3X2 := (others => (others => '0'));
680 signal IPADDR : array3X32 := (others => (others => '0'));
681 signal SFP_IPADDR : array3X32 := (x"c0a80120",x"c0a80121",x"c0a80122");
682 --signal CWND_max : (31 downto 0) := x"0fffffff";
683 signal RTOmin : (15 downto 0) := x"0008";
684 signal MACADDR : array3X48 := (others => (others => '0'));
685 signal GTX_TX_PAUSE : := '0';
686 signal TXSEQ_cntr : (6 downto 0) := (others => '0');
687 signal SFP_TXSEQUENCE : array3X7 := (others => (others => '0'));
688 signal SFP_LOOPBACK_IN : array3X3 := (others => (others => '0'));
689 signal SFP_RXPRBSERR_OUT : (2 downto 0) := (others => '0');
690 signal SFP_RXPRBSSEL_IN : array3X3 := (others => (others => '0'));
691 signal SFP_TXPRBSSEL_IN : array3X3 := (others => (others => '0'));
692 signal SFP_EYESCANDATAERROR_OUT : (2 downto 0) := (others => '0');
693 signal got_eofToggle : (2 downto 0) := (others => '0');
694 signal EventBufAddr_we_i : (2 downto 0) := (others => '0');
695 signal EventData_re_i : (2 downto 0) := (others => '0');
696 signal EventBufAddr_i : array3X14 := (others => (others => '0'));
697 signal ReadBusy : (2 downto 0) := (others => '0');
698 signal UNA_MonBufMatch : (3 downto 0) := (others => '0');
699 signal UNA_TCPBufMatch : (2 downto 0) := (others => '0');
700 signal UNA_MonBufSyncRegs : (3 downto 0) := (others => '0');
701 signal UNA_TCPBufSyncRegs : (3 downto 0) := (others => '0');
702 signal inc_ddr_paSyncRegs : (3 downto 0) := (others => '0');
703 signal sysDIV2 : := '0';
704 signal evt_FIFO_sel : := '0';
705 signal ReleaseMonBuf : := '0';
706 signal ReleaseTCPBuf : := '0';
707 signal WrtMonBufAllDone_i : := '0';
708 --signal TCPBufCnt : (12 downto 0) := (
others => '0');
709 --signal MonBufCnt : (12 downto 0) := (
others => '0');
710 signal NXT_TCPBuf : array3X12 := (others => (others => '0'));
711 signal UNA_MonBuf : array5X11 := (others => (others => '0'));
712 signal UNA_TCPBuf : array4X11 := (others => (others => '0'));
713 signal AddrOffset : array3X10 := (others => (others => '0'));
714 signal SFPresetSyncRegs : array3X3 := (others => (others => '0'));
715 --signal TCPresetSyncRegs : array3X3 := (others => (others => '0'));
716 signal TCPresetSyncRegs : (2 downto 0) := (others => '0');
717 signal got_eofToggle0SyncRegs : (3 downto 0) := (others => '0');
718 signal reset_TCPIP : (2 downto 0) := (others => '0');
719 signal got_eofToggle1SyncRegs : (3 downto 0) := (others => '0');
720 signal got_eofToggle2SyncRegs : (3 downto 0) := (others => '0');
721 signal TCPIP_rdata : array3X32 := (others => (others => '0'));
722 signal AddrBuf_full : (2 downto 0) := (others => '0');
723 signal mon_evt_cnt_i : (10 downto 0) := (others => '0');
724 signal MonBufUsed : (9 downto 0) := (others => '0');
725 signal MonBuf_full : := '0';
726 signal chk_MonBuf_avl : := '0';
727 signal FirstBlkAddrDo : array2x3x12 := (others => (others => (others => '0')));
728 signal FirstBlkAddr_ra : array2x3x5 := (others => (others => (others => '0')));
729 signal FirstBlkAddr_re : array2X3 := (others => (others => '0'));
730 signal WrtMonEvtDone_l : (2 downto 0) := (others => '0');
731 signal MonEvtQueued : (2 downto 0) := (others => '0');
732 signal FirstBlkAddrDoValid : array2X3 := (others => (others => '0'));
733 signal FirstBlkAddr_wa : (4 downto 0) := (others => '0');
734 signal FirstBlkAddrDi : (11 downto 0) := (others => '0');
735 signal FirstBlkAddr_we : := '0';
736 signal MonBuf_wa : (10 downto 0) := (others => '0');
737 signal MonBuf_ra : (10 downto 0) := (others => '0');
738 signal NXT_MonBuf : array3X11 := (others => (others => '0'));
739 signal Written_MonBuf : array4X11 := (others => (others => '0'));
740 signal Written_MonBufMatch : (2 downto 0) := (others => '0');
741 signal SFP_pd : array3X2 := (others => (others => '0'));
742 signal EventData_reCntr : array3X32 := (others => (others => '0'));
743 signal EventData_weCntr : array3X32 := (others => (others => '0'));
744 signal EventBufAddr_weCntr : array3X32 := (others => (others => '0'));
745 signal cmsCRC_initp : (2 downto 0) := (others => '0');
746 signal cmsCRC_init : (2 downto 0) := (others => '0');
747 signal cmsCRC_ce : (2 downto 0) := (others => '0');
748 signal cmsCRC_err : (2 downto 0) := (others => '0');
749 signal cmsCRC_errCntr : array3X32 := (others => (others => '0'));
750 signal SFP_we : (2 downto 0) := (others => '0');
751 signal EoB : (2 downto 0) := (others => '0');
752 signal EoE : (2 downto 0) := (others => '0');
753 signal SFP_evt_cntr : array3X32 := (others => (others => '0'));
754 signal SFP_blk_cntr : array3X32 := (others => (others => '0'));
755 signal SFP_word_cntr : array3X32 := (others => (others => '0'));
756 --signal EvtLength_err : (2 downto 0) := (
others => '0');
757 signal TotalEvtLengthCntr24q : (2 downto 0) := (others => '0');
758 signal EvtLengthCntr : array3X24 := (others => (others => '0'));
759 signal EvtLength_errCntr : array3X32 := (others => (others => '0'));
760 signal AMClength_errCntr : array3X32 := (others => (others => '0'));
761 signal AMCvalid_errCntr : array3X32 := (others => (others => '0'));
762 signal AMCcrc_errCntr : array3X32 := (others => (others => '0'));
763 signal TotalEvtLengthCntr : array3X56 := (others => (others => '0'));
764 signal SFP_down_i : (2 downto 0) := (others => '0');
765 signal StopOverWrite : := '0';
766 signal StopOnCMScrc_err : := '0';
767 signal en_stop : (4 downto 0) := (others => '1');
768 signal stop : := '0';
769 signal inc_err : array3x5 := (others => (others => '0'));
770 signal reset_cntr : (20 downto 0) := (others => '0');
771 --signal Rx_start_cntr : (31 downto 0) := (
others => '0');
772 signal SFP_pd_q : array3X4 := (others => (others => '0'));
773 signal soft_reset : := '0';
774 signal reset_cntr20_q : := '0';
775 signal SFP_rate_limit : array3x8 := (others => x"7f");
776 signal rate_limit : array3x8 := (others => x"7f");
782 ina :
IN (
135 downto 0);
783 inb :
IN (
135 downto 0)
790 Din :
IN (
303 downto 0)
793 COMPONENT chipscope1b
794 generic (USER2 : := false);
797 Din :
IN (
303 downto 0)
802 CONTROL0 :
INOUT (
35 DOWNTO 0));
807 CONTROL :
INOUT (
35 DOWNTO 0);
809 DATA :
IN (
35 DOWNTO 0);
810 TRIG0 :
IN (
7 DOWNTO 0));
814 type array3x512 is array(0 to 2) of (511 downto 0);
815 signal TCPIP_cs : array3x512;
816 signal cs_din : (303 downto 0) := (others => '0');
817 signal waitcntr : (11 downto 0) := (others => '0');
818 signal CONTROL0 : (35 downto 0) := (others => '0');
822 -- CONTROL0 => CONTROL0);
823 --i_ila36x1024 : ila36x1024
825 -- CONTROL => CONTROL0,
826 -- CLK => ClientClk2X,
827 -- DATA => TCPIP_cs(0)(
35 downto 0),
828 -- TRIG0 => TCPIP_cs(0)(
28 downto 21));
829 SFP_down(2) <= SFP_down_i(2) and not enSFP(3) and enSFP(2);
830 SFP_down(1) <= SFP_down_i(1) and not enSFP(3) and enSFP(1);
831 SFP_down(0) <= SFP_down_i(0) and not enSFP(3) and enSFP(0);
832 TCPclk <= ClientClk2X;
833 --MonBuf_avl <= MonBuf_avl_i;
835 EventBufAddr_we <= EventBufAddr_we_i;
836 EventData_re <= EventData_re_i;
837 mon_evt_cnt(31 downto 11) <= (others => '0');
838 mon_evt_cnt(10 downto 0) <= mon_evt_cnt_i;
839 EventBufAddr <= EventBufAddr_i;
840 TCP_rrqst <= TCP_rrqst_i(2);
841 TCP_raddr <= TCP_raddr_i;
842 --TCP_length <= TCP_rlength(9 downto 0);
843 TCP_length <= TCP_rlength;
844 process(sysclk,reset,ClientClk_lock)
846 if(reset = '1' or ClientClk_lock = '0')then
847 resetSyncRegs <= (others => '1');
848 elsif(sysclk'event and sysclk = '1')then
849 resetSyncRegs <= resetSyncRegs(1 downto 0) & '0';
852 process(ClientClk2X,SFP_TX_FSM_RESET_DONE,SFP_RX_FSM_RESET_DONE)
855 if(SFP_TX_FSM_RESET_DONE(i) = '0' or SFP_RX_FSM_RESET_DONE(i) = '0')then
856 SFPresetSyncRegs(i) <= (others => '1');
857 elsif(ClientClk2X'event and ClientClk2X = '1')then
858 SFPresetSyncRegs(i) <= SFPresetSyncRegs(i)(1 downto 0) & '0';
862 process(ClientClk2X,reset,ClientClk_lock)
864 if(reset = '1' or ClientClk_lock = '0')then
865 ClientClk2XresetSyncRegs <= (others => '1');
866 elsif(ClientClk2X'event and ClientClk2X = '1')then
867 ClientClk2XresetSyncRegs <= ClientClk2XresetSyncRegs(1 downto 0) & '0';
870 --process(ClientClk,SFP_TX_FSM_RESET_DONE,ClientClk_lock)
872 -- for i in 0 to 2 loop
873 -- if(SFP_TX_FSM_RESET_DONE(i) = '0' or ClientClk_lock = '0')then
874 --process(ClientClk,TCPreset,ClientClk_lock)
876 -- for i in 0 to 2 loop
877 -- if(TCPreset = '1' or ClientClk_lock = '0')then
878 -- TCPresetSyncRegs(i) <= (others => '1');
879 -- elsif(ClientClk2X'event and ClientClk2X = '1')then
880 -- TCPresetSyncRegs(i) <= TCPresetSyncRegs(i)(1 downto 0) & '0';
884 process(ClientClk,TCPreset,ClientClk_lock)
886 if(TCPreset = '1' or ClientClk_lock = '0')then
887 TCPresetSyncRegs <= (others => '1');
888 elsif(ClientClk'event and ClientClk = '1')then
889 TCPresetSyncRegs <= TCPresetSyncRegs(1 downto 0) & '0';
894 if(ClientClk'event and ClientClk = '1')then
895 ClientClkToggle <= not ClientClkToggle;
896 -- for i in 0 to 2 loop
897 -- if(TCPresetSyncRegs(2) = '1'
or SFP_pd(i)(
0) = '1')
then
898 -- PCS_reset(i) <= '1';
899 -- elsif(SFP_TX_FSM_RESET_DONE(i) = '1')then
900 -- PCS_reset(i) <= '0';
907 if(ClientClk2X'event and ClientClk2X = '1')then
908 ClientClkToggle_q <= ClientClkToggle;
909 TX_high <= ClientClkToggle_q xnor ClientClkToggle;
910 if(us_cntr(9) = '1')then
911 us_cntr <= "00" & x"c9";
912 TSclock <= TSclock + 1;
914 us_cntr <= us_cntr + 1;
916 if(us_cntr(9) = '1')then
917 if(ms_cntr(10) = '1')then
918 ms_cntr <= x"03" & "000";
920 ms_cntr <= ms_cntr + 1;
923 strobe_ms <= us_cntr(9) and ms_cntr(10);
926 strobe_us <= us_cntr(9);
929 if(txusrclk'event and txusrclk = '1')then
930 if(TXSEQ_cntr = "1000001")then
931 TXSEQ_cntr <= (others => '0');
933 TXSEQ_cntr <= TXSEQ_cntr + 1;
935 if(TXSEQ_cntr(0) = '1')then
936 GTX_TX_PAUSE <= and_reduce(TXSEQ_cntr(5 downto 1));
938 if(inh_TX(0) = '1')then
939 SFP_TXSEQUENCE(0) <= (others => '0');
940 elsif(TXSEQ_cntr(0) = '1')then
941 SFP_TXSEQUENCE(0) <= '0' & TXSEQ_cntr(6 downto 1);
943 if(inh_TX(1) = '1')then
944 SFP_TXSEQUENCE(1) <= (others => '0');
945 elsif(TXSEQ_cntr(0) = '1')then
946 SFP_TXSEQUENCE(1) <= '0' & TXSEQ_cntr(6 downto 1);
948 if(inh_TX(2) = '1')then
949 SFP_TXSEQUENCE(2) <= (others => '0');
950 elsif(TXSEQ_cntr(0) = '1')then
951 SFP_TXSEQUENCE(2) <= '0' & TXSEQ_cntr(6 downto 1);
955 process(TXUSRCLK,TCPreset)
957 if(TCPreset = '1')then
958 reset_TXSyncRegs <= (others => '1');
959 elsif(TXUSRCLK'event and TXUSRCLK = '1')then
960 reset_TXSyncRegs <= reset_TXSyncRegs(1 downto 0) & '0';
963 process(TXUSRCLK,SFP_TX_FSM_RESET_DONE(
0))
965 if(SFP_TX_FSM_RESET_DONE(0) = '0')then
968 elsif(TXUSRCLK'event and TXUSRCLK = '1')then
969 if(TXSEQ_cntr(0) = '1' and TXSEQ_cntr(6) = '1')then
972 inh_TX_q(0) <= inh_TX(0);
975 process(TXUSRCLK,SFP_TX_FSM_RESET_DONE(
1))
977 if(SFP_TX_FSM_RESET_DONE(1) = '0')then
980 elsif(TXUSRCLK'event and TXUSRCLK = '1')then
981 if(TXSEQ_cntr(0) = '1' and TXSEQ_cntr(6) = '1')then
984 inh_TX_q(1) <= inh_TX(1);
987 process(TXUSRCLK,SFP_TX_FSM_RESET_DONE(
2))
989 if(SFP_TX_FSM_RESET_DONE(2) = '0')then
992 elsif(TXUSRCLK'event and TXUSRCLK = '1')then
993 if(TXSEQ_cntr(0) = '1' and TXSEQ_cntr(6) = '1')then
996 inh_TX_q(2) <= inh_TX(2);
1001 if(sysclk'event and sysclk = '1')then
1002 TCPBuf_avl <= not or_reduce(enTCPIP);
1003 evt_buf_full <= evt_FIFO_full or wport_FIFO_full;
1006 g_FirstBlkAddr: for j in 0 to 1 generate
1007 g1_FirstBlkAddr: for i in 0 to 5 generate
1008 i_FirstBlkAddr : RAM32M
1010 DOA => FirstBlkAddrDo
(j
)(0)(i*2+1
downto i*2
),
-- Read port A 2-bit output
1011 DOB => FirstBlkAddrDo
(j
)(1)(i*2+1
downto i*2
),
-- Read port B 2-bit output
1012 DOC => FirstBlkAddrDo
(j
)(2)(i*2+1
downto i*2
),
-- Read port C 2-bit output
1013 DOD =>
open,
-- Read/Write port D 2-bit output
1014 ADDRA => FirstBlkAddr_ra
(j
)(0),
-- Read port A 5-bit address input
1015 ADDRB => FirstBlkAddr_ra
(j
)(1),
-- Read port B 5-bit address input
1016 ADDRC => FirstBlkAddr_ra
(j
)(2),
-- Read port C 5-bit address input
1017 ADDRD => FirstBlkAddr_wa,
-- Read/Write port D 5-bit address input
1018 DIA => FirstBlkAddrDi
(i*2+1
downto i*2
),
-- RAM 2-bit data write input addressed by ADDRD,
1019 -- read addressed by ADDRA
1020 DIB => FirstBlkAddrDi
(i*2+1
downto i*2
),
-- RAM 2-bit data write input addressed by ADDRD,
1021 -- read addressed by ADDRB
1022 DIC => FirstBlkAddrDi
(i*2+1
downto i*2
),
-- RAM 2-bit data write input addressed by ADDRD,
1023 -- read addressed by ADDRC
1024 DID => "
00",
-- RAM 2-bit data write input addressed by ADDRD,
1025 -- read addressed by ADDRD
1026 WCLK => sysclk ,
-- Write clock input
1027 WE => FirstBlkAddr_we
-- Write enable input
1031 FirstBlkAddrDi <= '0' & MonBuf_wa;
1034 if(sysclk'event and sysclk = '1')then
1035 sysDIV2 <= not sysDIV2;
1036 if(resetSyncRegs(2) = '1')then
1037 chk_MonBuf_avl <= '1';
1038 elsif(buf_rqst(0) = '1')then
1039 chk_MonBuf_avl <= buf_rqst(3);
1041 if(resetSyncRegs(2) = '1')then
1043 elsif(MonBufOverWrite = '1')then
1044 MonBuf_avl <= not StopOverWrite;
1045 elsif(WaitMonBuf = '1' or enTCPIP /= "000")then
1046 if((MonBuf_wa(10) /= MonBuf_ra(10) and MonBuf_wa(9 downto 0) = MonBuf_ra(9 downto 0)))then
1051 elsif(chk_MonBuf_avl = '1')then
1052 if(MonBufUsed(9 downto 8) = "11")then
1058 if(enTCPIP /= "000")then
1059 mon_evt_cnt_i <= (others => '0');
1060 elsif(MonBufOverWrite = '1')then
1061 mon_evt_cnt_i <= MonBuf_full & Written_MonBuf(3)(9 downto 0);
1063 mon_evt_cnt_i <= Written_MonBuf(3) - MonBuf_ra;
1065 if(enTCPIP /= "000")then
1066 MonBuf_empty <= '1';
1067 elsif(MonBufOverWrite = '0')then
1068 MonBuf_empty <= not or_reduce(mon_evt_cnt_i);
1069 elsif(Written_MonBuf(3) /= MonBuf_ra or MonBuf_full = '1')then
1070 MonBuf_empty <= '0';
1072 MonBuf_empty <= '1';
1074 if(EnSFP(2 downto 1) = "00")then
1075 SFP_we(0) <= EventData_we(0);
1076 EoB(0) <= EventData_in(0)(64);
1077 EoE(0) <= EventData_in(0)(65);
1079 SFP_we(0) <= EventData_we(1) and EnSFP(0);
1080 EoB(0) <= EventData_in(1)(64);
1081 EoE(0) <= EventData_in(1)(65);
1083 if(EnSFP(2 downto 0) = "110")then
1084 SFP_we(1) <= EventData_we(1);
1085 EoB(1) <= EventData_in(1)(64);
1086 EoE(1) <= EventData_in(1)(65);
1088 SFP_we(1) <= EventData_we(0) and EnSFP(1);
1089 EoB(1) <= EventData_in(0)(64);
1090 EoE(1) <= EventData_in(0)(65);
1092 if(EnSFP(2 downto 0) = "111")then
1093 SFP_we(2) <= EventData_we(2);
1094 EoB(2) <= EventData_in(2)(64);
1095 EoE(2) <= EventData_in(2)(65);
1097 SFP_we(2) <= EventData_we(0) and EnSFP(2);
1098 EoB(2) <= EventData_in(0)(64);
1099 EoE(2) <= EventData_in(0)(65);
1101 if(resetSyncRegs(2) = '1')then
1102 ReadBusy <= (others => '0');
1103 EventData_re_i <= (others => '0');
1104 EventBufAddr_we_i <= (others => '0');
1105 UNA_MonBufSyncRegs <= (others => '0');
1106 UNA_TCPBufSyncRegs <= (others => '0');
1107 ReleaseMonBuf <= '0';
1108 ReleaseTCPBuf <= '0';
1109 MonBuf_wa <= (others => '0');
1110 MonBuf_ra <= (others => '0');
1111 Written_MonBufMatch <= (others => '1');
1112 Written_MonBuf <= (others => (others => '0'));
1113 NXT_MonBuf <= (others => (others => '0'));
1114 NXT_TCPBuf <= (others => (others => '0'));
1115 FirstBlkAddr_we <= '0';
1116 FirstBlkAddr_re <= (others => (others => '0'));
1117 FirstBlkAddrDoValid <= (others => (others => '0'));
1118 WrtMonEvtDone_l <= (others => '0');
1119 MonEvtQueued <= (others => '0');
1120 FirstBlkAddr_wa <= (others => '0');
1121 FirstBlkAddr_ra <= (others => (others => (others => '0')));
1123 EventData_reCntr <= (others => (others => '0'));
1124 EventData_weCntr <= (others => (others => '0'));
1125 EventBufAddr_weCntr <= (others => (others => '0'));
1126 EvtLengthCntr <= (others => x"000001");
1127 TotalEvtLengthCntr <= (others => (others => '0'));
1128 TotalEvtLengthCntr24q <= "000";
1129 SFP_blk_cntr <= (others => (others => '0'));
1130 SFP_evt_cntr <= (others => (others => '0'));
1131 SFP_word_cntr <= (others => (others => '0'));
1133 for i in 0 to 2 loop
1134 if(EVENTdata_in(i)(64) = '1' and EVENTdata_we(i) = '1')then
1136 elsif(evt_data_rdy(i) = '1' and wport_rdy(i) = '1' and AddrBuf_full(i) = '0')then
1139 EventData_re_i(i) <= evt_data_rdy(i) and wport_rdy(i) and not ReadBusy(i) and not AddrBuf_full(i);
1140 if(EventData_re_i(i) = '1')then
1141 EventData_reCntr(i) <= EventData_reCntr(i) + 1;
1143 if(EventData_we(i) = '1')then
1144 EventData_weCntr(i) <= EventData_weCntr(i) + 1;
1146 if(EventData_in(i)(66) = '0')then
1147 EventBufAddr_we_i(i) <= evt_data_rdy(i) and wport_rdy(i) and not ReadBusy(i) and not AddrBuf_full(i);
1149 EventBufAddr_we_i(i) <= '0';
1151 if(EventBufAddr_we_i(i) = '1')then
1152 EventBufAddr_weCntr(i) <= EventBufAddr_weCntr(i) + 1;
1154 if(EventData_we(i) = '1')then
1155 if(EventData_in(i)(65) = '1')then
1156 EvtLengthCntr(i) <= x"000001";
1157 TotalEvtLengthCntr(i)(24 downto 0) <= TotalEvtLengthCntr(i)(24 downto 0) + ('0' & EventData_in(i)(55 downto 32));
1159 EvtLengthCntr(i) <= EvtLengthCntr(i) + 1;
1162 TotalEvtLengthCntr24q(i) <= TotalEvtLengthCntr(i)(24);
1163 if(TotalEvtLengthCntr24q(i) = '1' and TotalEvtLengthCntr(i)(24) = '0')then
1164 TotalEvtLengthCntr(i)(55 downto 25) <= TotalEvtLengthCntr(i)(55 downto 25) + 1;
1167 if(MonBufOverWrite = '1' and Written_MonBuf(3)(10) = '1')then
1170 for j in 0 to 1 loop
1171 for i in 0 to 2 loop
1172 if(FirstBlkAddr_re(j)(i) = '1')then
1173 FirstBlkAddr_ra(j)(i) <= FirstBlkAddr_ra(j)(i) + 1;
1175 if(FirstBlkAddr_ra(j)(i) = FirstBlkAddr_wa)then
1176 FirstBlkAddrDoValid(j)(i) <= '0';
1178 FirstBlkAddrDoValid(j)(i) <= '1';
1182 if(FirstBlkAddr_we = '1')then
1183 FirstBlkAddr_wa <= FirstBlkAddr_wa + 1;
1185 for i in 0 to 2 loop
1186 if(WrtMonEvtDone(i) = '1' and enTCPIP = "000")then
1187 WrtMonEvtDone_l(i) <= '1';
1188 elsif(FirstBlkAddrDoValid(0)(i) = '1')then
1189 WrtMonEvtDone_l(i) <= '0';
1191 FirstBlkAddr_re(0)(i) <= FirstBlkAddrDoValid(0)(i) and WrtMonEvtDone_l(i);
1192 if(EventData_we(i) = '1' and EventData_in(i)(66 downto 65) = "01" and enTCPIP = "000")then
1193 MonEvtQueued(i) <= '1';
1194 elsif(FirstBlkAddrDoValid(1)(i) = '1')then
1195 MonEvtQueued(i) <= '0';
1197 FirstBlkAddr_re(1)(i) <= FirstBlkAddrDoValid(1)(i) and MonEvtQueued(i);
1199 FirstBlkAddr_we <= buf_rqst(3) and buf_rqst(0) and not or_reduce(enTCPIP);
1200 if(buf_rqst(0) = '1')then
1201 MonBuf_wa <= MonBuf_wa + 1;
1203 MonBufUsed <= MonBuf_wa(9 downto 0) - MonBuf_ra(9 downto 0);
1204 if(ReleaseMonBuf = '1' or (MonBufOverWrite = '1' and StopOverWrite = '0' and and_reduce(MonBufUsed) = '1' and buf_rqst(0) = '1'))then
1205 MonBuf_ra <= MonBuf_ra + 1;
1207 if(Written_MonBuf(0) = Written_MonBuf(3) and WrtMonEvtDone_l(0) = '0')then
1208 Written_MonBufMatch(0) <= '1';
1210 Written_MonBufMatch(0) <= '0';
1212 if((EnSFP(2 downto 0) = "111" or EnSFP(2 downto 0) = "011" or EnSFP(2 downto 0) = "110" or EnSFP(2 downto 0) = "101") and Written_MonBuf(1) = Written_MonBuf(3) and WrtMonEvtDone_l(1) = '0')then
1213 Written_MonBufMatch(1) <= '1';
1215 Written_MonBufMatch(1) <= '0';
1217 if(EnSFP(2 downto 0) = "111" and Written_MonBuf(2) = Written_MonBuf(3) and WrtMonEvtDone_l(2) = '0')then
1218 Written_MonBufMatch(2) <= '1';
1220 Written_MonBufMatch(2) <= '0';
1222 if(Written_MonBufMatch = "000" and sysDIV2 = '0')then
1223 Written_MonBuf(3) <= Written_MonBuf(3) + 1;
1225 UNA_MonBufSyncRegs <= UNA_MonBufSyncRegs(2 downto 0) & UNA_MonBuf(4)(0);
1226 UNA_TCPBufSyncRegs <= UNA_TCPBufSyncRegs(2 downto 0) & UNA_TCPBuf(3)(0);
1227 ReleaseMonBuf <= UNA_MonBufSyncRegs(3) xor UNA_MonBufSyncRegs(2);
1228 ReleaseTCPBuf <= UNA_TCPBufSyncRegs(3) xor UNA_TCPBufSyncRegs(2);
1229 for i in 0 to 2 loop
1230 if(FirstBlkAddr_re(0)(i) = '1')then
1231 Written_MonBuf(i) <= FirstBlkAddrDo(0)(i)(10 downto 0);
1232 elsif(WrtMonBlkDone(i) = '1')then
1233 Written_MonBuf(i) <= Written_MonBuf(i) + 1;
1235 if(FirstBlkAddr_re(1)(i) = '1')then
1236 NXT_MonBuf(i) <= FirstBlkAddrDo(1)(i)(10 downto 0);
1237 elsif(EventBufAddr_we_i(i) = '1' and EventData_in(i)(66) = '0')then
1238 NXT_MonBuf(i) <= NXT_MonBuf(i) + 1;
1240 if(EventBufAddr_we_i(i) = '1' and EventData_in(i)(66) = '1')then
1241 NXT_TCPBuf(i) <= NXT_TCPBuf(i) + 1;
1243 if(SFP_we(i) = '1' and EoB(i) = '1')then
1244 SFP_blk_cntr(i) <= SFP_blk_cntr(i) + 1;
1246 if(SFP_we(i) = '1' and EoE(i) = '1')then
1247 SFP_evt_cntr(i) <= SFP_evt_cntr(i) + 1;
1249 if(SFP_we(i) = '1')then
1250 SFP_word_cntr(i) <= SFP_word_cntr(i) + 1;
1254 for i in 0 to 2 loop
1255 if(EventData_in(i)(66) = '0')then
1256 EventBufAddr_i(i) <= NXT_MonBuf(i)(9 downto 0) & AddrOffset(i)(9 downto 6);
1258 EventBufAddr_i(i) <= NXT_TCPBuf(i)(9 downto 0) & AddrOffset(i)(9 downto 6);
1263 process(ClientClk2X)
1265 if(ClientClk2X'event and ClientClk2X = '1')then
1266 if(ClientClk2XresetSyncRegs(2) = '1')then
1267 inc_ddr_paSyncRegs <= (others => '0');
1268 UNA_MonBufMatch <= (others => '1');
1269 UNA_TCPBufMatch <= (others => '1');
1270 UNA_MonBuf(4) <= (others => '0');
1271 UNA_MonBuf(3) <= (others => '0');
1272 UNA_TCPBuf(3) <= (others => '0');
1274 inc_ddr_paSyncRegs <= inc_ddr_paSyncRegs(2 downto 0) & inc_ddr_pa;
1275 if(inc_ddr_paSyncRegs(3 downto 2) = "10")then
1276 UNA_MonBuf(3) <= UNA_MonBuf(3) + 1;
1278 for i in 0 to 2 loop
1279 if(enTCPIP(i) = '1' and UNA_MonBuf(i) = UNA_MonBuf(4))then
1280 UNA_MonBufMatch(i) <= '1';
1282 UNA_MonBufMatch(i) <= '0';
1284 if(enTCPIP(i) = '1' and UNA_TCPBuf(i) = UNA_TCPBuf(3))then
1285 UNA_TCPBufMatch(i) <= '1';
1287 UNA_TCPBufMatch(i) <= '0';
1290 if(EnTCPIP = "000" and UNA_MonBuf(3) = UNA_MonBuf(4))then
1291 UNA_MonBufMatch(3) <= '1';
1293 UNA_MonBufMatch(3) <= '0';
1295 if(UNA_MonBufMatch = x"0" and us_cntr(0) = '1')then
1296 UNA_MonBuf(4) <= UNA_MonBuf(4) + 1;
1298 if(UNA_TCPBufMatch = "000" and enSFP(2 downto 0) /= "000" and us_cntr(0) = '1')then
1299 UNA_TCPBuf(3) <= UNA_TCPBuf(3) + 1;
1302 case EnSFP(2 downto 0) is
1303 when "011" | "101" | "110" => AddrOffset(0)(9 downto 6) <= x"8";
1304 when "111" => AddrOffset(0)(9 downto 6) <= x"5";
1305 when others => AddrOffset(0)(9 downto 6) <= x"0";
1307 AddrOffset(1)(9 downto 6) <= x"0";
1308 AddrOffset(2)(9 downto 6) <= x"a";
1309 if(EnSFP(3) = '0' and or_reduce(EnSFP(2 downto 0)) = '1')then
1314 if(EnSFP(3) = '0' and (EnSFP(2 downto 0) = "011" or EnSFP(2 downto 0) = "101" or EnSFP(2 downto 0) = "110" or EnSFP(2 downto 0) = "111"))then
1319 if(EnSFP = x"7")then
1326 process(sysclk,rstCntr)
1328 if(rstCntr = '1')then
1329 EvtLength_errCntr <= (others => (others => '0'));
1330 AMCLength_errCntr <= (others => (others => '0'));
1331 AMCvalid_errCntr <= (others => (others => '0'));
1332 AMCcrc_errCntr <= (others => (others => '0'));
1333 elsif(sysclk'event and sysclk = '1')then
1334 for i in 0 to 2 loop
1335 if(inc_err(i)(1) = '1')then
1336 EvtLength_errCntr(i) <= EvtLength_errCntr(i) + 1;
1338 if(inc_err(i)(2) = '1')then
1339 AMClength_errCntr(i) <= AMClength_errCntr(i) + 1;
1341 if(inc_err(i)(3) = '1')then
1342 AMCvalid_errCntr(i) <= AMCvalid_errCntr(i) + 1;
1344 if(inc_err(i)(4) = '1')then
1345 AMCcrc_errCntr(i) <= AMCcrc_errCntr(i) + 1;
1352 reset => resetSyncRegs
(2),
1354 cmsCRC_err => "
000",
1355 EventData_in => EventData_in,
1356 EventData_we => EventData_we,
1360 process(sysclk,rstCntr)
1362 if(rstCntr = '1')then
1363 StopOverWrite <= '0';
1364 elsif(StopOnCMScrc_err = '1')then
1365 StopOverWrite <= '1';
1366 elsif(sysclk'event and sysclk = '1')then
1368 StopOverWrite <= '1';
1373 reset => resetSyncRegs
(2),
1375 fifo_rst => fifo_rst,
1380 if(sysclk'event and sysclk = '1')then
1381 for i in 0 to 2 loop
1382 if(resetSyncRegs(2) = '1' or EventBufAddr_we_i(i) = '1')then
1383 evt_FIFO_di(i)(65) <= '1';
1384 elsif(evt_FIFO_we(i) = '1')then
1385 evt_FIFO_di(i)(65) <= '0';
1390 g_evt_FIFO: for i in 0 to 2 generate
1391 i_evt_fifo : FIFO_DUALCLOCK_MACRO
1393 DEVICE =>
"7SERIES",
-- Target Device: "VIRTEX5",
"VIRTEX6",
"7SERIES"
1394 ALMOST_FULL_OFFSET => X"0004",
-- Sets almost full threshold
1395 ALMOST_EMPTY_OFFSET => X"0080",
-- Sets the almost empty threshold
1396 DATA_WIDTH =>
67,
-- Valid values are 1-72 (37-72 only valid when FIFO_SIZE="36Kb")
1397 FIFO_SIZE =>
"36Kb",
-- Target BRAM, "18Kb" or "36Kb"
1398 FIRST_WORD_FALL_THROUGH => TRUE
) -- Sets the FIFO FWFT to TRUE or FALSE
1400 ALMOSTEMPTY =>
open,
-- 1-bit output almost empty
1401 ALMOSTFULL => evt_FIFO_full
(i
),
-- 1-bit output almost full
1402 DO => evt_FIFO_do
(i
),
-- Output data, width defined by DATA_WIDTH parameter
1403 EMPTY => evt_FIFO_empty
(i
),
-- 1-bit output empty
1404 FULL =>
open,
-- 1-bit output full
1405 RDCOUNT => evt_FIFO_RDCOUNT
(i
),
-- Output read count, width determined by FIFO depth
1406 RDERR =>
open,
-- 1-bit output read error
1407 WRCOUNT => evt_FIFO_WRCOUNT
(i
),
-- Output write count, width determined by FIFO depth
1408 WRERR =>
open,
-- 1-bit output write error
1409 DI => evt_FIFO_di
(i
),
-- Input data, width defined by DATA_WIDTH parameter
1410 RDCLK => ClientClk2X,
-- 1-bit input read clock
1411 RDEN => evt_FIFO_re
(i
),
-- 1-bit input read enable
1412 RST => fifo_rst,
-- 1-bit input reset
1413 WRCLK => sysclk,
-- 1-bit input write clock
1414 WREN => evt_FIFO_we
(i
) -- 1-bit input write enable
1417 evt_FIFO_di(0)(64 downto 0) <= EVENTdata_in(0)(64 downto 0);
1418 evt_FIFO_di(1)(64 downto 0) <= EVENTdata_in(1)(64 downto 0);
1419 evt_FIFO_di(2)(64 downto 0) <= EVENTdata_in(2)(64 downto 0);
1420 evt_FIFO_di(0)(66) <= EVENTdata_in(0)(65);
1421 evt_FIFO_di(1)(66) <= EVENTdata_in(1)(65);
1422 evt_FIFO_di(2)(66) <= EVENTdata_in(2)(65);
1423 evt_FIFO_we <= "000" when EnSFP(3) = '1' or fifo_en = '0' else EVENTdata_we;
1424 evt_FIFO_re <= "000" when fifo_en = '0' else evt_FIFO_rep;
1425 EVENTdata_avl <= not evt_FIFO_empty;
1426 g_cmsCRC : for i in 0 to 2 generate
1430 crc_init => cmsCRC_init
(i
),
1431 trailer => evt_FIFO_do
(i
)(66),
1432 crc_d => evt_FIFO_do
(i
)(63 downto 0),
1433 crc_ce => cmsCRC_ce
(i
),
1435 crc_err => cmsCRC_err
(i
),
1440 cmsCRC_ce <= evt_FIFO_rep and EVENTdata_avl;
1441 process(ClientClk2X)
1443 if(ClientClk2X'event and ClientClk2X = '1')then
1444 if(ClientClk2XresetSyncRegs(2) = '1')then
1445 cmsCRC_initp <= "000";
1446 cmsCRC_init <= "111";
1447 cmsCRC_errCntr <= (others => (others => '0'));
1448 StopOnCMScrc_err <= '0';
1450 for i in 0 to 2 loop
1451 cmsCRC_initp(i) <= evt_FIFO_do(i)(66) and cmsCRC_ce(i);
1452 if(cmsCRC_err(i) = '1' and cmsCRC_init(i) = '1')then
1453 cmsCRC_errCntr(i) <= cmsCRC_errCntr(i) + 1;
1456 cmsCRC_init <= cmsCRC_initp;
1457 if(en_stop(0) = '1' and or_reduce(cmsCRC_err and cmsCRC_init) = '1')then
1458 StopOnCMScrc_err <= '1';
1460 StopOnCMScrc_err <= '0';
1465 g_TCPIP: for i in 0 to 2 generate
1466 i_TCPIP:
TCPIP PORT MAP(
1467 reset => reset_TCPIP
(i
),
1470 clk2x => ClientClk2X,
1472 strobe_us => strobe_us,
1473 strobe_ms => strobe_ms,
1474 en_LINK => enTCPIP
(i
),
1475 LINK_down => LINK_down
(i
),
1478 MY_ETH => MACADDR
(i
),
1480 -- CWND_max => CWND_max,
1482 rate_limit => rate_limit
(i
),
1483 EVENTdata => evt_FIFO_do
(i
),
1484 EVENTdata_avl => EVENTdata_avl
(i
),
1485 EVENTdata_re => evt_FIFO_rep
(i
),
1486 DDR2TCPdata => DDR2TCPdata,
1487 RETXdata_chksum => RETXdata_checksum
(i
),
1488 RETXdata_we => RETXdata_we
(i
),
1489 RETX_ddr_out => RETX_ddr_out
(i
),
1490 re_RETX_ddr_wq => re_RETX_ddr_wq
(i
),
1491 RETX_ddr_wrqst => RETX_ddr_wrqst
(i
),
1492 RETX_ddr_data_we => RETX_ddr_data_we
(i
),
1493 RETX_ddr_rrqst => RETX_ddr_rrqst
(i
),
1494 RETX_ddr_LEN_max => RETX_ddr_LEN_max
(i
),
1495 RETX_ddr_LEN => RETX_ddr_LEN
(i
),
1496 RETXdataACK => RETXdataACK
(i
),
1497 RETXdataRqst => RETXdataRqst
(i
),
1498 RETXdataAddr => RETXdataAddr
(i
),
1499 RETXdataLEN => RETXdataLEN
(i
),
1500 KiloByte_toggle => KiloByte_toggle
(i
),
1501 EoB_toggle => EoB_toggle
(i
),
1502 TCP_wcount => TCP_wcount
(i
),
1503 EventBufAddr => EventBufAddr_i
(i
),
1504 EventBufAddr_we => EventBufAddr_we_i
(i
),
1505 AddrBuf_full => AddrBuf_full
(i
),
1506 UNA_MonBuf => UNA_MonBuf
(i
),
1507 UNA_TCPBuf => UNA_TCPBuf
(i
),
1508 EmacPhyTxC => EmacPhyTxc
(i
),
1509 EmacPhyTxD => EmacPhyTxd
(i
),
1510 PhyEmacRxC => PhyEmacRxC
(i
),
1511 PhyEmacRxD => PhyEmacRxD
(i
),
1512 ipb_addr => ipb_addr,
1513 ipb_rdata => TCPIP_rdata
(i
),
1514 cs_out => TCPIP_cs
(i
)
1519 r => rst_RETXdata_chksum,
1520 ce => TCP_din_valid,
1522 s => RETXdata_chksum_out
1524 process(ClientClk2X)
1526 if(ClientClk2X'event and ClientClk2X = '1')then
1527 if(TCP_lastword = '1' and TCP_din_valid = '1' and TCP_din_type = "100")then
1528 ld_RETXdata_chksum(0) <= '1';
1530 ld_RETXdata_chksum(0) <= '0';
1532 if(TCP_lastword = '1' and TCP_din_valid = '1' and TCP_din_type = "101")then
1533 ld_RETXdata_chksum(1) <= '1';
1535 ld_RETXdata_chksum(1) <= '0';
1537 if(TCP_lastword = '1' and TCP_din_valid = '1' and TCP_din_type = "110")then
1538 ld_RETXdata_chksum(2) <= '1';
1540 ld_RETXdata_chksum(2) <= '0';
1542 ld_RETXdata_chksum_r <= ld_RETXdata_chksum;
1543 ld_RETXdata_chksum_r2 <= ld_RETXdata_chksum_r;
1544 if(ld_RETXdata_chksum_r2(0) = '1')then
1545 RETXdata_checksum(0) <= RETXdata_chksum_out;
1547 if(ld_RETXdata_chksum_r2(1) = '1')then
1548 RETXdata_checksum(1) <= RETXdata_chksum_out;
1550 if(ld_RETXdata_chksum_r2(2) = '1')then
1551 RETXdata_checksum(2) <= RETXdata_chksum_out;
1553 if(ClientClk2XresetSyncRegs(2) = '1')then
1554 rst_RETXdata_chksum <= '1';
1556 rst_RETXdata_chksum <= TCP_lastword and TCP_din_valid;
1558 DDR2TCPdata <= TCP_lastword & TCP_din;
1559 if(FIFO_en = '1' and TCP_din_valid = '1' and TCP_din_type = "000")then
1560 RETX_ddr_data_we(0) <= '1';
1562 RETX_ddr_data_we(0) <= '0';
1564 if(FIFO_en = '1' and TCP_din_valid = '1' and TCP_din_type = "001")then
1565 RETX_ddr_data_we(1) <= '1';
1567 RETX_ddr_data_we(1) <= '0';
1569 if(FIFO_en = '1' and TCP_din_valid = '1' and TCP_din_type = "010")then
1570 RETX_ddr_data_we(2) <= '1';
1572 RETX_ddr_data_we(2) <= '0';
1574 rst_odd <= TCP_lastword and TCP_din_valid;
1575 if(ClientClk2XresetSyncRegs(2) = '1' or rst_odd = '1')then
1577 elsif(TCP_din_valid = '1')then
1580 if(TCP_din_valid = '1' and TCP_din_type = "100")then
1581 RETXdata_we(0) <= odd & not odd;
1583 RETXdata_we(0) <= "00";
1585 if(TCP_din_valid = '1' and TCP_din_type = "101")then
1586 RETXdata_we(1) <= odd & not odd;
1588 RETXdata_we(1) <= "00";
1590 if(TCP_din_valid = '1' and TCP_din_type = "110")then
1591 RETXdata_we(2) <= odd & not odd;
1593 RETXdata_we(2) <= "00";
1595 if(RETX_ddr_rp_rst = '1')then
1596 RETX_ddr_rp_di <= (others => '0');
1597 RETX_ddr_rp_we <= '1';
1599 RETX_ddr_rp_di(16 downto 0) <= RETX_ddr_rp_do(16 downto 0) + TCP_length_i(20 downto 4);
1600 RETX_ddr_rp_we <= TCP_rack and not TCP_raddr_i(28);
1602 if(ClientClk2XresetSyncRegs(2) = '1')then
1603 ReTx_ddr_LEN_max <= (others => "10000");
1604 elsif(RETX_ddr_rp_we = '1')then
1605 if(and_reduce(RETX_ddr_rp_di(8 downto 4)) = '0')then -- ReTx_ddr_LEN_max insures the readout does not go into event data area
1606 ReTx_ddr_LEN_max(conv_integer(RETX_ddr_rp_a)) <= "10000";
1608 ReTx_ddr_LEN_max(conv_integer(RETX_ddr_rp_a)) <= "10000" - ('0' & RETX_ddr_rp_di(3 downto 0));
1611 if(ClientClk2XresetSyncRegs(2) = '1')then
1612 RETX_ddr_rp_rst <= '1';
1613 RETX_ddr_rp_a <= (others => '0');
1614 TCP_rrqst_i <= "000";
1615 rrqstMask <= (others => '1');
1617 if(RETX_ddr_rp_a(1) = '1')then
1618 RETX_ddr_rp_rst <= '0';
1620 if(RETX_ddr_rp_rst = '1')then
1621 RETX_ddr_rp_a(1 downto 0) <= RETX_ddr_rp_a(1 downto 0) + 1;
1622 elsif(TCP_rrqst_i(0) = '0')then
1623 if(or_reduce(rrqstMask(5 downto 3) and RETXdataRqst) = '1')then
1624 RETX_ddr_rp_a(1 downto 0) <= "11";
1625 elsif(rrqstMask(0) = '1' and RETX_ddr_rrqst(0) = '1')then
1626 RETX_ddr_rp_a(1 downto 0) <= "00";
1627 elsif(rrqstMask(1) = '1' and RETX_ddr_rrqst(1) = '1')then
1628 RETX_ddr_rp_a(1 downto 0) <= "01";
1630 RETX_ddr_rp_a(1 downto 0) <= "10";
1633 if(TCP_rack = '1')then
1634 TCP_rrqst_i <= "000";
1636 if(or_reduce(rrqstMask(2 downto 0) and RETX_ddr_rrqst) = '1' or or_reduce(rrqstMask(5 downto 3) and RETXdataRqst) = '1')then
1637 TCP_rrqst_i(0) <= '1';
1639 TCP_rrqst_i(2 downto 1) <= TCP_rrqst_i(1 downto 0);
1641 for i in 0 to 2 loop
1642 if(TCP_rrqst_i(0) = '1' and TCP_raddr_i(28) = '0' and i = conv_integer(TCP_raddr_i(27 downto 26)))then
1643 rrqstMask(i) <= '0';
1644 elsif(rst_RETXdata_chksum = '1' and TCP_din_type(2) = '0' and i = conv_integer(TCP_din_type(1 downto 0)))then
1645 rrqstMask(i) <= '1';
1647 if(TCP_rrqst_i(0) = '1' and TCP_raddr_i(28) = '1' and i = conv_integer(TCP_raddr_i(27 downto 26)))then
1648 rrqstMask(i+3) <= '0';
1649 elsif(rst_RETXdata_chksum = '1' and TCP_din_type(2) = '1' and i = conv_integer(TCP_din_type(1 downto 0)))then
1650 rrqstMask(i+3) <= '1';
1654 if(TCP_rrqst_i(0) = '0')then
1655 RETXdataAck <= (others => '0');
1656 elsif(TCP_raddr_i(28) = '1')then
1657 case TCP_raddr_i(27 downto 26) is
1658 when "00" => RETXdataAck <= "001";
1659 when "01" => RETXdataAck <= "010";
1660 when "10" => RETXdataAck <= "100";
1661 when others => RETXdataAck <= "000";
1664 if(TCP_rrqst_i(0) = '0')then
1665 if(or_reduce(rrqstMask(5 downto 3) and RETXdataRqst) = '1')then
1666 TCP_raddr_i(28) <= '1';
1667 if(rrqstMask(3) = '1' and RETXdataRqst(0) = '1')then
1668 TCP_raddr_i(27 downto 26) <= "00";
1669 elsif(rrqstMask(4) = '1' and RETXdataRqst(1) = '1')then
1670 TCP_raddr_i(27 downto 26) <= "01";
1672 TCP_raddr_i(27 downto 26) <= "10";
1675 TCP_raddr_i(28) <= '0';
1676 if(rrqstMask(0) = '1' and RETX_ddr_rrqst(0) = '1')then
1677 TCP_raddr_i(27 downto 26) <= "00";
1678 elsif(rrqstMask(1) = '1' and RETX_ddr_rrqst(1) = '1')then
1679 TCP_raddr_i(27 downto 26) <= "01";
1681 TCP_raddr_i(27 downto 26) <= "10";
1685 case TCP_raddr_i(28 downto 26) is
1686 when "100" => TCP_raddr_i(25 downto 0) <= RETXdataAddr(0);
1687 when "101" => TCP_raddr_i(25 downto 0) <= RETXdataAddr(1);
1688 when "110" => TCP_raddr_i(25 downto 0) <= RETXdataAddr(2);
1689 when others => TCP_raddr_i(25 downto 0) <= TCP_raddr_i(27 downto 26)(1 downto 0) & RETX_ddr_rp_do(16 downto 9) & x"f" & RETX_ddr_rp_do(8 downto 0) & "000";
1691 TCP_rlength <= TCP_length_i(13 downto 1) - 1;
1692 case TCP_raddr_i(28 downto 26) is
1693 when "000" => TCP_length_i(13 downto 0) <= "00000" & RETX_ddr_LEN(0) & x"0";
1694 when "001" => TCP_length_i(13 downto 0) <= "00000" & RETX_ddr_LEN(1) & x"0";
1695 when "010" => TCP_length_i(13 downto 0) <= "00000" & RETX_ddr_LEN(2) & x"0";
1696 when "100" => TCP_length_i(13 downto 0) <= RETXdataLEN(0) & '0';
1697 when "101" => TCP_length_i(13 downto 0) <= RETXdataLEN(1) & '0';
1698 when "110" => TCP_length_i(13 downto 0) <= RETXdataLEN(2) & '0';
1699 when others => TCP_length_i(13 downto 0) <= (others => '0');
1703 g_RETX_ddr_rp : for i in 0 to 2 generate
1705 wclk => ClientClk2X,
1706 di => RETX_ddr_rp_di
(i*6+5
downto i*6
),
1707 we => RETX_ddr_rp_we ,
1708 wa => RETX_ddr_rp_a,
1709 ra => RETX_ddr_rp_a,
1710 do => RETX_ddr_rp_do
(i*6+5
downto i*6
)
1713 TCP_we <= TCP_wFIFO_we;
1714 i_TCP_wFIFO_we : SRL16E
1716 Q => TCP_wFIFO_we,
-- SRL data output
1717 A0 => '0',
-- Select[0] input
1718 A1 => '1',
-- Select[1] input
1719 A2 => '0',
-- Select[2] input
1720 A3 => '0',
-- Select[3] input
1721 CE => '1',
-- Clock enable input
1722 CLK => ClientClk2X,
-- Clock input
1723 D => TCP_w_busy
-- SRL data input
1725 TCP_channel <= TCP_wFIFO_DI(33 downto 32);
1726 TCP_dout <= TCP_wFIFO_DI(31 downto 0);
1727 process(ClientClk2X, TCP_w_sel, RETX_ddr_wrqst)
1728 variable s : (4 downto 0);
1730 s := TCP_w_sel & RETX_ddr_wrqst;
1731 if(ClientClk2X'event and ClientClk2X = '1')then
1732 if(FIFO_en = '0' or ClientClk2XresetSyncRegs(2) = '1')then
1734 elsif(TCP_w_busy = '0')then
1736 when "00001" | "01001" | "01011" | "10001" | "10011" | "10101" | "10111" =>
1738 when "00010" | "00011" | "00110" | "00111" | "01010" | "10010" | "10110" =>
1740 when "00100" | "00101" | "01100" | "01101" | "01110" | "01111" | "10100" =>
1742 when others => null;
1745 if(FIFO_en = '0' or ClientClk2XresetSyncRegs(2) = '1')then
1747 elsif(TCP_w_wc = x"f")then
1749 elsif(RETX_ddr_wrqst /= "000")then
1752 if(ClientClk2XresetSyncRegs(2) = '1')then
1754 elsif(TCP_w_busy = '1')then
1755 TCP_w_wc <= TCP_w_wc + 1;
1757 if(FIFO_en = '0' or ClientClk2XresetSyncRegs(2) = '1')then
1758 re_RETX_ddr_wq <= "000";
1761 when "00" => re_RETX_ddr_wq(0) <= TCP_w_busy;
1762 when "01" => re_RETX_ddr_wq(1) <= TCP_w_busy;
1763 when others => re_RETX_ddr_wq(2) <= TCP_w_busy;
1767 when "00" => TCP_wFIFO_DI <= "00" & RETX_ddr_out(0);
1768 when "01" => TCP_wFIFO_DI <= "01" & RETX_ddr_out(1);
1769 when others => TCP_wFIFO_DI <= "10" & RETX_ddr_out(2);
1773 process(ClientClk2X)
1775 if(ClientClk2X'event and ClientClk2X = '1')then
1776 case EnSFP(2 downto 0) is
1777 when "010" | "011" | "101" | "111" => TCPIP2SFP_sel(0) <= "01";
1778 when "100" | "110" => TCPIP2SFP_sel(0) <= "10";
1779 when others => TCPIP2SFP_sel(0) <= "00";
1781 case EnSFP(2 downto 0) is
1782 when "010" | "011" | "111" => TCPIP2SFP_sel(1) <= "00";
1783 when "101" => TCPIP2SFP_sel(1) <= "10";
1784 when others => TCPIP2SFP_sel(1) <= "01";
1786 case EnSFP(2 downto 0) is
1787 when "100" | "101" | "110" => TCPIP2SFP_sel(2) <= "00";
1788 when others => TCPIP2SFP_sel(2) <= "10";
1790 for i in 0 to 1 loop
1791 SFP_EmacPhyTxc(i) <= EmacPhyTxc(conv_integer(TCPIP2SFP_sel(i)));
1792 SFP_EmacPhyTxD(i) <= EmacPhyTxD(conv_integer(TCPIP2SFP_sel(i)));
1793 SFP_down_i(i) <= LINK_down(conv_integer(TCPIP2SFP_sel(i)));
1795 if(TCPIP2SFP_sel(2)(1) = '0')then
1796 SFP_EmacPhyTxc(2) <= EmacPhyTxc(0);
1797 SFP_EmacPhyTxD(2) <= EmacPhyTxD(0);
1798 SFP_down_i(2) <= LINK_down(0);
1800 SFP_EmacPhyTxc(2) <= EmacPhyTxc(2);
1801 SFP_EmacPhyTxD(2) <= EmacPhyTxD(2);
1802 SFP_down_i(2) <= LINK_down(2);
1804 case EnSFP(2 downto 0) is
1805 when "010" | "011" | "111" => SFP2TCPIP(0) <= "01";
1806 when "100" | "101" | "110" => SFP2TCPIP(0) <= "10";
1807 when others => SFP2TCPIP(0) <= "00";
1809 case EnSFP(2 downto 0) is
1810 when "010" | "011" | "101" | "111" => SFP2TCPIP(1) <= "00";
1811 when others => SFP2TCPIP(1) <= "01";
1813 case EnSFP(2 downto 0) is
1814 when "100" | "110" => SFP2TCPIP(2) <= "00";
1815 when "101" => SFP2TCPIP(2) <= "01";
1816 when others => SFP2TCPIP(2) <= "10";
1818 -- if(SFP_PhyEmacRxc(0) = x"1"
and SFP_PhyEmacRxd(
0) = x"555555fb")
then
1819 -- Rx_start_cntr(15 downto 0) <= Rx_start_cntr(
15 downto 0) +
1;
1821 -- if(SFP_PhyEmacRxc(1) = x"1"
and SFP_PhyEmacRxd(
1) = x"555555fb")
then
1822 -- Rx_start_cntr(31 downto 16) <= Rx_start_cntr(
31 downto 16) +
1;
1824 PhyEmacRxc(0) <= SFP_PhyEmacRxc(conv_integer(SFP2TCPIP(0)));
1825 PhyEmacRxD(0) <= SFP_PhyEmacRxD(conv_integer(SFP2TCPIP(0)));
1826 if(SFP2TCPIP(1)(0) = '0')then
1827 PhyEmacRxc(1) <= SFP_PhyEmacRxc(0);
1828 PhyEmacRxD(1) <= SFP_PhyEmacRxD(0);
1830 PhyEmacRxc(1) <= SFP_PhyEmacRxc(1);
1831 PhyEmacRxD(1) <= SFP_PhyEmacRxD(1);
1833 PhyEmacRxc(2) <= SFP_PhyEmacRxc(conv_integer(SFP2TCPIP(2)));
1834 PhyEmacRxD(2) <= SFP_PhyEmacRxD(conv_integer(SFP2TCPIP(2)));
1835 IPADDR(0) <= SFP_IPADDR(conv_integer(SFP2TCPIP(0)));
1836 IPADDR(1) <= SFP_IPADDR(conv_integer(SFP2TCPIP(1)));
1837 IPADDR(2) <= SFP_IPADDR(conv_integer(SFP2TCPIP(2)));
1838 rate_limit(0) <= SFP_rate_limit(conv_integer(SFP2TCPIP(0)));
1839 rate_limit(1) <= SFP_rate_limit(conv_integer(SFP2TCPIP(1)));
1840 rate_limit(2) <= SFP_rate_limit(conv_integer(SFP2TCPIP(2)));
1841 -- MACADDR(0) <= x"00ac1234568" & "
10" & SFP2TCPIP(
0);
1842 -- MACADDR(1) <= x"00ac1234568" & "
100" & SFP2TCPIP(
1)(
0);
1843 -- MACADDR(2) <= x"00ac1234568" & "
10" & SFP2TCPIP(
2);
1844 MACADDR(0) <= x"00ac12345" & not SN & '0' & SFP2TCPIP(0);
1845 MACADDR(1) <= x"00ac12345" & not SN & "00" & SFP2TCPIP(1)(0);
1846 MACADDR(2) <= x"00ac12345" & not SN & '0' & SFP2TCPIP(2);
1847 reset_TCPIP(0) <= SFPresetSyncRegs(conv_integer(SFP2TCPIP(0)))(2);
1848 if(SFP2TCPIP(1)(0) = '0')then
1849 reset_TCPIP(1) <= SFPresetSyncRegs(conv_integer(SFP2TCPIP(0)))(2);
1851 reset_TCPIP(1) <= SFPresetSyncRegs(conv_integer(SFP2TCPIP(1)))(2);
1853 reset_TCPIP(2) <= SFPresetSyncRegs(conv_integer(SFP2TCPIP(2)))(2);
1856 g_XGbEPCS : for i in 0 to 2 generate
1858 reset => TCPresetSyncRegs
(2),
1859 -- reset => PCS_reset(i),
1860 clk2x => ClientClk2X,
1862 TXUSRCLK => txusrclk,
1864 RXUSRCLK => SFP_RXUSRCLK
(i
),
1865 RXRESETDONE => SFP_RXRESETDONE
(i
),
1866 inh_TX => inh_TX
(i
),
1867 RESET_TXSync => reset_TXSyncRegs
(2),
1868 GTX_RXGEARBOXSLIP_OUT => SFP_RXGEARBOXSLIP
(i
),
1869 GTX_TXD => SFP_TXD
(i
),
1870 GTX_TXHEADER => SFP_TXHEADER
(i
),
1871 GTX_TX_PAUSE => GTX_TX_PAUSE,
1872 GTX_RXD => SFP_RXD
(i
),
1873 GTX_RXDVLD => SFP_RXDVLD
(i
),
1874 GTX_RXHEADER => SFP_RXHEADER
(i
),
1875 GTX_RXHEADERVLD => SFP_RXHEADERVLD
(i
),
1876 GTX_RXGOOD => SFP_RXGOOD
(i
),
1877 EmacPhyTxC => SFP_EmacPhyTxc
(i
),
1878 EmacPhyTxD => SFP_EmacPhyTxd
(i
),
1879 PhyEmacRxC => SFP_PhyEmacRxC
(i
),
1880 PhyEmacRxD => SFP_PhyEmacRxD
(i
)
1883 SFP_pd(0) <= "00" when Dis_pd = '1' else "11" when enSFP(3) = '1' or enSFP(0) = '0' else "00";
1884 SFP_pd(1) <= "00" when Dis_pd = '1' else "11" when enSFP(3) = '1' or enSFP(1) = '0' else "00";
1885 SFP_pd(2) <= "00" when Dis_pd = '1' else "11" when enSFP(3) = '1' or enSFP(2) = '0' else "00";
1888 if(DRPclk'event and DRPclk = '1')then
1889 for i in 0 to 2 loop
1890 SFP_pd_q(i) <= SFP_pd_q(i)(2 downto 0) & SFP_pd(i)(0);
1892 if(SFP_pd_q(0)(3 downto 2) = "10" or SFP_pd_q(1)(3 downto 2) = "10" or SFP_pd_q(2)(3 downto 2) = "10")then
1893 reset_cntr <= (others => '0');
1894 elsif(reset_cntr(20) = '0')then
1895 reset_cntr <= reset_cntr + 1;
1897 reset_cntr20_q <= reset_cntr(20);
1898 soft_reset <= not reset_cntr20_q and reset_cntr(20);
1904 SYSCLK_IN => DRPclk,
1905 SOFT_RESET_IN => soft_reset,
1906 DONT_RESET_ON_DATA_ERROR_IN => '0',
1907 GT0_TX_FSM_RESET_DONE_OUT => SFP_TX_FSM_RESET_DONE
(0),
1908 GT0_RX_FSM_RESET_DONE_OUT => SFP_RX_FSM_RESET_DONE
(0),
1909 GT0_DATA_VALID_IN => SFP_RXGOOD
(0),
1910 GT1_TX_FSM_RESET_DONE_OUT => SFP_TX_FSM_RESET_DONE
(1),
1911 GT1_RX_FSM_RESET_DONE_OUT => SFP_RX_FSM_RESET_DONE
(1),
1912 GT1_DATA_VALID_IN => SFP_RXGOOD
(1),
1913 GT2_TX_FSM_RESET_DONE_OUT => SFP_TX_FSM_RESET_DONE
(2),
1914 GT2_RX_FSM_RESET_DONE_OUT => SFP_RX_FSM_RESET_DONE
(2),
1915 GT2_DATA_VALID_IN => SFP_RXGOOD
(2),
1921 --_____________________________________________________________________
1922 --_____________________________________________________________________
1925 ---------------------------- Channel - DRP Ports --------------------------
1926 GT0_DRPADDR_IN => SFP_drpaddr
(0),
1927 GT0_DRPCLK_IN => DRPclk,
1928 GT0_DRPDI_IN => SFP_drpdi
(0),
1929 GT0_DRPDO_OUT => SFP_drpdo
(0),
1930 GT0_DRPEN_IN => SFP_drpen
(0),
1931 GT0_DRPRDY_OUT => SFP_drprdy
(0),
1932 GT0_DRPWE_IN => SFP_drpwe
(0),
1933 ------------------------------- Loopback Ports -----------------------------
1934 GT0_LOOPBACK_IN => SFP_LOOPBACK_IN
(0),
1935 ------------------------------ Power-Down Ports ----------------------------
1936 GT0_RXPD_IN => SFP_pd
(0),
1937 GT0_TXPD_IN => SFP_pd
(0),
1938 --------------------- RX Initialization and Reset Ports --------------------
1939 GT0_RXUSERRDY_IN => SFP_rxuserrdy
(0),
1940 -------------------------- RX Margin Analysis Ports ------------------------
1941 GT0_EYESCANDATAERROR_OUT => SFP_EYESCANDATAERROR_OUT
(0),
1942 ------------------------- Receive Ports - CDR Ports ------------------------
1943 GT0_RXCDRLOCK_OUT =>
open,
1944 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
1945 GT0_RXUSRCLK_IN => SFP_RXUSRCLK
(0),
1946 GT0_RXUSRCLK2_IN => SFP_RXUSRCLK
(0),
1947 ------------------ Receive Ports - FPGA RX interface Ports -----------------
1948 GT0_RXDATA_OUT => SFP_RXD_inv
(0),
1949 ------------------- Receive Ports - Pattern Checker Ports ------------------
1950 GT0_RXPRBSERR_OUT => SFP_RXPRBSERR_OUT
(0),
1951 GT0_RXPRBSSEL_IN => SFP_RXPRBSSEL_IN
(0),
1952 ------------------- Receive Ports - Pattern Checker ports ------------------
1953 GT0_RXPRBSCNTRESET_IN => '0',
1954 --------------------------- Receive Ports - RX AFE -------------------------
1955 GT0_GTXRXP_IN => SFP0_RXP,
1956 ------------------------ Receive Ports - RX AFE Ports ----------------------
1957 GT0_GTXRXN_IN => SFP0_RXN,
1958 ------------------- Receive Ports - RX Buffer Bypass Ports -----------------
1959 GT0_RXBUFRESET_IN => '0',
1960 GT0_RXBUFSTATUS_OUT =>
open,
1961 --------------- Receive Ports - RX Fabric Output Control Ports -------------
1962 GT0_RXOUTCLK_OUT => SFP_rxoutclk
(0),
1963 ---------------------- Receive Ports - RX Gearbox Ports --------------------
1964 GT0_RXDATAVALID_OUT => SFP_RXDVLD
(0),
1965 GT0_RXHEADER_OUT => SFP_RXHEADER
(0),
1966 GT0_RXHEADERVALID_OUT => SFP_RXHEADERVLD
(0),
1967 --------------------- Receive Ports - RX Gearbox Ports --------------------
1968 GT0_RXGEARBOXSLIP_IN => SFP_RXGEARBOXSLIP
(0),
1969 ------------- Receive Ports - RX Initialization and Reset Ports ------------
1970 GT0_GTRXRESET_IN => '0',
1971 GT0_RXPMARESET_IN => '0',
1972 ------------------ Receive Ports - RX Margin Analysis ports ----------------
1973 GT0_RXLPMEN_IN => '0',
1974 -------------- Receive Ports -RX Initialization and Reset Ports ------------
1975 GT0_RXRESETDONE_OUT => SFP_rxresetdone
(0),
1976 --------------------- TX Initialization and Reset Ports --------------------
1977 GT0_GTTXRESET_IN => '0',
1978 GT0_TXUSERRDY_IN => SFP_txuserrdy
(0),
1979 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
1980 GT0_TXUSRCLK_IN => txusrclk,
1981 GT0_TXUSRCLK2_IN => txusrclk,
1982 --------------- Transmit Ports - TX Configurable Driver Ports --------------
1983 GT0_TXDIFFCTRL_IN => "
1110",
1984 GT0_TXINHIBIT_IN => '0',
1985 GT0_TXMAINCURSOR_IN =>
(others => '0'
),
1986 ------------------ Transmit Ports - TX Data Path interface -----------------
1987 GT0_TXDATA_IN => SFP_TXD_inv
(0),
1988 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
1989 GT0_GTXTXN_OUT => SFP0_TXN,
1990 GT0_GTXTXP_OUT => SFP0_TXP,
1991 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
1992 GT0_TXOUTCLK_OUT => SFP_TXOUTCLK
(0),
1993 GT0_TXOUTCLKFABRIC_OUT =>
open,
1994 GT0_TXOUTCLKPCS_OUT =>
open,
1995 --------------------- Transmit Ports - TX Gearbox Ports --------------------
1996 GT0_TXHEADER_IN => SFP_TXHEADER
(0),
1997 GT0_TXSEQUENCE_IN => SFP_TXSEQUENCE
(0),
1998 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
1999 GT0_TXRESETDONE_OUT =>
open,
2000 ------------------ Transmit Ports - pattern Generator Ports ----------------
2001 GT0_TXPRBSSEL_IN => SFP_TXPRBSSEL_IN
(0),
2008 --_____________________________________________________________________
2009 --_____________________________________________________________________
2012 ---------------------------- Channel - DRP Ports --------------------------
2013 GT1_DRPADDR_IN => SFP_drpaddr
(1),
2014 GT1_DRPCLK_IN => DRPclk,
2015 GT1_DRPDI_IN => SFP_drpdi
(1),
2016 GT1_DRPDO_OUT => SFP_drpdo
(1),
2017 GT1_DRPEN_IN => SFP_drpen
(1),
2018 GT1_DRPRDY_OUT => SFP_drprdy
(1),
2019 GT1_DRPWE_IN => SFP_drpwe
(1),
2020 ------------------------------- Loopback Ports -----------------------------
2021 GT1_LOOPBACK_IN => SFP_LOOPBACK_IN
(1),
2022 ------------------------------ Power-Down Ports ----------------------------
2023 GT1_RXPD_IN => SFP_pd
(1),
2024 GT1_TXPD_IN => SFP_pd
(1),
2025 --------------------- RX Initialization and Reset Ports --------------------
2026 GT1_RXUSERRDY_IN => SFP_rxuserrdy
(1),
2027 -------------------------- RX Margin Analysis Ports ------------------------
2028 GT1_EYESCANDATAERROR_OUT => SFP_EYESCANDATAERROR_OUT
(1),
2029 ------------------------- Receive Ports - CDR Ports ------------------------
2030 GT1_RXCDRLOCK_OUT =>
open,
2031 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
2032 GT1_RXUSRCLK_IN => SFP_RXUSRCLK
(1),
2033 GT1_RXUSRCLK2_IN => SFP_RXUSRCLK
(1),
2034 ------------------ Receive Ports - FPGA RX interface Ports -----------------
2035 GT1_RXDATA_OUT => SFP_RXD_inv
(1),
2036 ------------------- Receive Ports - Pattern Checker Ports ------------------
2037 GT1_RXPRBSERR_OUT => SFP_RXPRBSERR_OUT
(1),
2038 GT1_RXPRBSSEL_IN => SFP_RXPRBSSEL_IN
(1),
2039 ------------------- Receive Ports - Pattern Checker ports ------------------
2040 GT1_RXPRBSCNTRESET_IN => '0',
2041 --------------------------- Receive Ports - RX AFE -------------------------
2042 GT1_GTXRXP_IN => SFP1_RXP,
2043 ------------------------ Receive Ports - RX AFE Ports ----------------------
2044 GT1_GTXRXN_IN => SFP1_RXN,
2045 ------------------- Receive Ports - RX Buffer Bypass Ports -----------------
2046 GT1_RXBUFRESET_IN => '0',
2047 GT1_RXBUFSTATUS_OUT =>
open,
2048 --------------- Receive Ports - RX Fabric Output Control Ports -------------
2049 GT1_RXOUTCLK_OUT => SFP_rxoutclk
(1),
2050 ---------------------- Receive Ports - RX Gearbox Ports --------------------
2051 GT1_RXDATAVALID_OUT => SFP_RXDVLD
(1),
2052 GT1_RXHEADER_OUT => SFP_RXHEADER
(1),
2053 GT1_RXHEADERVALID_OUT => SFP_RXHEADERVLD
(1),
2054 --------------------- Receive Ports - RX Gearbox Ports --------------------
2055 GT1_RXGEARBOXSLIP_IN => SFP_RXGEARBOXSLIP
(1),
2056 ------------- Receive Ports - RX Initialization and Reset Ports ------------
2057 GT1_GTRXRESET_IN => '0',
2058 GT1_RXPMARESET_IN => '0',
2059 ------------------ Receive Ports - RX Margin Analysis ports ----------------
2060 GT1_RXLPMEN_IN => '0',
2061 -------------- Receive Ports -RX Initialization and Reset Ports ------------
2062 GT1_RXRESETDONE_OUT => SFP_rxresetdone
(1),
2063 --------------------- TX Initialization and Reset Ports --------------------
2064 GT1_GTTXRESET_IN => '0',
2065 GT1_TXUSERRDY_IN => SFP_txuserrdy
(1),
2066 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
2067 GT1_TXUSRCLK_IN => txusrclk,
2068 GT1_TXUSRCLK2_IN => txusrclk,
2069 --------------- Transmit Ports - TX Configurable Driver Ports --------------
2070 GT1_TXDIFFCTRL_IN => "
1110",
2071 GT1_TXINHIBIT_IN => '0',
2072 GT1_TXMAINCURSOR_IN =>
(others => '0'
),
2073 ------------------ Transmit Ports - TX Data Path interface -----------------
2074 GT1_TXDATA_IN => SFP_TXD_inv
(1),
2075 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
2076 GT1_GTXTXN_OUT => SFP1_TXN,
2077 GT1_GTXTXP_OUT => SFP1_TXP,
2078 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
2079 GT1_TXOUTCLK_OUT =>
open,
2080 GT1_TXOUTCLKFABRIC_OUT =>
open,
2081 GT1_TXOUTCLKPCS_OUT =>
open,
2082 --------------------- Transmit Ports - TX Gearbox Ports --------------------
2083 GT1_TXHEADER_IN => SFP_TXHEADER
(1),
2084 GT1_TXSEQUENCE_IN => SFP_TXSEQUENCE
(1),
2085 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
2086 GT1_TXRESETDONE_OUT =>
open,
2087 ------------------ Transmit Ports - pattern Generator Ports ----------------
2088 GT1_TXPRBSSEL_IN => SFP_TXPRBSSEL_IN
(1),
2091 --_____________________________________________________________________
2092 --_____________________________________________________________________
2095 ---------------------------- Channel - DRP Ports --------------------------
2096 GT2_DRPADDR_IN => SFP_drpaddr
(2),
2097 GT2_DRPCLK_IN => DRPclk,
2098 GT2_DRPDI_IN => SFP_drpdi
(2),
2099 GT2_DRPDO_OUT => SFP_drpdo
(2),
2100 GT2_DRPEN_IN => SFP_drpen
(2),
2101 GT2_DRPRDY_OUT => SFP_drprdy
(2),
2102 GT2_DRPWE_IN => SFP_drpwe
(2),
2103 ------------------------------- Loopback Ports -----------------------------
2104 GT2_LOOPBACK_IN => SFP_LOOPBACK_IN
(2),
2105 ------------------------------ Power-Down Ports ----------------------------
2106 GT2_RXPD_IN => SFP_pd
(2),
2107 GT2_TXPD_IN => SFP_pd
(2),
2108 --------------------- RX Initialization and Reset Ports --------------------
2109 GT2_RXUSERRDY_IN => SFP_rxuserrdy
(2),
2110 -------------------------- RX Margin Analysis Ports ------------------------
2111 GT2_EYESCANDATAERROR_OUT => SFP_EYESCANDATAERROR_OUT
(2),
2112 ------------------------- Receive Ports - CDR Ports ------------------------
2113 GT2_RXCDRLOCK_OUT =>
open,
2114 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
2115 GT2_RXUSRCLK_IN => SFP_RXUSRCLK
(2),
2116 GT2_RXUSRCLK2_IN => SFP_RXUSRCLK
(2),
2117 ------------------ Receive Ports - FPGA RX interface Ports -----------------
2118 GT2_RXDATA_OUT => SFP_RXD_inv
(2),
2119 ------------------- Receive Ports - Pattern Checker Ports ------------------
2120 GT2_RXPRBSERR_OUT => SFP_RXPRBSERR_OUT
(2),
2121 GT2_RXPRBSSEL_IN => SFP_RXPRBSSEL_IN
(2),
2122 ------------------- Receive Ports - Pattern Checker ports ------------------
2123 GT2_RXPRBSCNTRESET_IN => '0',
2124 --------------------------- Receive Ports - RX AFE -------------------------
2125 GT2_GTXRXP_IN => SFP2_RXP,
2126 ------------------------ Receive Ports - RX AFE Ports ----------------------
2127 GT2_GTXRXN_IN => SFP2_RXN,
2128 ------------------- Receive Ports - RX Buffer Bypass Ports -----------------
2129 GT2_RXBUFRESET_IN => '0',
2130 GT2_RXBUFSTATUS_OUT =>
open,
2131 --------------- Receive Ports - RX Fabric Output Control Ports -------------
2132 GT2_RXOUTCLK_OUT => SFP_rxoutclk
(2),
2133 ---------------------- Receive Ports - RX Gearbox Ports --------------------
2134 GT2_RXDATAVALID_OUT => SFP_RXDVLD
(2),
2135 GT2_RXHEADER_OUT => SFP_RXHEADER
(2),
2136 GT2_RXHEADERVALID_OUT => SFP_RXHEADERVLD
(2),
2137 --------------------- Receive Ports - RX Gearbox Ports --------------------
2138 GT2_RXGEARBOXSLIP_IN => SFP_RXGEARBOXSLIP
(2),
2139 ------------- Receive Ports - RX Initialization and Reset Ports ------------
2140 GT2_GTRXRESET_IN => '0',
2141 GT2_RXPMARESET_IN => '0',
2142 ------------------ Receive Ports - RX Margin Analysis ports ----------------
2143 GT2_RXLPMEN_IN => '0',
2144 -------------- Receive Ports -RX Initialization and Reset Ports ------------
2145 GT2_RXRESETDONE_OUT => SFP_rxresetdone
(2),
2146 --------------------- TX Initialization and Reset Ports --------------------
2147 GT2_GTTXRESET_IN => '0',
2148 GT2_TXUSERRDY_IN => SFP_txuserrdy
(2),
2149 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
2150 GT2_TXUSRCLK_IN => txusrclk,
2151 GT2_TXUSRCLK2_IN => txusrclk,
2152 --------------- Transmit Ports - TX Configurable Driver Ports --------------
2153 GT2_TXDIFFCTRL_IN => "
1110",
2154 GT2_TXINHIBIT_IN => '0',
2155 GT2_TXMAINCURSOR_IN =>
(others => '0'
),
2156 ------------------ Transmit Ports - TX Data Path interface -----------------
2157 GT2_TXDATA_IN => SFP_TXD_inv
(2),
2158 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
2159 GT2_GTXTXN_OUT => SFP2_TXN,
2160 GT2_GTXTXP_OUT => SFP2_TXP,
2161 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
2162 GT2_TXOUTCLK_OUT =>
open,
2163 GT2_TXOUTCLKFABRIC_OUT =>
open,
2164 GT2_TXOUTCLKPCS_OUT =>
open,
2165 --------------------- Transmit Ports - TX Gearbox Ports --------------------
2166 GT2_TXHEADER_IN => SFP_TXHEADER
(2),
2167 GT2_TXSEQUENCE_IN => SFP_TXSEQUENCE
(2),
2168 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
2169 GT2_TXRESETDONE_OUT =>
open,
2170 ------------------ Transmit Ports - pattern Generator Ports ----------------
2171 GT2_TXPRBSSEL_IN => SFP_TXPRBSSEL_IN
(2),
2174 --____________________________COMMON PORTS________________________________
2175 ---------------------- Common Block - Ref Clock Ports ---------------------
2176 GT0_GTREFCLK0_COMMON_IN => REFCLK,
2177 ------------------------- Common Block - QPLL Ports ------------------------
2178 GT0_QPLLLOCK_OUT => qplllock,
2179 GT0_QPLLLOCKDETCLK_IN => DRPclk,
2180 GT0_QPLLRESET_IN => qpllreset
2183 process(SFP_TXD,SFP_RXD,SFP_RXD_inv)
2185 for j in 0 to 2 loop
2186 for i in 0 to 31 loop
2187 SFP_TXD_inv(j)(i) <= SFP_TXD(j)(31-i);
2188 SFP_RXD(j)(i) <= SFP_RXD_inv(j)(31-i);
2192 i_REFCLK : IBUFDS_GTE2
port map(O => REFCLK, ODIV2 =>
open, CEB => '0', I => SFP_REFCLK_P, IB => SFP_REFCLK_N
);
2193 i_txusrclk : BUFG
port map (I => SFP_TXOUTCLK
(0), O => txusrclk
);
2194 g_SFP_rxusrclk : for i in 0 to 2 generate
2195 i_SFP_rxusrclk : BUFG
port map (I => SFP_RXOUTCLK
(i
), O => SFP_rxusrclk
(i
));
2197 i_REFCLK2X_in: bufg
port map(i => REFCLK, o => REFCLK2X_in
);
2198 i_ClientClk2X : BUFG
port map (I => ClientClk2X_dcm, O => ClientClk2X
);
2199 i_ClientClk : BUFG
port map (I => ClientClk_dcm, O => ClientClk
);
2200 i_REFCLK2XPLLRST : SRL16
generic map(INIT => x"ffff"
)
2202 Q => REFCLK2XPLLRST ,
-- SRL data output
2203 A0 => '1',
-- Select[0] input
2204 A1 => '1',
-- Select[1] input
2205 A2 => '1',
-- Select[2] input
2206 A3 => '1',
-- Select[3] input
2207 CLK => REFCLK2X_in,
-- Clock input
2208 D => '0'
-- SRL data input
2210 i_REFCLK2XPLL : PLLE2_BASE
2212 BANDWIDTH =>
"OPTIMIZED",
-- OPTIMIZED, HIGH, LOW
2213 CLKFBOUT_MULT =>
8,
-- Multiply value for all CLKOUT, (2-64)
2214 CLKFBOUT_PHASE =>
0.0,
-- Phase offset in degrees of CLKFB, (-360.000-360.000).
2215 CLKIN1_PERIOD =>
6.4,
-- Input clock period in ns to ps resolution (i.e. 33.
333 is 30 MHz).
2216 -- CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: Divide amount for each CLKOUT (1-128)
2217 CLKOUT0_DIVIDE =>
4,
2218 DIVCLK_DIVIDE =>
1,
-- Master division value, (1-56)
2219 REF_JITTER1 =>
0.0,
-- Reference input jitter in UI, (0.000-0.
999).
2220 STARTUP_WAIT =>
"FALSE" -- Delay DONE until PLL Locks, ("TRUE"/"FALSE")
2223 -- Clock Outputs: 1-bit (each) output: User configurable clock outputs
2224 CLKOUT0 => ClientClk2X_dcm,
2225 -- Feedback Clocks: 1-bit (each) output: Clock feedback ports
2226 CLKFBOUT => ClientClk_dcm,
-- 1-bit output: Feedback clock
2227 -- Status Port: 1-bit (each) output: PLL status ports
2228 LOCKED => ClientClk_lock ,
-- 1-bit output: LOCK
2229 -- Clock Input: 1-bit (each) input: Clock input
2230 CLKIN1 => REFCLK2X_in,
-- 1-bit input: Input clock
2231 -- Control Ports: 1-bit (each) input: PLL control ports
2232 PWRDWN => '0',
-- 1-bit input: Power-down
2233 RST => REFCLK2XPLLRST ,
-- 1-bit input: Reset
2234 -- Feedback Clocks: 1-bit (each) input: Clock feedback ports
2235 CLKFBIN => ClientClk
-- 1-bit input: Feedback clock
2239 if(ipb_clk'event and ipb_clk = '1')then
2240 if(ipb_addr(27) = '0' and ipb_addr(15 downto 0) = x"1c20" and ipb_write = '1' and ipb_strobe = '1')then
2241 en_stop <= ipb_wdata(4 downto 0);
2243 if(ipb_addr(27) = '0' and ipb_addr(15 downto 0) = x"1c21" and ipb_write = '1' and ipb_strobe = '1')then
2244 SFP_rate_limit(0)(6 downto 0) <= ipb_wdata(6 downto 0);
2246 if(ipb_addr(27) = '0' and ipb_addr(15 downto 0) = x"1c22" and ipb_write = '1' and ipb_strobe = '1')then
2247 SFP_rate_limit(1)(6 downto 0) <= ipb_wdata(6 downto 0);
2249 if(ipb_addr(27) = '0' and ipb_addr(15 downto 0) = x"1c23" and ipb_write = '1' and ipb_strobe = '1')then
2250 SFP_rate_limit(2)(6 downto 0) <= ipb_wdata(6 downto 0);
2252 if(ipb_addr(27) = '0' and ipb_addr(15 downto 0) = x"1c2f" and ipb_write = '1' and ipb_strobe = '1')then
2253 RTOmin <= ipb_wdata(15 downto 0);
2258 variable s : (1 downto 0);
2260 case ipb_addr(11 downto 10) is
2262 case enSFP(2 downto 0) is
2263 when "010" | "011" | "101" | "111" => s := "01";
2264 when "110" => s := "10";
2265 when others => s := "00";
2268 case enSFP(2 downto 0) is
2269 when "010" | "011" | "111" => s := "00";
2270 when "101" => s := "10";
2271 when others => s := "01";
2274 case enSFP(2 downto 0) is
2275 when "100" | "101" | "110" => s := "00";
2276 when others => s := "10";
2278 when others => s := "11";
2280 if(ipb_addr(15 downto 12) = x"1")then
2283 if(ipb_addr(9 downto 8) = "11")then
2284 case ipb_addr(3 downto 0) is
2285 when x"0" => ipb_rdata <= TotalEvtLengthCntr(0)(31 downto 0);
2286 when x"1" => ipb_rdata <= x"00" & TotalEvtLengthCntr(0)(55 downto 32);
2287 when x"2" => ipb_rdata <= EvtLength_errCntr(0);
2288 when x"3" => ipb_rdata <= AMClength_errCntr(0);
2289 when x"4" => ipb_rdata <= AMCvalid_errCntr(0);
2290 when x"5" => ipb_rdata <= AMCcrc_errCntr(0);
2291 when others => ipb_rdata <= (others => '0');
2294 ipb_rdata <= TCPIP_rdata(0);
2297 if(ipb_addr(9 downto 8) = "11")then
2298 case ipb_addr(3 downto 0) is
2299 when x"0" => ipb_rdata <= TotalEvtLengthCntr(1)(31 downto 0);
2300 when x"1" => ipb_rdata <= x"00" & TotalEvtLengthCntr(1)(55 downto 32);
2301 when x"2" => ipb_rdata <= EvtLength_errCntr(1);
2302 when x"3" => ipb_rdata <= AMClength_errCntr(1);
2303 when x"4" => ipb_rdata <= AMCvalid_errCntr(1);
2304 when x"5" => ipb_rdata <= AMCcrc_errCntr(1);
2305 when others => ipb_rdata <= (others => '0');
2308 ipb_rdata <= TCPIP_rdata(1);
2311 if(ipb_addr(9 downto 8) = "11")then
2312 case ipb_addr(3 downto 0) is
2313 when x"0" => ipb_rdata <= TotalEvtLengthCntr(2)(31 downto 0);
2314 when x"1" => ipb_rdata <= x"00" & TotalEvtLengthCntr(2)(55 downto 32);
2315 when x"2" => ipb_rdata <= EvtLength_errCntr(2);
2316 when x"3" => ipb_rdata <= AMClength_errCntr(2);
2317 when x"4" => ipb_rdata <= AMCvalid_errCntr(2);
2318 when x"5" => ipb_rdata <= AMCcrc_errCntr(2);
2319 when others => ipb_rdata <= (others => '0');
2322 ipb_rdata <= TCPIP_rdata(2);
2325 case ipb_addr(5 downto 4) is
2327 case ipb_addr(3 downto 0) is
2328 when x"0" => ipb_rdata <= "00000" & NXT_MonBuf(1) & "00000" & NXT_MonBuf(0);
2329 when x"1" => ipb_rdata <= x"0000" & "00000" & NXT_MonBuf(2);
2330 when x"2" => ipb_rdata <= "00000" & UNA_MonBuf(1) & "00000" & UNA_MonBuf(0);
2331 when x"3" => ipb_rdata <= "00000" & UNA_MonBuf(3) & "00000" & UNA_MonBuf(2);
2332 when x"4" => ipb_rdata <= x"0000" & "00000" & UNA_MonBuf(4);
2333 when x"5" => ipb_rdata <= x"0" & NXT_TCPBuf(1) & x"0" & NXT_TCPBuf(0);
2334 when x"6" => ipb_rdata <= x"00000" & NXT_TCPBuf(2);
2335 when x"7" => ipb_rdata <= "00000" & UNA_TCPBuf(1) & "00000" & UNA_TCPBuf(0);
2336 when x"8" => ipb_rdata <= "00000" & UNA_TCPBuf(3) & "00000" & UNA_TCPBuf(2);
2337 when x"9" => ipb_rdata <= "00000" & Written_MonBuf(1) & "00000" & Written_MonBuf(0);
2338 when x"a" => ipb_rdata <= "00000" & Written_MonBuf(3) & "00000" & Written_MonBuf(2);
2339 when x"b" => ipb_rdata <= '0' & ReadBusy & '0' & SFP_RXGOOD & x"00" & "00" & sfp_pd(2) & sfp_pd(1) & sfp_pd(0) & '0' & SFP_TX_FSM_RESET_DONE & '0' & SFP_RX_FSM_RESET_DONE;
2340 when x"c" => ipb_rdata <= x"000" & SFP2TCPIP(2) & SFP2TCPIP(1) & SFP2TCPIP(0) & TCPIP2SFP_sel(2) & TCPIP2SFP_sel(1) & TCPIP2SFP_sel(0) & '0' & EnTCPIP & '0' & LINK_down;
2341 when x"d" => ipb_rdata <= cmsCRC_errCntr(0);
2342 when x"e" => ipb_rdata <= cmsCRC_errCntr(1);
2343 when others => ipb_rdata <= cmsCRC_errCntr(2);
2346 case ipb_addr(3 downto 0) is
2347 when x"0" => ipb_rdata <= '0' & RETX_ddr_rrqst & '0' & RETX_ddr_wrqst & '0' & EVENTdata_avl & '0' & AddrBuf_full & '0' & evt_FIFO_full & '0' & wport_FIFO_full & '0' & wport_rdy & '0' & evt_data_rdy;
2348 when x"1" => ipb_rdata <= TCP_rrqst_i & TCP_rFIFO_ra & "000" & TCP_rFIFO_wa & "00" & rrqstMask & '0' & RETXdataAck & '0' & RETXdataRqst;
2349 when x"2" => ipb_rdata <= "00000" & MonBuf_wa & "00000" & MonBuf_ra;
2350 when x"3" => ipb_rdata <= EventData_reCntr(0);
2351 when x"4" => ipb_rdata <= EventData_reCntr(1);
2352 when x"5" => ipb_rdata <= EventData_reCntr(2);
2353 when x"6" => ipb_rdata <= EventBufAddr_weCntr(0);
2354 when x"7" => ipb_rdata <= EventBufAddr_weCntr(1);
2355 when x"8" => ipb_rdata <= EventBufAddr_weCntr(2);
2356 when x"9" => ipb_rdata <= EventData_weCntr(0);
2357 when x"a" => ipb_rdata <= EventData_weCntr(1);
2358 when x"b" => ipb_rdata <= EventData_weCntr(2);
2359 when x"c" => ipb_rdata <= SFP_IPADDR(0);
2360 when x"d" => ipb_rdata <= SFP_IPADDR(1);
2361 when x"e" => ipb_rdata <= SFP_IPADDR(2);
2362 -- when others => ipb_rdata <= CWND_max;
2363 when others => ipb_rdata <= (others => '0');
2366 case ipb_addr(3 downto 0) is
2367 when x"0" => ipb_rdata <= x"000000" & "000" & en_stop;
2368 when x"1" => ipb_rdata <= x"000000" & SFP_rate_limit(0);
2369 when x"2" => ipb_rdata <= x"000000" & SFP_rate_limit(1);
2370 when x"3" => ipb_rdata <= x"000000" & SFP_rate_limit(2);
2371 when x"4" => ipb_rdata <= SFP_evt_cntr(0);
2372 when x"5" => ipb_rdata <= SFP_evt_cntr(1);
2373 when x"6" => ipb_rdata <= SFP_evt_cntr(2);
2374 when x"8" => ipb_rdata <= SFP_word_cntr(0);
2375 when x"9" => ipb_rdata <= SFP_word_cntr(1);
2376 when x"a" => ipb_rdata <= SFP_word_cntr(2);
2377 when x"c" => ipb_rdata <= SFP_blk_cntr(0);
2378 when x"d" => ipb_rdata <= SFP_blk_cntr(1);
2379 when x"e" => ipb_rdata <= SFP_blk_cntr(2);
2380 when x"f" => ipb_rdata <= x"0000" & RTOmin;
2381 when others => ipb_rdata <= (others => '0');
2383 when others => ipb_rdata <= (others => '0');
2387 ipb_rdata <= (others => '0');
2392 if(ipb_clk'event and ipb_clk = '1')then
2393 if(ipb_addr(27) = '0' and ipb_addr(15 downto 2) = "00011100000111" and ipb_strobe = '1' and ipb_write = '1')then
2394 if(ipb_addr(1 downto 0) = "11")then
2395 -- CWND_max <= x"0" & ipb_wdata(27 downto 0);
2397 SFP_IPADDR(conv_integer(ipb_addr(1 downto 0))) <= ipb_wdata;