1 ------------------------------------------------------------------------------
4 -- /___/ \ / Vendor: Xilinx
5 -- \ \ \/ Version : 2.
5
6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard
7 -- / / Filename : s6link_init.vhd
12 -- Description : This module instantiates the modules required for
13 -- reset and initialisation of the Transceiver
16 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
19 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
21 -- This file contains confidential and proprietary information
22 -- of Xilinx, Inc. and is protected under U.S. and
23 -- international copyright and other intellectual property
27 -- This disclaimer is not a license and does not grant any
28 -- rights to the materials distributed herewith. Except as
29 -- otherwise provided in a valid license issued to you by
30 -- Xilinx, and to the maximum extent permitted by applicable
31 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS"
AND
32 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
33 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
34 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
35 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
36 -- (2) Xilinx shall
not be liable (whether
in contract
or tort,
37 -- including negligence, or under any other theory of
38 -- liability) for any loss or damage of any kind or nature
39 -- related to, arising under or in connection with these
40 -- materials, including for any direct, or any indirect,
41 -- special, incidental, or consequential loss or damage
42 -- (including loss of data, profits, goodwill, or any type of
43 -- loss or damage suffered as a result of any action brought
44 -- by a third party) even if such damage or loss was
45 -- reasonably foreseeable or Xilinx had been advised of the
46 -- possibility of the same.
48 -- CRITICAL APPLICATIONS
49 -- Xilinx products are not designed or intended to be fail-
50 -- safe, or for use in any application requiring fail-safe
51 -- performance, such as life-support or safety devices or
52 -- systems, Class III medical devices, nuclear facilities,
53 -- applications related to the deployment of airbags, or any
54 -- other applications that could lead to death, personal
55 -- injury, or severe property or environmental damage
56 -- (individually and collectively, "Critical
57 -- Applications"). Customer assumes the sole risk and
58 -- liability of any use of Xilinx products in Critical
59 -- Applications, subject only to applicable laws and
60 -- regulations governing limitations on product liability.
62 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
63 -- PART OF THIS FILE AT ALL TIMES.
67 use ieee.std_logic_1164.
all;
68 use ieee.numeric_std.
all;
69 use ieee.std_logic_unsigned.
all;
71 use UNISIM.VCOMPONENTS.
ALL;
73 --***********************************Entity Declaration************************
78 EXAMPLE_SIM_GTRESET_SPEEDUP : := "TRUE";
-- simulation setting for GT SecureIP model
79 EXAMPLE_SIMULATION : := 0;
-- Set to 1 for simulation
80 EQ_MODE : := "LPM";
-- Rx Equalization Mode - Set to DFE or LPM
81 EXAMPLE_USE_CHIPSCOPE : := 0 -- Set to 1 to use Chipscope
to drive resets
88 GT0_TX_FSM_RESET_DONE_OUT : out ;
89 GT0_RX_FSM_RESET_DONE_OUT : out ;
90 GT0_DATA_VALID_IN : in ;
92 --_________________________________________________________________________
94 --____________________________CHANNEL PORTS________________________________
95 --------------------------------- CPLL Ports -------------------------------
96 GT0_CPLLFBCLKLOST_OUT : out ;
97 GT0_CPLLLOCK_OUT : out ;
98 GT0_CPLLLOCKDETCLK_IN : in ;
99 GT0_CPLLRESET_IN : in ;
100 -------------------------- Channel - Clocking Ports ------------------------
101 GT0_GTREFCLK0_IN : in ;
102 ---------------------------- Channel - DRP Ports --------------------------
103 GT0_DRPADDR_IN : in (8 downto 0);
105 GT0_DRPDI_IN : in (15 downto 0);
106 GT0_DRPDO_OUT : out (15 downto 0);
108 GT0_DRPRDY_OUT : out ;
110 --------------------- RX Initialization and Reset Ports --------------------
111 GT0_RXUSERRDY_IN : in ;
112 -------------------------- RX Margin Analysis Ports ------------------------
113 GT0_EYESCANDATAERROR_OUT : out ;
114 ------------------------- Receive Ports - CDR Ports ------------------------
115 GT0_RXCDRLOCK_OUT : out ;
116 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
117 GT0_RXUSRCLK_IN : in ;
118 GT0_RXUSRCLK2_IN : in ;
119 ------------------ Receive Ports - FPGA RX interface Ports -----------------
120 GT0_RXDATA_OUT : out (15 downto 0);
121 ------------------ Receive Ports - RX 8B/10B Decoder Ports -----------------
122 GT0_RXDISPERR_OUT : out (1 downto 0);
123 GT0_RXNOTINTABLE_OUT : out (1 downto 0);
124 --------------------------- Receive Ports - RX AFE -------------------------
126 ------------------------ Receive Ports - RX AFE Ports ----------------------
128 -------------- Receive Ports - RX Byte and Word Alignment Ports ------------
129 GT0_RXMCOMMAALIGNEN_IN : in ;
130 GT0_RXPCOMMAALIGNEN_IN : in ;
131 --------------------- Receive Ports - RX Equalizer Ports -------------------
132 GT0_RXDFELPMRESET_IN : in ;
133 ------------- Receive Ports - RX Initialization and Reset Ports ------------
134 GT0_GTRXRESET_IN : in ;
135 GT0_RXPMARESET_IN : in ;
136 ----------------- Receive Ports - RX Polarity Control Ports ----------------
137 GT0_RXPOLARITY_IN : in ;
138 ------------------- Receive Ports - RX8B/10B Decoder Ports -----------------
139 GT0_RXCHARISK_OUT : out (1 downto 0);
140 -------------- Receive Ports -RX Initialization and Reset Ports ------------
141 GT0_RXRESETDONE_OUT : out ;
142 --------------------- TX Initialization and Reset Ports --------------------
143 GT0_GTTXRESET_IN : in ;
144 GT0_TXUSERRDY_IN : in ;
145 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
146 GT0_TXUSRCLK_IN : in ;
147 GT0_TXUSRCLK2_IN : in ;
148 ------------------ Transmit Ports - TX Data Path interface -----------------
149 GT0_TXDATA_IN : in (15 downto 0);
150 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
151 GT0_GTXTXN_OUT : out ;
152 GT0_GTXTXP_OUT : out ;
153 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
154 GT0_TXOUTCLK_OUT : out ;
155 GT0_TXOUTCLKFABRIC_OUT : out ;
156 GT0_TXOUTCLKPCS_OUT : out ;
157 --------------------- Transmit Ports - TX Gearbox Ports --------------------
158 GT0_TXCHARISK_IN : in (1 downto 0);
159 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
160 GT0_TXRESETDONE_OUT : out ;
161 ----------------- Transmit Ports - TX Polarity Control Ports ---------------
162 GT0_TXPOLARITY_IN : in ;
165 --____________________________COMMON PORTS________________________________
166 ---------------------- Common Block - Ref Clock Ports ---------------------
167 GT0_GTREFCLK0_COMMON_IN : in ;
168 ------------------------- Common Block - QPLL Ports ------------------------
169 GT0_QPLLLOCK_OUT : out ;
170 GT0_QPLLLOCKDETCLK_IN : in ;
171 GT0_QPLLRESET_IN : in
180 --**************************Component Declarations*****************************
186 -- Simulation attributes
187 WRAPPER_SIM_GTRESET_SPEEDUP : :=
"FALSE" -- Set to 1 to speed up sim reset
193 --_________________________________________________________________________
194 --_________________________________________________________________________
196 --____________________________CHANNEL PORTS________________________________
197 --------------------------------- CPLL Ports -------------------------------
198 GT0_CPLLFBCLKLOST_OUT :
out ;
199 GT0_CPLLLOCK_OUT :
out ;
200 GT0_CPLLLOCKDETCLK_IN :
in ;
201 GT0_CPLLREFCLKLOST_OUT :
out ;
202 GT0_CPLLRESET_IN :
in ;
203 -------------------------- Channel - Clocking Ports ------------------------
204 GT0_GTREFCLK0_IN :
in ;
205 ---------------------------- Channel - DRP Ports --------------------------
206 GT0_DRPADDR_IN :
in (
8 downto 0);
208 GT0_DRPDI_IN :
in (
15 downto 0);
209 GT0_DRPDO_OUT :
out (
15 downto 0);
211 GT0_DRPRDY_OUT :
out ;
213 --------------------- RX Initialization and Reset Ports --------------------
214 GT0_RXUSERRDY_IN :
in ;
215 -------------------------- RX Margin Analysis Ports ------------------------
216 GT0_EYESCANDATAERROR_OUT :
out ;
217 ------------------------- Receive Ports - CDR Ports ------------------------
218 GT0_RXCDRLOCK_OUT :
out ;
219 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
220 GT0_RXUSRCLK_IN :
in ;
221 GT0_RXUSRCLK2_IN :
in ;
222 ------------------ Receive Ports - FPGA RX interface Ports -----------------
223 GT0_RXDATA_OUT :
out (
15 downto 0);
224 ------------------ Receive Ports - RX 8B/10B Decoder Ports -----------------
225 GT0_RXDISPERR_OUT :
out (
1 downto 0);
226 GT0_RXNOTINTABLE_OUT :
out (
1 downto 0);
227 --------------------------- Receive Ports - RX AFE -------------------------
229 ------------------------ Receive Ports - RX AFE Ports ----------------------
231 -------------- Receive Ports - RX Byte and Word Alignment Ports ------------
232 GT0_RXMCOMMAALIGNEN_IN :
in ;
233 GT0_RXPCOMMAALIGNEN_IN :
in ;
234 --------------------- Receive Ports - RX Equalizer Ports -------------------
235 GT0_RXDFELPMRESET_IN :
in ;
236 --------------------- Receive Ports - RX Equilizer Ports -------------------
237 GT0_RXLPMHFHOLD_IN :
in ;
238 GT0_RXLPMLFHOLD_IN :
in ;
239 --------------- Receive Ports - RX Fabric Output Control Ports -------------
240 GT0_RXOUTCLK_OUT :
out ;
241 ------------- Receive Ports - RX Initialization and Reset Ports ------------
242 GT0_GTRXRESET_IN :
in ;
243 GT0_RXPMARESET_IN :
in ;
244 ----------------- Receive Ports - RX Polarity Control Ports ----------------
245 GT0_RXPOLARITY_IN :
in ;
246 ------------------- Receive Ports - RX8B/10B Decoder Ports -----------------
247 GT0_RXCHARISK_OUT :
out (
1 downto 0);
248 -------------- Receive Ports -RX Initialization and Reset Ports ------------
249 GT0_RXRESETDONE_OUT :
out ;
250 --------------------- TX Initialization and Reset Ports --------------------
251 GT0_GTTXRESET_IN :
in ;
252 GT0_TXUSERRDY_IN :
in ;
253 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
254 GT0_TXUSRCLK_IN :
in ;
255 GT0_TXUSRCLK2_IN :
in ;
256 ------------------ Transmit Ports - TX Data Path interface -----------------
257 GT0_TXDATA_IN :
in (
15 downto 0);
258 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
259 GT0_GTXTXN_OUT :
out ;
260 GT0_GTXTXP_OUT :
out ;
261 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
262 GT0_TXOUTCLK_OUT :
out ;
263 GT0_TXOUTCLKFABRIC_OUT :
out ;
264 GT0_TXOUTCLKPCS_OUT :
out ;
265 --------------------- Transmit Ports - TX Gearbox Ports --------------------
266 GT0_TXCHARISK_IN :
in (
1 downto 0);
267 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
268 GT0_TXRESETDONE_OUT :
out ;
269 ----------------- Transmit Ports - TX Polarity Control Ports ---------------
270 GT0_TXPOLARITY_IN :
in ;
273 --____________________________COMMON PORTS________________________________
274 ---------------------- Common Block - Ref Clock Ports ---------------------
275 GT0_GTREFCLK0_COMMON_IN :
in ;
276 ------------------------- Common Block - QPLL Ports ------------------------
277 GT0_QPLLLOCK_OUT :
out ;
278 GT0_QPLLLOCKDETCLK_IN :
in ;
279 GT0_QPLLREFCLKLOST_OUT :
out ;
280 GT0_QPLLRESET_IN :
in
289 STABLE_CLOCK_PERIOD :
range 4 to 20 :=
8;
--Period of the stable clock driving this state-machine, unit is [ns]
290 RETRY_COUNTER_BITWIDTH :
range 2 to 8 :=
8;
291 TX_QPLL_USED : := False;
-- the TX and RX Reset FSMs must
292 RX_QPLL_USED : := False;
-- share these two generic values
293 PHASE_ALIGNMENT_MANUAL : := True
-- Decision if a manual phase-alignment is necessary or the automatic
294 -- is enough. For single-lane applications the automatic alignment is
297 Port ( STABLE_CLOCK :
in ;
--Stable Clock, either a stable clock from the PCB
298 --or reference-clock present at startup.
299 TXUSERCLK :
in ;
--TXUSERCLK as used in the design
300 SOFT_RESET :
in ;
--User Reset, can be pulled any
301 QPLLREFCLKLOST :
in ;
--QPLL Reference-clock for the GT is lost
302 CPLLREFCLKLOST :
in ;
--CPLL Reference-clock for the GT is lost
303 QPLLLOCK :
in ;
--Lock Detect from the QPLL of the GT
304 CPLLLOCK :
in ;
--Lock Detect from the CPLL of the GT
307 GTTXRESET :
out :='
0';
308 MMCM_RESET :
out :='
0';
309 QPLL_RESET :
out :='
0';
--Reset QPLL
310 CPLL_RESET :
out :='
0';
--Reset CPLL
311 TX_FSM_RESET_DONE :
out :='
0';
--Reset-sequence has sucessfully been finished.
312 TXUSERRDY :
out :='
0';
313 RUN_PHALIGNMENT :
out :='
0';
314 RESET_PHALIGNMENT :
out :='
0';
315 PHALIGNMENT_DONE :
in ;
317 RETRY_COUNTER :
out (RETRY_COUNTER_BITWIDTH
-1 downto 0):=(
others=>'
0')
-- Number of
318 -- Retries it took to get the transceiver up and running
324 EXAMPLE_SIMULATION : :=
0;
327 STABLE_CLOCK_PERIOD :
range 4 to 20 :=
8;
--Period of the stable clock driving this state-machine, unit is [ns]
328 RETRY_COUNTER_BITWIDTH :
range 2 to 8 :=
8;
329 TX_QPLL_USED : := False;
-- the TX and RX Reset FSMs must
330 RX_QPLL_USED : := False;
-- share these two generic values
331 PHASE_ALIGNMENT_MANUAL : := True
-- Decision if a manual phase-alignment is necessary or the automatic
332 -- is enough. For single-lane applications the automatic alignment is
335 Port ( STABLE_CLOCK :
in ;
--Stable Clock, either a stable clock from the PCB
336 --or reference-clock present at startup.
337 RXUSERCLK :
in ;
--RXUSERCLK as used in the design
338 SOFT_RESET :
in ;
--User Reset, can be pulled any
339 QPLLREFCLKLOST :
in ;
--QPLL Reference-clock for the GT is lost
340 CPLLREFCLKLOST :
in ;
--CPLL Reference-clock for the GT is lost
341 QPLLLOCK :
in ;
--Lock Detect from the QPLL of the GT
342 CPLLLOCK :
in ;
--Lock Detect from the CPLL of the GT
346 RECCLK_MONITOR_RESTART :
in ;
348 TXUSERRDY :
in ;
--TXUSERRDY from GT
349 GTRXRESET :
out :='
0';
350 MMCM_RESET :
out :='
0';
351 QPLL_RESET :
out :='
0';
--Reset QPLL (only if RX uses QPLL)
352 CPLL_RESET :
out :='
0';
--Reset CPLL (only if RX uses CPLL)
353 RX_FSM_RESET_DONE :
out :='
0';
--Reset-sequence has sucessfully been finished.
354 RXUSERRDY :
out :='
0';
355 RUN_PHALIGNMENT :
out ;
356 PHALIGNMENT_DONE :
in ;
357 RESET_PHALIGNMENT :
out :='
0';
362 RETRY_COUNTER :
out (RETRY_COUNTER_BITWIDTH
-1 downto 0):=(
others=>'
0')
-- Number of
363 -- Retries it took to get the transceiver up and running
369 AGC_TIMER :
range 0 to 4095:=
150
378 DO :
in (
15 downto 0);
380 DADDR :
out (
8 downto 0);
381 DI :
out (
15 downto 0);
384 RXMONITOR :
in (
6 downto 0);
385 RXMONITORSEL :
out (
1 downto 0);
390 DEBUG :
out (
53 downto 0)
396 TIMER :
range 0 to 4095:=
150
406 DO :
in (
15 downto 0);
408 DADDR :
out (
8 downto 0);
409 DI :
out (
15 downto 0);
418 DEBUG :
out (
53 downto 0)
428 function get_cdrlock_time(is_sim :
in )
return is
429 variable lock_time: ;
434 lock_time :=
50000 / (
2.
5); --Typical CDR lock
is 50,000UI as per DS183
439 function get_lpm_adapt_lock_time(is_sim :
in )
return is
440 variable lock_time: ;
445 lock_time := (
13 * (
60) / (
2.
5)); --Typical CDR lock
is 50,000UI as per DS183
450 --***********************************Parameter Declarations********************
452 constant DLY : := 1 ns;
453 constant STABLE_CLOCK_PERIOD : := 20;
--Period of the stable clock driving this state-machine, unit is [ns]
454 constant RX_CDRLOCK_TIME : := get_cdrlock_time(EXAMPLE_SIMULATION);
-- 200us
455 constant WAIT_TIME_CDRLOCK : := RX_CDRLOCK_TIME / STABLE_CLOCK_PERIOD;
-- 200 us time-out
456 constant LPM_ADAPT_LOCK_TIMER : := get_lpm_adapt_lock_time(EXAMPLE_SIMULATION);
457 constant DFE_ADAPT_LOCK_TIMER : := ((13 * (60)) / (2.
5));
459 -------------------------- GT Wrapper Wires ------------------------------
460 signal gt0_cpllreset_i : ;
461 signal gt0_cpllreset_t : ;
462 signal gt0_cpllrefclklost_i : ;
463 signal gt0_cplllock_i : ;
464 signal gt0_txresetdone_i : ;
465 signal gt0_rxresetdone_i : ;
466 signal gt0_gttxreset_i : ;
467 signal gt0_gttxreset_t : ;
468 signal gt0_gtrxreset_i : ;
469 signal gt0_gtrxreset_t : ;
470 signal gt0_rxdfelpmreset_i : ;
471 signal gt0_txuserrdy_i : ;
472 signal gt0_txuserrdy_t : ;
473 signal gt0_rxuserrdy_i : ;
474 signal gt0_rxuserrdy_t : ;
476 signal gt0_rxdfeagchold_i : ;
477 signal gt0_rxdfelfhold_i : ;
478 signal gt0_rxlpmlfhold_i : ;
479 signal gt0_rxlpmhfhold_i : ;
482 signal gt0_drpaddr_i : (8 downto 0);
483 signal gt0_drpdi_i : (15 downto 0);
484 signal gt0_drpdo_o : (15 downto 0);
485 signal gt0_drpen_i : ;
486 signal gt0_drpwe_i : ;
487 signal gt0_drprdy_o : ;
489 signal gt0_drpaddr_int : (8 downto 0);
490 signal gt0_drpdi_int : (15 downto 0);
491 signal gt0_drpdo_int : (15 downto 0);
492 signal gt0_drpen_int : ;
493 signal gt0_drpwe_int : ;
494 signal gt0_drprdy_int : ;
496 signal gt0_rxmonitorout_o : (6 downto 0);
497 signal gt0_rxmonitorsel_i : (1 downto 0);
498 signal gt0_adapt_done : ;
500 signal gt0_qpllreset_i : ;
501 signal gt0_qpllreset_t : ;
502 signal gt0_qpllrefclklost_i : ;
503 signal gt0_qplllock_i : ;
506 ------------------------------- Global Signals -----------------------------
507 signal tied_to_ground_i : ;
508 signal tied_to_vcc_i : ;
510 signal gt0_rxoutclk_i : ;
511 signal gt0_recclk_stable_i : ;
518 signal rx_cdrlock_counter : range 0 to WAIT_TIME_CDRLOCK:= 0 ;
519 signal rx_cdrlocked : ;
525 --**************************** Main Body of Code *******************************
527 -- Static signal Assigments
528 tied_to_ground_i <= '0';
529 tied_to_vcc_i <= '1';
531 ----------------------------- The GT Wrapper -----------------------------
533 -- Use the instantiation template in the example directory to add the GT wrapper to your design.
534 -- In this example, the wrapper is wired up for basic operation with a frame generator and frame
535 -- checker. The GTs will reset, then attempt to align and transmit data. If channel bonding is
536 -- enabled, bonding should occur after alignment.
542 WRAPPER_SIM_GTRESET_SPEEDUP => EXAMPLE_SIM_GTRESET_SPEEDUP
547 --_____________________________________________________________________
548 --_____________________________________________________________________
551 --------------------------------- CPLL Ports -------------------------------
552 GT0_CPLLFBCLKLOST_OUT => GT0_CPLLFBCLKLOST_OUT ,
553 GT0_CPLLLOCK_OUT => gt0_cplllock_i,
554 GT0_CPLLLOCKDETCLK_IN => GT0_CPLLLOCKDETCLK_IN ,
555 GT0_CPLLREFCLKLOST_OUT => gt0_cpllrefclklost_i ,
556 GT0_CPLLRESET_IN => gt0_cpllreset_i,
557 -------------------------- Channel - Clocking Ports ------------------------
558 GT0_GTREFCLK0_IN => GT0_GTREFCLK0_IN,
559 ---------------------------- Channel - DRP Ports --------------------------
560 GT0_DRPADDR_IN => gt0_drpaddr_i,
561 GT0_DRPCLK_IN => GT0_DRPCLK_IN,
562 GT0_DRPDI_IN => gt0_drpdi_i,
563 GT0_DRPDO_OUT => gt0_drpdo_o,
564 GT0_DRPEN_IN => gt0_drpen_i,
565 GT0_DRPRDY_OUT => gt0_drprdy_o,
566 GT0_DRPWE_IN => gt0_drpwe_i,
567 --------------------- RX Initialization and Reset Ports --------------------
568 GT0_RXUSERRDY_IN => gt0_rxuserrdy_i,
569 -------------------------- RX Margin Analysis Ports ------------------------
570 GT0_EYESCANDATAERROR_OUT => GT0_EYESCANDATAERROR_OUT,
571 ------------------------- Receive Ports - CDR Ports ------------------------
572 GT0_RXCDRLOCK_OUT => GT0_RXCDRLOCK_OUT,
573 ------------------ Receive Ports - FPGA RX Interface Ports -----------------
574 GT0_RXUSRCLK_IN => GT0_RXUSRCLK_IN,
575 GT0_RXUSRCLK2_IN => GT0_RXUSRCLK2_IN,
576 ------------------ Receive Ports - FPGA RX interface Ports -----------------
577 GT0_RXDATA_OUT => GT0_RXDATA_OUT,
578 ------------------ Receive Ports - RX 8B/10B Decoder Ports -----------------
579 GT0_RXDISPERR_OUT => GT0_RXDISPERR_OUT,
580 GT0_RXNOTINTABLE_OUT => GT0_RXNOTINTABLE_OUT ,
581 --------------------------- Receive Ports - RX AFE -------------------------
582 GT0_GTXRXP_IN => GT0_GTXRXP_IN,
583 ------------------------ Receive Ports - RX AFE Ports ----------------------
584 GT0_GTXRXN_IN => GT0_GTXRXN_IN,
585 -------------- Receive Ports - RX Byte and Word Alignment Ports ------------
586 GT0_RXMCOMMAALIGNEN_IN => GT0_RXMCOMMAALIGNEN_IN ,
587 GT0_RXPCOMMAALIGNEN_IN => GT0_RXPCOMMAALIGNEN_IN ,
588 --------------------- Receive Ports - RX Equalizer Ports -------------------
589 GT0_RXDFELPMRESET_IN => gt0_rxdfelpmreset_i ,
590 --------------------- Receive Ports - RX Equilizer Ports -------------------
591 GT0_RXLPMHFHOLD_IN => gt0_rxlpmhfhold_i,
592 GT0_RXLPMLFHOLD_IN => gt0_rxlpmlfhold_i,
593 --------------- Receive Ports - RX Fabric Output Control Ports -------------
594 GT0_RXOUTCLK_OUT => gt0_rxoutclk_i,
595 ------------- Receive Ports - RX Initialization and Reset Ports ------------
596 GT0_GTRXRESET_IN => gt0_gtrxreset_i,
597 GT0_RXPMARESET_IN => GT0_RXPMARESET_IN,
598 ----------------- Receive Ports - RX Polarity Control Ports ----------------
599 GT0_RXPOLARITY_IN => GT0_RXPOLARITY_IN,
600 ------------------- Receive Ports - RX8B/10B Decoder Ports -----------------
601 GT0_RXCHARISK_OUT => GT0_RXCHARISK_OUT,
602 -------------- Receive Ports -RX Initialization and Reset Ports ------------
603 GT0_RXRESETDONE_OUT => gt0_rxresetdone_i,
604 --------------------- TX Initialization and Reset Ports --------------------
605 GT0_GTTXRESET_IN => gt0_gttxreset_i,
606 GT0_TXUSERRDY_IN => gt0_txuserrdy_i,
607 ------------------ Transmit Ports - FPGA TX Interface Ports ----------------
608 GT0_TXUSRCLK_IN => GT0_TXUSRCLK_IN,
609 GT0_TXUSRCLK2_IN => GT0_TXUSRCLK2_IN,
610 ------------------ Transmit Ports - TX Data Path interface -----------------
611 GT0_TXDATA_IN => GT0_TXDATA_IN,
612 ---------------- Transmit Ports - TX Driver and OOB signaling --------------
613 GT0_GTXTXN_OUT => GT0_GTXTXN_OUT,
614 GT0_GTXTXP_OUT => GT0_GTXTXP_OUT,
615 ----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
616 GT0_TXOUTCLK_OUT => GT0_TXOUTCLK_OUT,
617 GT0_TXOUTCLKFABRIC_OUT => GT0_TXOUTCLKFABRIC_OUT ,
618 GT0_TXOUTCLKPCS_OUT => GT0_TXOUTCLKPCS_OUT ,
619 --------------------- Transmit Ports - TX Gearbox Ports --------------------
620 GT0_TXCHARISK_IN => GT0_TXCHARISK_IN,
621 ------------- Transmit Ports - TX Initialization and Reset Ports -----------
622 GT0_TXRESETDONE_OUT => gt0_txresetdone_i,
623 ----------------- Transmit Ports - TX Polarity Control Ports ---------------
624 GT0_TXPOLARITY_IN => GT0_TXPOLARITY_IN,
629 --____________________________COMMON PORTS________________________________
630 ---------------------- Common Block - Ref Clock Ports ---------------------
631 GT0_GTREFCLK0_COMMON_IN => GT0_GTREFCLK0_COMMON_IN ,
632 ------------------------- Common Block - QPLL Ports ------------------------
633 GT0_QPLLLOCK_OUT => gt0_qplllock_i,
634 GT0_QPLLLOCKDETCLK_IN => GT0_QPLLLOCKDETCLK_IN ,
635 GT0_QPLLREFCLKLOST_OUT => gt0_qpllrefclklost_i ,
636 GT0_QPLLRESET_IN => gt0_qpllreset_i
641 gt0_rxdfelpmreset_i <= tied_to_ground_i;
646 GT0_CPLLLOCK_OUT <= gt0_cplllock_i;
647 GT0_TXRESETDONE_OUT <= gt0_txresetdone_i;
648 GT0_RXRESETDONE_OUT <= gt0_rxresetdone_i;
649 GT0_QPLLLOCK_OUT <= gt0_qplllock_i;
651 chipscope : if EXAMPLE_USE_CHIPSCOPE = 1 generate
652 gt0_cpllreset_i <= GT0_CPLLRESET_IN;
653 gt0_gttxreset_i <= GT0_GTTXRESET_IN;
654 gt0_gtrxreset_i <= GT0_GTRXRESET_IN;
655 gt0_txuserrdy_i <= GT0_TXUSERRDY_IN;
656 gt0_rxuserrdy_i <= GT0_RXUSERRDY_IN;
657 gt0_qpllreset_i <= GT0_QPLLRESET_IN;
658 end generate chipscope;
660 no_chipscope : if EXAMPLE_USE_CHIPSCOPE = 0 generate
661 gt0_cpllreset_i <= gt0_cpllreset_t ;
662 gt0_cpllreset_i <= gt0_cpllreset_t;
663 gt0_gttxreset_i <= gt0_gttxreset_t;
664 gt0_gtrxreset_i <= gt0_gtrxreset_t;
665 gt0_txuserrdy_i <= gt0_txuserrdy_t;
666 gt0_rxuserrdy_i <= gt0_rxuserrdy_t;
667 gt0_qpllreset_i <= gt0_qpllreset_t;
668 end generate no_chipscope;
674 GT_TYPE =>
"GTX",
--GTX or GTH or GTP
675 STABLE_CLOCK_PERIOD => STABLE_CLOCK_PERIOD,
-- Period of the stable clock driving this state-machine, unit is [ns]
676 RETRY_COUNTER_BITWIDTH =>
8,
677 TX_QPLL_USED => FALSE ,
-- the TX and RX Reset FSMs must
678 RX_QPLL_USED => FALSE,
-- share these two generic values
679 PHASE_ALIGNMENT_MANUAL => FALSE
-- Decision if a manual phase-alignment is necessary or the automatic
680 -- is enough. For single-lane applications the automatic alignment is
684 STABLE_CLOCK => SYSCLK_IN ,
685 TXUSERCLK => GT0_TXUSRCLK_IN,
686 SOFT_RESET => SOFT_RESET_IN,
687 QPLLREFCLKLOST => tied_to_ground_i,
688 CPLLREFCLKLOST => gt0_cpllrefclklost_i ,
689 QPLLLOCK => tied_to_vcc_i,
690 CPLLLOCK => gt0_cplllock_i,
691 TXRESETDONE => gt0_txresetdone_i,
692 MMCM_LOCK => tied_to_vcc_i,
693 GTTXRESET => gt0_gttxreset_t,
696 CPLL_RESET => gt0_cpllreset_t,
697 TX_FSM_RESET_DONE => GT0_TX_FSM_RESET_DONE_OUT ,
698 TXUSERRDY => gt0_txuserrdy_t,
699 RUN_PHALIGNMENT =>
open,
700 RESET_PHALIGNMENT =>
open,
701 PHALIGNMENT_DONE => tied_to_vcc_i,
702 RETRY_COUNTER =>
open
713 EXAMPLE_SIMULATION => EXAMPLE_SIMULATION,
714 GT_TYPE =>
"GTX",
--GTX or GTH or GTP
715 EQ_MODE => EQ_MODE,
--Rx Equalization Mode - Set to DFE or LPM
716 STABLE_CLOCK_PERIOD => STABLE_CLOCK_PERIOD,
--Period of the stable clock driving this state-machine, unit is [ns]
717 RETRY_COUNTER_BITWIDTH =>
8,
718 TX_QPLL_USED => FALSE ,
-- the TX and RX Reset FSMs must
719 RX_QPLL_USED => FALSE,
-- share these two generic values
720 PHASE_ALIGNMENT_MANUAL => FALSE
-- Decision if a manual phase-alignment is necessary or the automatic
721 -- is enough. For single-lane applications the automatic alignment is
725 STABLE_CLOCK => SYSCLK_IN ,
726 RXUSERCLK => GT0_RXUSRCLK_IN,
727 SOFT_RESET => SOFT_RESET_IN,
728 QPLLREFCLKLOST => tied_to_ground_i,
729 CPLLREFCLKLOST => gt0_cpllrefclklost_i ,
730 QPLLLOCK => tied_to_vcc_i,
731 CPLLLOCK => gt0_cplllock_i,
732 RXRESETDONE => gt0_rxresetdone_i,
733 MMCM_LOCK => tied_to_vcc_i,
734 RECCLK_STABLE => gt0_recclk_stable_i ,
735 RECCLK_MONITOR_RESTART => tied_to_ground_i,
736 DATA_VALID => GT0_DATA_VALID_IN,
737 TXUSERRDY => gt0_txuserrdy_i,
738 GTRXRESET => gt0_gtrxreset_t,
742 RX_FSM_RESET_DONE => GT0_RX_FSM_RESET_DONE_OUT ,
743 RXUSERRDY => gt0_rxuserrdy_t,
744 RUN_PHALIGNMENT =>
open,
745 RESET_PHALIGNMENT =>
open,
746 PHALIGNMENT_DONE => tied_to_vcc_i,
747 RXDFELFHOLD => gt0_rxdfelfhold_i,
748 RXLPMLFHOLD => gt0_rxlpmlfhold_i,
749 RXLPMHFHOLD => gt0_rxlpmhfhold_i,
750 RXDFEAGCHOLD =>
open,
751 RETRY_COUNTER =>
open
754 gt0_eq_dfe_mode: if EQ_MODE = "DFE" generate
757 AGC_TIMER => DFE_ADAPT_LOCK_TIMER
761 CTLE3_COMP_EN => '1',
762 GTRXRESET => gt0_gtrxreset_i,
--reset going to the GT, coming from either chipscope or TB
763 RXPMARESET => GT0_RXPMARESET_IN,
--tied to ground, going to GT
764 RXDFELPMRESET => gt0_rxdfelpmreset_i,
--tied to ground, going to GT
765 DCLK => GT0_DRPCLK_IN,
767 DRDY => gt0_drprdy_int,
768 DADDR => gt0_drpaddr_int,
770 DEN => gt0_drpen_int,
771 DWE => gt0_drpwe_int,
772 RXMONITOR => gt0_rxmonitorout_o,
773 RXMONITORSEL => gt0_rxmonitorsel_i,
774 AGCHOLD => gt0_rxdfeagchold_i,
777 DONE => gt0_adapt_done,
781 end generate gt0_eq_dfe_mode;
783 gt0_eq_lpm_mode: if EQ_MODE = "LPM" generate
786 TIMER => LPM_ADAPT_LOCK_TIMER
790 GTRXRESET => gt0_gtrxreset_i,
--reset going to the GT, coming from either chipscope or TB
791 RXPMARESET => GT0_RXPMARESET_IN,
--tied to ground, going to GT
792 RXDFELPMRESET => gt0_rxdfelpmreset_i,
--tied to ground, going to GT
793 DCLK => GT0_DRPCLK_IN,
795 DRDY => gt0_drprdy_int,
796 DADDR => gt0_drpaddr_int,
798 DEN => gt0_drpen_int,
799 DWE => gt0_drpwe_int,
802 DONE => gt0_adapt_done,
806 end generate gt0_eq_lpm_mode;
808 gt0_drpaddr_i <= GT0_DRPADDR_IN when (gt0_adapt_done='1') else gt0_drpaddr_int;
809 gt0_drpdi_i <= GT0_DRPDI_IN when (gt0_adapt_done='1') else gt0_drpdi_int;
810 gt0_drpen_i <= GT0_DRPEN_IN when (gt0_adapt_done='1') else gt0_drpen_int;
811 gt0_drpwe_i <= GT0_DRPWE_IN when (gt0_adapt_done='1') else gt0_drpwe_int;
812 GT0_DRPDO_OUT <= gt0_drpdo_o when (gt0_adapt_done='1') else "0000000000000000";
813 GT0_DRPRDY_OUT <= gt0_drprdy_o when (gt0_adapt_done='1') else '0';
815 gt0_drpdo_int <= gt0_drpdo_o;
816 gt0_drprdy_int <= gt0_drprdy_o;
821 cdrlock_timeout:
process(SYSCLK_IN)
823 if rising_edge(SYSCLK_IN) then
824 if(gt0_gtrxreset_i = '1') then
826 rx_cdrlock_counter <= 0 after DLY;
827 elsif (rx_cdrlock_counter = WAIT_TIME_CDRLOCK) then
829 rx_cdrlock_counter <= rx_cdrlock_counter after DLY;
831 rx_cdrlock_counter <= rx_cdrlock_counter + 1 after DLY;
836 gt0_recclk_stable_i <= rx_cdrlocked;