1 |
11 |
ashwin_men |
//*****************************************************************************/
|
2 |
|
|
// Module : sata_phy
|
3 |
|
|
// Version: 1.0
|
4 |
|
|
// Author: Ashwin Mendon
|
5 |
|
|
// Description: This module provides a wrapper for the SATA GTX wrapper modules
|
6 |
|
|
// the Out of Band Signaling controller module and the clock generating
|
7 |
|
|
// modules
|
8 |
|
|
// It has been modified from Xilinx XAPP870 to support Virtex 6 GTX
|
9 |
|
|
// transceivers
|
10 |
|
|
//*****************************************************************************/
|
11 |
|
|
|
12 |
|
|
module sata_phy
|
13 |
|
|
(
|
14 |
|
|
sata_phy_ila_control,
|
15 |
|
|
oob_control_ila_control,
|
16 |
|
|
REFCLK_PAD_P_IN,
|
17 |
|
|
REFCLK_PAD_N_IN,
|
18 |
|
|
TXP0_OUT,
|
19 |
|
|
TXN0_OUT,
|
20 |
|
|
RXP0_IN,
|
21 |
|
|
RXN0_IN,
|
22 |
|
|
PLLLKDET_OUT_N,
|
23 |
|
|
DCMLOCKED_OUT,
|
24 |
|
|
LINKUP_led,
|
25 |
|
|
GEN2_led,
|
26 |
|
|
sata_user_clk,
|
27 |
|
|
LINKUP,
|
28 |
|
|
align_en_out,
|
29 |
|
|
tx_datain,
|
30 |
|
|
tx_charisk_in,
|
31 |
|
|
rx_dataout,
|
32 |
|
|
rx_charisk_out,
|
33 |
|
|
CurrentState_out,
|
34 |
|
|
rxelecidle_out,
|
35 |
|
|
GTXRESET_IN,
|
36 |
|
|
CLKIN_150
|
37 |
|
|
);
|
38 |
|
|
|
39 |
|
|
parameter CHIPSCOPE = "TRUE";
|
40 |
|
|
input [35:0] sata_phy_ila_control;
|
41 |
|
|
input [35:0] oob_control_ila_control;
|
42 |
|
|
input REFCLK_PAD_P_IN; // GTX reference clock input
|
43 |
|
|
input REFCLK_PAD_N_IN; // GTX reference clock input
|
44 |
|
|
input RXP0_IN; // Receiver input
|
45 |
|
|
input RXN0_IN; // Receiver input
|
46 |
|
|
input GTXRESET_IN; // Main GTX reset
|
47 |
|
|
input CLKIN_150; // GTX reference clock input
|
48 |
|
|
// Input from Link Layer
|
49 |
|
|
input [31:0] tx_datain;
|
50 |
|
|
input tx_charisk_in;
|
51 |
|
|
|
52 |
|
|
output DCMLOCKED_OUT; // DCM locked
|
53 |
|
|
output PLLLKDET_OUT_N; // PLL Lock Detect
|
54 |
|
|
output TXP0_OUT;
|
55 |
|
|
output TXN0_OUT;
|
56 |
|
|
output LINKUP;
|
57 |
|
|
output LINKUP_led;
|
58 |
|
|
output GEN2_led;
|
59 |
|
|
output align_en_out;
|
60 |
|
|
output sata_user_clk;
|
61 |
|
|
// Outputs to Link Layer
|
62 |
|
|
output [31:0] rx_dataout;
|
63 |
|
|
output [3:0] rx_charisk_out;
|
64 |
|
|
output [7:0] CurrentState_out;
|
65 |
|
|
output rxelecidle_out;
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
wire [3:0] rxcharisk;
|
69 |
|
|
// OOB generate and detect
|
70 |
|
|
wire txcominit, txcomwake;
|
71 |
|
|
wire cominitdet, comwakedet;
|
72 |
|
|
// OOB generate and detect
|
73 |
|
|
wire sync_det_out, align_det_out;
|
74 |
|
|
wire tx_charisk_out;
|
75 |
|
|
wire txelecidle, rxelecidle0, rxelecidle1, rxenelecidleresetb;
|
76 |
|
|
wire resetdone0, resetdone1;
|
77 |
|
|
wire [31:0] txdata, rxdata; // TX/RX data
|
78 |
|
|
wire [31:0] rxdataout; // RX USER data
|
79 |
|
|
wire [4:0] state_out;
|
80 |
|
|
wire PLLLKDET_OUT;
|
81 |
|
|
wire linkup, linkup_led_out;
|
82 |
|
|
wire align_en_out;
|
83 |
|
|
wire clk0, clk2x, dcm_clk0, dcm_clkdv, dcm_clk2x; // DCM output clocks
|
84 |
|
|
wire mmcm_locked;
|
85 |
|
|
wire GEN2; //this is the selection for GEN2 when set to 1
|
86 |
|
|
wire speed_neg_rst;
|
87 |
|
|
wire rxreset; //GTX Rxreset
|
88 |
|
|
wire RXBYTEREALIGN0, RXBYTEISALIGNED0;
|
89 |
|
|
wire RXRECCLK0;
|
90 |
|
|
wire mmcm_reset;
|
91 |
|
|
wire rst_debounce;
|
92 |
|
|
wire mmcm_clk_in;
|
93 |
|
|
wire gtx_refclk;
|
94 |
|
|
wire gtx_refclk_bufg;
|
95 |
|
|
wire gtx_reset;
|
96 |
|
|
|
97 |
|
|
wire rst_0;
|
98 |
|
|
reg rst_1;
|
99 |
|
|
reg rst_2;
|
100 |
|
|
reg rst_3;
|
101 |
|
|
|
102 |
|
|
// Clock counters to check clock toggle
|
103 |
|
|
reg [15:0] gtx_refclk_count;
|
104 |
|
|
reg [15:0] gtx_refclk_bufg_count;
|
105 |
|
|
reg [15:0] gtx_txoutclk_count;
|
106 |
|
|
reg [15:0] gtx_txusrclk_count;
|
107 |
|
|
reg [15:0] gtx_txusrclk2_count;
|
108 |
|
|
reg [15:0] CLKIN_150_count;
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
//------------------------ MGT Wrapper Wires ------------------------------
|
112 |
|
|
//________________________________________________________________________
|
113 |
|
|
//________________________________________________________________________
|
114 |
|
|
//GTX0 (X0Y4)
|
115 |
|
|
|
116 |
|
|
//---------------------- Loopback and Powerdown Ports ----------------------
|
117 |
|
|
wire [2:0] gtx0_loopback_i;
|
118 |
|
|
//--------------------- Receive Ports - 8b10b Decoder ----------------------
|
119 |
|
|
wire [3:0] gtx0_rxdisperr_i;
|
120 |
|
|
wire [3:0] gtx0_rxnotintable_i;
|
121 |
|
|
//----------------- Receive Ports - Clock Correction Ports -----------------
|
122 |
|
|
wire [2:0] gtx0_rxclkcorcnt_i;
|
123 |
|
|
//------------- Receive Ports - Comma Detection and Alignment --------------
|
124 |
|
|
wire gtx0_rxbyteisaligned_i;
|
125 |
|
|
wire gtx0_rxbyterealign_i;
|
126 |
|
|
wire gtx0_rxenmcommaalign_i;
|
127 |
|
|
wire gtx0_rxenpcommaalign_i;
|
128 |
|
|
//----------------- Receive Ports - RX Data Path interface -----------------
|
129 |
|
|
wire [31:0] gtx0_rxdata_i;
|
130 |
|
|
wire gtx0_rxrecclk_i;
|
131 |
|
|
wire gtx0_rxreset_i;
|
132 |
|
|
//----- Receive Ports - RX Driver,OOB signalling,Coupling and Eq.,CDR ------
|
133 |
|
|
wire gtx0_rxelecidle_i;
|
134 |
|
|
wire [2:0] gtx0_rxeqmix_i;
|
135 |
|
|
//------ Receive Ports - RX Elastic Buffer and Phase Alignment Ports -------
|
136 |
|
|
wire gtx0_rxbufreset_i;
|
137 |
|
|
wire [2:0] gtx0_rxstatus_i;
|
138 |
|
|
//---------------------- Receive Ports - RX PLL Ports ----------------------
|
139 |
|
|
wire gtx0_gtxrxreset_i;
|
140 |
|
|
wire gtx0_pllrxreset_i;
|
141 |
|
|
wire gtx0_rxplllkdet_i;
|
142 |
|
|
wire gtx0_rxresetdone_i;
|
143 |
|
|
//------------------- Receive Ports - RX Ports for SATA --------------------
|
144 |
|
|
wire gtx0_cominitdet_i;
|
145 |
|
|
wire gtx0_comwakedet_i;
|
146 |
|
|
//-------------- Transmit Ports - 8b10b Encoder Control Ports --------------
|
147 |
|
|
wire [3:0] gtx0_txcharisk_i;
|
148 |
|
|
//---------------- Transmit Ports - TX Data Path interface -----------------
|
149 |
|
|
wire [31:0] gtx0_txdata_i;
|
150 |
|
|
wire gtx0_txoutclk_i;
|
151 |
|
|
wire gtx0_txreset_i;
|
152 |
|
|
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
|
153 |
|
|
wire [3:0] gtx0_txdiffctrl_i;
|
154 |
|
|
wire [4:0] gtx0_txpostemphasis_i;
|
155 |
|
|
//------------- Transmit Ports - TX Driver and OOB signalling --------------
|
156 |
|
|
wire [3:0] gtx0_txpreemphasis_i;
|
157 |
|
|
//--------------------- Transmit Ports - TX PLL Ports ----------------------
|
158 |
|
|
wire gtx0_gtxtxreset_i;
|
159 |
|
|
wire gtx0_txresetdone_i;
|
160 |
|
|
//--------------- Transmit Ports - TX Ports for PCI Express ----------------
|
161 |
|
|
wire gtx0_txelecidle_i;
|
162 |
|
|
//------------------- Transmit Ports - TX Ports for SATA -------------------
|
163 |
|
|
wire comfinish;
|
164 |
|
|
wire gtx0_txcominit_i;
|
165 |
|
|
wire gtx0_txcomwake_i;
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
//________________________________________________________________________
|
169 |
|
|
//________________________________________________________________________
|
170 |
|
|
//GTX1 (X0Y5)
|
171 |
|
|
|
172 |
|
|
//---------------------- Loopback and Powerdown Ports ----------------------
|
173 |
|
|
wire [2:0] gtx1_loopback_i;
|
174 |
|
|
//--------------------- Receive Ports - 8b10b Decoder ----------------------
|
175 |
|
|
wire [3:0] gtx1_rxdisperr_i;
|
176 |
|
|
wire [3:0] gtx1_rxnotintable_i;
|
177 |
|
|
//----------------- Receive Ports - Clock Correction Ports -----------------
|
178 |
|
|
wire [2:0] gtx1_rxclkcorcnt_i;
|
179 |
|
|
//------------- Receive Ports - Comma Detection and Alignment --------------
|
180 |
|
|
wire gtx1_rxbyteisaligned_i;
|
181 |
|
|
wire gtx1_rxbyterealign_i;
|
182 |
|
|
wire gtx1_rxenmcommaalign_i;
|
183 |
|
|
wire gtx1_rxenpcommaalign_i;
|
184 |
|
|
//----------------- Receive Ports - RX Data Path interface -----------------
|
185 |
|
|
wire [31:0] gtx1_rxdata_i;
|
186 |
|
|
wire gtx1_rxrecclk_i;
|
187 |
|
|
wire gtx1_rxreset_i;
|
188 |
|
|
//----- Receive Ports - RX Driver,OOB signalling,Coupling and Eq.,CDR ------
|
189 |
|
|
wire gtx1_rxelecidle_i;
|
190 |
|
|
wire [2:0] gtx1_rxeqmix_i;
|
191 |
|
|
//------ Receive Ports - RX Elastic Buffer and Phase Alignment Ports -------
|
192 |
|
|
wire gtx1_rxbufreset_i;
|
193 |
|
|
wire [2:0] gtx1_rxstatus_i;
|
194 |
|
|
//---------------------- Receive Ports - RX PLL Ports ----------------------
|
195 |
|
|
wire gtx1_gtxrxreset_i;
|
196 |
|
|
wire gtx1_pllrxreset_i;
|
197 |
|
|
wire gtx1_rxplllkdet_i;
|
198 |
|
|
wire gtx1_rxresetdone_i;
|
199 |
|
|
//------------------- Receive Ports - RX Ports for SATA --------------------
|
200 |
|
|
wire gtx1_cominitdet_i;
|
201 |
|
|
wire gtx1_comwakedet_i;
|
202 |
|
|
//-------------- Transmit Ports - 8b10b Encoder Control Ports --------------
|
203 |
|
|
wire [3:0] gtx1_txcharisk_i;
|
204 |
|
|
//---------------- Transmit Ports - TX Data Path interface -----------------
|
205 |
|
|
wire [31:0] gtx1_txdata_i;
|
206 |
|
|
wire gtx1_txoutclk_i;
|
207 |
|
|
wire gtx1_txreset_i;
|
208 |
|
|
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
|
209 |
|
|
wire [3:0] gtx1_txdiffctrl_i;
|
210 |
|
|
wire [4:0] gtx1_txpostemphasis_i;
|
211 |
|
|
//------------- Transmit Ports - TX Driver and OOB signalling --------------
|
212 |
|
|
wire [3:0] gtx1_txpreemphasis_i;
|
213 |
|
|
//--------------------- Transmit Ports - TX PLL Ports ----------------------
|
214 |
|
|
wire gtx1_gtxtxreset_i;
|
215 |
|
|
wire gtx1_txresetdone_i;
|
216 |
|
|
//--------------- Transmit Ports - TX Ports for PCI Express ----------------
|
217 |
|
|
wire gtx1_txelecidle_i;
|
218 |
|
|
//------------------- Transmit Ports - TX Ports for SATA -------------------
|
219 |
|
|
wire gtx1_comfinish_i;
|
220 |
|
|
wire gtx1_txcominit_i;
|
221 |
|
|
wire gtx1_txcomwake_i;
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
//----------------------------- Global Signals -----------------------------
|
226 |
|
|
wire gtx0_tx_system_reset_c;
|
227 |
|
|
wire gtx0_rx_system_reset_c;
|
228 |
|
|
wire gtx1_tx_system_reset_c;
|
229 |
|
|
wire gtx1_rx_system_reset_c;
|
230 |
|
|
wire tied_to_ground_i;
|
231 |
|
|
wire [63:0] tied_to_ground_vec_i;
|
232 |
|
|
wire tied_to_vcc_i;
|
233 |
|
|
wire [7:0] tied_to_vcc_vec_i;
|
234 |
|
|
wire drp_clk_in_i;
|
235 |
|
|
|
236 |
|
|
//--------------------------- User Clocks ---------------------------------
|
237 |
|
|
wire gtx0_txusrclk_i;
|
238 |
|
|
wire gtx0_txusrclk2_i;
|
239 |
|
|
wire txoutclk_mmcm0_locked_i;
|
240 |
|
|
wire txoutclk_mmcm0_reset_i;
|
241 |
|
|
wire gtx0_txoutclk_to_mmcm_i;
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
//--------------------------- Reference Clocks ----------------------------
|
245 |
|
|
|
246 |
|
|
wire q1_clk1_refclk_i;
|
247 |
|
|
wire q1_clk1_refclk_i_bufg;
|
248 |
|
|
//--------------------------- Reference Clocks ----------------------------
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
// Static signal Assigments
|
252 |
|
|
assign tied_to_ground_i = 1'b0;
|
253 |
|
|
assign tied_to_ground_vec_i = 64'h0000000000000000;
|
254 |
|
|
assign tied_to_vcc_i = 1'b1;
|
255 |
|
|
assign tied_to_vcc_vec_i = 8'hff;
|
256 |
|
|
|
257 |
|
|
// GTX Reset
|
258 |
|
|
assign rst_0 = GTXRESET_IN;
|
259 |
|
|
|
260 |
|
|
always @(posedge CLKIN_150)
|
261 |
|
|
begin
|
262 |
|
|
rst_1 <= rst_0;
|
263 |
|
|
rst_2 <= rst_1;
|
264 |
|
|
rst_3 <= rst_2;
|
265 |
|
|
end
|
266 |
|
|
|
267 |
|
|
assign rst_debounce = (rst_1 & rst_2 & rst_3);
|
268 |
|
|
|
269 |
|
|
//assign gtx_reset = rst_debounce|| speed_neg_rst;
|
270 |
|
|
assign gtx_reset = rst_debounce;
|
271 |
|
|
//assign mmcm_reset = ~PLLLKDET_OUT || speed_neg_rst;
|
272 |
|
|
assign mmcm_reset = ~PLLLKDET_OUT;
|
273 |
|
|
|
274 |
|
|
assign GEN2_led = GEN2;
|
275 |
|
|
assign LINKUP = linkup;
|
276 |
|
|
assign LINKUP_led = linkup_led_out;
|
277 |
|
|
assign align_en_out = align_en_out;
|
278 |
|
|
assign DCMLOCKED_OUT = mmcm_locked; // LED active high
|
279 |
|
|
|
280 |
|
|
assign PLLLKDET_OUT_N = PLLLKDET_OUT;
|
281 |
|
|
assign rxelecidlereset0 = (rxelecidle0 && resetdone0);
|
282 |
|
|
assign rxenelecidleresetb = !rxelecidlereset0;
|
283 |
|
|
|
284 |
|
|
assign rx_dataout = rxdataout;
|
285 |
|
|
|
286 |
|
|
// SATA PHY output clock assignments
|
287 |
|
|
assign sata_user_clk = gtx0_txusrclk2_i;
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
OOB_control OOB_control_i
|
291 |
|
|
(
|
292 |
|
|
.oob_control_ila_control (oob_control_ila_control),
|
293 |
|
|
//-------- GTX Ports --------/
|
294 |
|
|
.clk (gtx0_txusrclk2_i),
|
295 |
|
|
.reset (gtx_reset),
|
296 |
|
|
.rxreset (rxreset),
|
297 |
|
|
.rx_locked (PLLLKDET_OUT),
|
298 |
|
|
// OOB generation and detection signals from GTX
|
299 |
|
|
.txcominit (txcominit),
|
300 |
|
|
.txcomwake (txcomwake),
|
301 |
|
|
.cominitdet (cominitdet),
|
302 |
|
|
.comwakedet (comwakedet),
|
303 |
|
|
|
304 |
|
|
.rxelecidle (rxelecidle0),
|
305 |
|
|
.txelecidle_out (txelecidle),
|
306 |
|
|
.rxbyteisaligned (RXBYTEISALIGNED0),
|
307 |
|
|
.tx_dataout (txdata), // outgoing GTX data
|
308 |
|
|
.tx_charisk_out (tx_charisk_out), // GTX charisk out
|
309 |
|
|
.rx_datain (rxdata), // incoming GTX data
|
310 |
|
|
.rx_charisk_in (rxcharisk), // GTX charisk in
|
311 |
|
|
.gen2 (1'b1), // for SATA Generation 2
|
312 |
|
|
|
313 |
|
|
//----- USER DATA PORTS---------//
|
314 |
|
|
.tx_datain (tx_datain), // User datain port
|
315 |
|
|
.tx_charisk_in (tx_charisk_in), // User charisk in port
|
316 |
|
|
.rx_dataout (rxdataout), // User dataout port
|
317 |
|
|
.rx_charisk_out (rx_charisk_out), // User charisk out port
|
318 |
|
|
.linkup (linkup),
|
319 |
|
|
.linkup_led_out (linkup_led_out),
|
320 |
|
|
.align_en_out (align_en_out),
|
321 |
|
|
.CurrentState_out (CurrentState_out)
|
322 |
|
|
);
|
323 |
|
|
|
324 |
|
|
assign rxelecidle_out = rxelecidle0;
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
//---------------------Dedicated GTX Reference Clock Inputs ---------------
|
329 |
|
|
// The dedicated reference clock inputs you selected in the GUI are implemented using
|
330 |
|
|
// IBUFDS_GTXE1 instances.
|
331 |
|
|
//
|
332 |
|
|
// In the UCF file for this example design, you will see that each of
|
333 |
|
|
// these IBUFDS_GTXE1 instances has been LOCed to a particular set of pins. By LOCing to these
|
334 |
|
|
// locations, we tell the tools to use the dedicated input buffers to the GTX reference
|
335 |
|
|
// clock network, rather than general purpose IOs. To select other pins, consult the
|
336 |
|
|
// Implementation chapter of UG___, or rerun the wizard.
|
337 |
|
|
//
|
338 |
|
|
// This network is the highest performace (lowest jitter) option for providing clocks
|
339 |
|
|
// to the GTX transceivers.
|
340 |
|
|
|
341 |
|
|
IBUFDS_GTXE1 gtx_refclk_ibufds_i
|
342 |
|
|
(
|
343 |
|
|
.O (gtx_refclk),
|
344 |
|
|
.ODIV2 (),
|
345 |
|
|
.CEB (tied_to_ground_i),
|
346 |
|
|
.I (REFCLK_PAD_P_IN),
|
347 |
|
|
.IB (REFCLK_PAD_N_IN)
|
348 |
|
|
);
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
BUFG gtx_refclk_bufg_i
|
352 |
|
|
(
|
353 |
|
|
.I (gtx_refclk),
|
354 |
|
|
.O (gtx_refclk_bufg)
|
355 |
|
|
);
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
//--------------------------------- User Clocks ---------------------------
|
360 |
|
|
|
361 |
|
|
// The clock resources in this section were added based on userclk source selections on
|
362 |
|
|
// the Latency, Buffering, and Clocking page of the GUI. A few notes about user clocks:
|
363 |
|
|
// * The userclk and userclk2 for each GTX datapath (TX and RX) must be phase aligned to
|
364 |
|
|
// avoid data errors in the fabric interface whenever the datapath is wider than 10 bits
|
365 |
|
|
// * To minimize clock resources, you can share clocks between GTXs. GTXs using the same frequency
|
366 |
|
|
// or multiples of the same frequency can be accomadated using MMCMs. Use caution when
|
367 |
|
|
// using RXRECCLK as a clock source, however - these clocks can typically only be shared if all
|
368 |
|
|
// the channels using the clock are receiving data from TX channels that share a reference clock
|
369 |
|
|
// source with each other.
|
370 |
|
|
|
371 |
|
|
// assign txoutclk_mmcm0_reset_i = !gtx0_rxplllkdet_i;
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
BUFG txoutclk_bufg_i
|
376 |
|
|
(
|
377 |
|
|
.I (gtx0_txoutclk_i),
|
378 |
|
|
.O (mmcm_clk_in)
|
379 |
|
|
);
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
MGT_USRCLK_SOURCE_MMCM #
|
383 |
|
|
(
|
384 |
|
|
.MULT (8.0),
|
385 |
|
|
.DIVIDE (2),
|
386 |
|
|
.CLK_PERIOD (6.666),
|
387 |
|
|
.OUT0_DIVIDE (4.0),
|
388 |
|
|
.OUT1_DIVIDE (2.0),
|
389 |
|
|
.OUT2_DIVIDE (1),
|
390 |
|
|
.OUT3_DIVIDE (1)
|
391 |
|
|
)
|
392 |
|
|
txoutclk_mmcm0_i
|
393 |
|
|
(
|
394 |
|
|
.CLK0_OUT (gtx0_txusrclk2_i),
|
395 |
|
|
.CLK1_OUT (gtx0_txusrclk_i),
|
396 |
|
|
.CLK2_OUT (),
|
397 |
|
|
.CLK3_OUT (),
|
398 |
|
|
.CLK_IN (mmcm_clk_in),
|
399 |
|
|
.MMCM_LOCKED_OUT (mmcm_locked),
|
400 |
|
|
.MMCM_RESET_IN (mmcm_reset)
|
401 |
|
|
);
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
//instantiate GTX tile(two transceivers)
|
405 |
|
|
|
406 |
|
|
SATA_GTX_DUAL #
|
407 |
|
|
(
|
408 |
|
|
.WRAPPER_SIM_GTXRESET_SPEEDUP (0),
|
409 |
|
|
)
|
410 |
|
|
sata_gtx_dual_i
|
411 |
|
|
(
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
//_____________________________________________________________________
|
415 |
|
|
//_____________________________________________________________________
|
416 |
|
|
//GTX0 (X0Y4)
|
417 |
|
|
//---------------------- Loopback and Powerdown Ports ----------------------
|
418 |
|
|
.GTX0_LOOPBACK_IN (gtx0_loopback_i),
|
419 |
|
|
//--------------------- Receive Ports - 8b10b Decoder ----------------------
|
420 |
|
|
.GTX0_RXCHARISK_OUT (rxcharisk),
|
421 |
|
|
.GTX0_RXDISPERR_OUT (gtx0_rxdisperr_i),
|
422 |
|
|
.GTX0_RXNOTINTABLE_OUT (gtx0_rxnotintable_i),
|
423 |
|
|
//----------------- Receive Ports - Clock Correction Ports -----------------
|
424 |
|
|
.GTX0_RXCLKCORCNT_OUT (gtx0_rxclkcorcnt_i),
|
425 |
|
|
//------------- Receive Ports - Comma Detection and Alignment --------------
|
426 |
|
|
.GTX0_RXBYTEISALIGNED_OUT (RXBYTEISALIGNED0),
|
427 |
|
|
.GTX0_RXBYTEREALIGN_OUT (gtx0_rxbyterealign_i),
|
428 |
|
|
.GTX0_RXENMCOMMAALIGN_IN (gtx0_rxenmcommaalign_i),
|
429 |
|
|
.GTX0_RXENPCOMMAALIGN_IN (gtx0_rxenpcommaalign_i),
|
430 |
|
|
//----------------- Receive Ports - RX Data Path interface -----------------
|
431 |
|
|
.GTX0_RXDATA_OUT (rxdata),
|
432 |
|
|
.GTX0_RXRECCLK_OUT (gtx0_rxrecclk_i),
|
433 |
|
|
.GTX0_RXRESET_IN (rxreset),
|
434 |
|
|
.GTX0_RXUSRCLK_IN (gtx0_txusrclk_i),
|
435 |
|
|
.GTX0_RXUSRCLK2_IN (gtx0_txusrclk2_i),
|
436 |
|
|
//----- Receive Ports - RX Driver,OOB signalling,Coupling and Eq.,CDR ------
|
437 |
|
|
.GTX0_RXELECIDLE_OUT (rxelecidle0),
|
438 |
|
|
.GTX0_RXEQMIX_IN (gtx0_rxeqmix_i),
|
439 |
|
|
.GTX0_RXN_IN (RXN0_IN),
|
440 |
|
|
.GTX0_RXP_IN (RXP0_IN),
|
441 |
|
|
//------ Receive Ports - RX Elastic Buffer and Phase Alignment Ports -------
|
442 |
|
|
.GTX0_RXBUFRESET_IN (gtx_reset),
|
443 |
|
|
.GTX0_RXSTATUS_OUT (gtx0_rxstatus_i),
|
444 |
|
|
//---------------------- Receive Ports - RX PLL Ports ----------------------
|
445 |
|
|
.GTX0_GTXRXRESET_IN (gtx_reset),
|
446 |
|
|
.GTX0_MGTREFCLKRX_IN (CLKIN_150),
|
447 |
|
|
.GTX0_PLLRXRESET_IN (),
|
448 |
|
|
.GTX0_RXPLLLKDET_OUT (PLLLKDET_OUT),
|
449 |
|
|
.GTX0_RXRESETDONE_OUT (gtx0_rxresetdone_i),
|
450 |
|
|
//------------------- Receive Ports - RX Ports for SATA --------------------
|
451 |
|
|
.GTX0_COMINITDET_OUT (cominitdet),
|
452 |
|
|
.GTX0_COMWAKEDET_OUT (comwakedet),
|
453 |
|
|
//----------- Shared Ports - Dynamic Reconfiguration Port (DRP) ------------
|
454 |
|
|
// Speed Negotiation Control module is disabled here and the design is fixed for
|
455 |
|
|
// SATA GEN2 disks
|
456 |
|
|
.DADDR (7'b0),
|
457 |
|
|
.DCLK (mmcm_clk_in),
|
458 |
|
|
.DEN (1'b0),
|
459 |
|
|
.DI (16'b0),
|
460 |
|
|
.DRDY (),
|
461 |
|
|
.DO (),
|
462 |
|
|
.DWE (1'b0),
|
463 |
|
|
//-------------- Transmit Ports - 8b10b Encoder Control Ports --------------
|
464 |
|
|
.GTX0_TXCHARISK_IN ({1'b0,1'b0,1'b0,tx_charisk_out}),
|
465 |
|
|
//.GTX0_TXCHARISK_IN ({1'b0,tx_charisk_out,1'b0,tx_charisk_out}),
|
466 |
|
|
//---------------- Transmit Ports - TX Data Path interface -----------------
|
467 |
|
|
.GTX0_TXDATA_IN (txdata),
|
468 |
|
|
.GTX0_TXOUTCLK_OUT (gtx0_txoutclk_i),
|
469 |
|
|
.GTX0_TXRESET_IN (),
|
470 |
|
|
.GTX0_TXUSRCLK_IN (gtx0_txusrclk_i),
|
471 |
|
|
.GTX0_TXUSRCLK2_IN (gtx0_txusrclk2_i),
|
472 |
|
|
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
|
473 |
|
|
.GTX0_TXDIFFCTRL_IN (gtx0_txdiffctrl_i),
|
474 |
|
|
.GTX0_TXN_OUT (TXN0_OUT),
|
475 |
|
|
.GTX0_TXP_OUT (TXP0_OUT),
|
476 |
|
|
.GTX0_TXPOSTEMPHASIS_IN (gtx0_txpostemphasis_i),
|
477 |
|
|
//------------- Transmit Ports - TX Driver and OOB signalling --------------
|
478 |
|
|
.GTX0_TXPREEMPHASIS_IN (gtx0_txpreemphasis_i),
|
479 |
|
|
//--------------------- Transmit Ports - TX PLL Ports ----------------------
|
480 |
|
|
.GTX0_GTXTXRESET_IN (gtx_reset),
|
481 |
|
|
.GTX0_TXRESETDONE_OUT (gtx0_txresetdone_i),
|
482 |
|
|
//--------------- Transmit Ports - TX Ports for PCI Express ----------------
|
483 |
|
|
.GTX0_TXELECIDLE_IN (txelecidle),
|
484 |
|
|
//------------------- Transmit Ports - TX Ports for SATA -------------------
|
485 |
|
|
.GTX0_COMFINISH_OUT (comfinish),
|
486 |
|
|
.GTX0_TXCOMINIT_IN (txcominit),
|
487 |
|
|
.GTX0_TXCOMWAKE_IN (txcomwake),
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
//_____________________________________________________________________
|
491 |
|
|
//_____________________________________________________________________
|
492 |
|
|
//GTX1 (X0Y5)
|
493 |
|
|
//---------------------- Loopback and Powerdown Ports ----------------------
|
494 |
|
|
.GTX1_LOOPBACK_IN (gtx1_loopback_i),
|
495 |
|
|
//--------------------- Receive Ports - 8b10b Decoder ----------------------
|
496 |
|
|
.GTX1_RXDISPERR_OUT (gtx1_rxdisperr_i),
|
497 |
|
|
.GTX1_RXNOTINTABLE_OUT (gtx1_rxnotintable_i),
|
498 |
|
|
//----------------- Receive Ports - Clock Correction Ports -----------------
|
499 |
|
|
.GTX1_RXCLKCORCNT_OUT (gtx1_rxclkcorcnt_i),
|
500 |
|
|
//------------- Receive Ports - Comma Detection and Alignment --------------
|
501 |
|
|
.GTX1_RXBYTEISALIGNED_OUT (),
|
502 |
|
|
.GTX1_RXBYTEREALIGN_OUT (gtx1_rxbyterealign_i),
|
503 |
|
|
.GTX1_RXENMCOMMAALIGN_IN (gtx1_rxenmcommaalign_i),
|
504 |
|
|
.GTX1_RXENPCOMMAALIGN_IN (gtx1_rxenpcommaalign_i),
|
505 |
|
|
//----------------- Receive Ports - RX Data Path interface -----------------
|
506 |
|
|
.GTX1_RXDATA_OUT (),
|
507 |
|
|
.GTX1_RXRECCLK_OUT (gtx1_rxrecclk_i),
|
508 |
|
|
.GTX1_RXRESET_IN (rxreset),
|
509 |
|
|
.GTX1_RXUSRCLK_IN (gtx0_txusrclk_i),
|
510 |
|
|
.GTX1_RXUSRCLK2_IN (gtx0_txusrclk2_i),
|
511 |
|
|
//----- Receive Ports - RX Driver,OOB signalling,Coupling and Eq.,CDR ------
|
512 |
|
|
.GTX1_RXELECIDLE_OUT (rxelecidle1),
|
513 |
|
|
.GTX1_RXEQMIX_IN (gtx1_rxeqmix_i),
|
514 |
|
|
.GTX1_RXN_IN (),
|
515 |
|
|
.GTX1_RXP_IN (),
|
516 |
|
|
//------ Receive Ports - RX Elastic Buffer and Phase Alignment Ports -------
|
517 |
|
|
.GTX1_RXBUFRESET_IN (gtx_reset),
|
518 |
|
|
.GTX1_RXSTATUS_OUT (),
|
519 |
|
|
//---------------------- Receive Ports - RX PLL Ports ----------------------
|
520 |
|
|
.GTX1_GTXRXRESET_IN (gtx_reset),
|
521 |
|
|
.GTX1_MGTREFCLKRX_IN (CLKIN_150),
|
522 |
|
|
.GTX1_PLLRXRESET_IN (),
|
523 |
|
|
.GTX1_RXPLLLKDET_OUT (gtx1_rxplllkdet_i),
|
524 |
|
|
.GTX1_RXRESETDONE_OUT (gtx1_rxresetdone_i),
|
525 |
|
|
//------------------- Receive Ports - RX Ports for SATA --------------------
|
526 |
|
|
.GTX1_COMINITDET_OUT (gtx1_cominitdet_i),
|
527 |
|
|
.GTX1_COMWAKEDET_OUT (gtx1_comwakedet_i),
|
528 |
|
|
//-------------- Transmit Ports - 8b10b Encoder Control Ports --------------
|
529 |
|
|
.GTX1_TXCHARISK_IN ({1'b0,1'b0,1'b0,tx_charisk_out}),
|
530 |
|
|
//.GTX1_TXCHARISK_IN ({1'b0,tx_charisk_out,1'b0,tx_charisk_out}),
|
531 |
|
|
//---------------- Transmit Ports - TX Data Path interface -----------------
|
532 |
|
|
.GTX1_TXDATA_IN (txdata),
|
533 |
|
|
.GTX1_TXOUTCLK_OUT (gtx1_txoutclk_i),
|
534 |
|
|
.GTX1_TXRESET_IN (),
|
535 |
|
|
.GTX1_TXUSRCLK_IN (gtx0_txusrclk_i),
|
536 |
|
|
.GTX1_TXUSRCLK2_IN (gtx0_txusrclk2_i),
|
537 |
|
|
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
|
538 |
|
|
.GTX1_TXDIFFCTRL_IN (gtx1_txdiffctrl_i),
|
539 |
|
|
.GTX1_TXN_OUT (),
|
540 |
|
|
.GTX1_TXP_OUT (),
|
541 |
|
|
.GTX1_TXPOSTEMPHASIS_IN (gtx1_txpostemphasis_i),
|
542 |
|
|
//------------- Transmit Ports - TX Driver and OOB signalling --------------
|
543 |
|
|
.GTX1_TXPREEMPHASIS_IN (gtx1_txpreemphasis_i),
|
544 |
|
|
//--------------------- Transmit Ports - TX PLL Ports ----------------------
|
545 |
|
|
.GTX1_GTXTXRESET_IN (gtx_reset),
|
546 |
|
|
.GTX1_TXRESETDONE_OUT (gtx1_txresetdone_i),
|
547 |
|
|
//--------------- Transmit Ports - TX Ports for PCI Express ----------------
|
548 |
|
|
.GTX1_TXELECIDLE_IN (txelecidle),
|
549 |
|
|
//------------------- Transmit Ports - TX Ports for SATA -------------------
|
550 |
|
|
.GTX1_COMFINISH_OUT (gtx1_comfinish_i),
|
551 |
|
|
.GTX1_TXCOMINIT_IN (gtx1_txcominit_i),
|
552 |
|
|
.GTX1_TXCOMWAKE_IN (gtx1_txcomwake_i)
|
553 |
|
|
|
554 |
|
|
);
|
555 |
|
|
/* Note: The Transmitter Differential Voltage Swing is set by the TXDIFFCTRL parameter
|
556 |
|
|
in the GTX transceivers. It defaults to 4'b0000 resulting in a voltage of 110 mV p-p.
|
557 |
|
|
Set it to 4'b1000 to raise the voltage to 810 mV p-p. (Refer Pg 174 of V6 GTX user guide).
|
558 |
|
|
This is necessary for the transmission of OOB signals during PHY Initialization. */
|
559 |
|
|
assign gtx0_txdiffctrl_i = 4'b1000;
|
560 |
|
|
assign gtx1_txdiffctrl_i = 4'b1000;
|
561 |
|
|
|
562 |
|
|
|
563 |
|
|
|
564 |
|
|
// Debugging
|
565 |
|
|
always @(posedge gtx_refclk_bufg)
|
566 |
|
|
begin : GTX_REF_CLK_CNT
|
567 |
|
|
begin
|
568 |
|
|
gtx_refclk_count <= gtx_refclk_count + 1;
|
569 |
|
|
end
|
570 |
|
|
end
|
571 |
|
|
|
572 |
|
|
always @(posedge mmcm_clk_in)
|
573 |
|
|
begin : GTX_TXOUTCLK_CNT
|
574 |
|
|
begin
|
575 |
|
|
gtx_txoutclk_count <= gtx_txoutclk_count + 1;
|
576 |
|
|
end
|
577 |
|
|
end
|
578 |
|
|
|
579 |
|
|
|
580 |
|
|
always @(posedge gtx0_txusrclk_i)
|
581 |
|
|
begin : GTX_TXUSRCLK_CNT
|
582 |
|
|
begin
|
583 |
|
|
gtx_txusrclk_count <= gtx_txusrclk_count + 1;
|
584 |
|
|
end
|
585 |
|
|
end
|
586 |
|
|
|
587 |
|
|
always @(posedge gtx0_txusrclk2_i)
|
588 |
|
|
begin : GTX_TXUSRCLK2_CNT
|
589 |
|
|
begin
|
590 |
|
|
gtx_txusrclk2_count <= gtx_txusrclk2_count + 1;
|
591 |
|
|
end
|
592 |
|
|
end
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
always @(posedge CLKIN_150)
|
596 |
|
|
begin : CLKIN_150_CNT
|
597 |
|
|
begin
|
598 |
|
|
CLKIN_150_count <= CLKIN_150_count + 1;
|
599 |
|
|
end
|
600 |
|
|
end
|
601 |
|
|
|
602 |
|
|
|
603 |
|
|
// SATA PHY ILA
|
604 |
|
|
wire [7:0] trig0;
|
605 |
|
|
wire [15:0] trig1;
|
606 |
|
|
wire [1:0] trig2;
|
607 |
|
|
wire [15:0] trig3;
|
608 |
|
|
wire [15:0] trig4;
|
609 |
|
|
wire [15:0] trig5;
|
610 |
|
|
wire [15:0] trig6;
|
611 |
|
|
wire [15:0] trig7;
|
612 |
|
|
wire [15:0] trig8;
|
613 |
|
|
wire [15:0] trig9;
|
614 |
|
|
wire [15:0] trig10;
|
615 |
|
|
wire [35:0] control;
|
616 |
|
|
|
617 |
|
|
if (CHIPSCOPE == "TRUE") begin
|
618 |
|
|
sata_phy_ila i_sata_phy_ila
|
619 |
|
|
(
|
620 |
|
|
.control(sata_phy_ila_control),
|
621 |
|
|
.clk(gtx0_txusrclk2_i),
|
622 |
|
|
.trig0(trig0),
|
623 |
|
|
.trig1(trig1),
|
624 |
|
|
.trig2(trig2),
|
625 |
|
|
.trig3(trig3),
|
626 |
|
|
.trig4(trig4),
|
627 |
|
|
.trig5(trig5),
|
628 |
|
|
.trig6(trig6),
|
629 |
|
|
.trig7(trig7),
|
630 |
|
|
.trig8(trig8),
|
631 |
|
|
.trig9(trig9),
|
632 |
|
|
.trig10(trig10)
|
633 |
|
|
);
|
634 |
|
|
end
|
635 |
|
|
|
636 |
|
|
assign trig0 = CurrentState_out;
|
637 |
|
|
assign trig1[0] = gtx0_rxstatus_i;
|
638 |
|
|
assign trig1[1] = gtx0_txusrclk_i;
|
639 |
|
|
assign trig1[2] = gtx0_txusrclk2_i;
|
640 |
|
|
assign trig1[3] = gtx_reset;
|
641 |
|
|
assign trig1[4] = comfinish;
|
642 |
|
|
assign trig1[5] = PLLLKDET_OUT;
|
643 |
|
|
assign trig1[6] = mmcm_reset;
|
644 |
|
|
assign trig1[7] = mmcm_locked;
|
645 |
|
|
assign trig1[8] = rxelecidle0;
|
646 |
|
|
assign trig1[9] = RXBYTEISALIGNED0;
|
647 |
|
|
assign trig1[10] = gtx0_rxresetdone_i;
|
648 |
|
|
assign trig1[11] = txelecidle;
|
649 |
|
|
assign trig1[12] = txcominit;
|
650 |
|
|
assign trig1[13] = txcomwake;
|
651 |
|
|
assign trig1[14] = cominitdet;
|
652 |
|
|
assign trig1[15] = comwakedet;
|
653 |
|
|
assign trig2 = 2'b0;
|
654 |
|
|
assign trig3[0] = gtx0_txresetdone_i;
|
655 |
|
|
assign trig3[1] = speed_neg_rst;
|
656 |
|
|
assign trig3[2] = GTXRESET_IN;
|
657 |
|
|
assign trig3[3] = rst_1;
|
658 |
|
|
assign trig3[6:4] = rxcharisk;
|
659 |
|
|
assign trig3[15:7] = 9'b0;
|
660 |
|
|
assign trig4 = gtx_refclk_count;
|
661 |
|
|
assign trig5 = gtx_txoutclk_count;
|
662 |
|
|
assign trig6 = gtx_txusrclk_count;
|
663 |
|
|
assign trig7 = gtx_txusrclk2_count;
|
664 |
|
|
assign trig8 = 16'b0;
|
665 |
|
|
assign trig9 = 16'b0;
|
666 |
|
|
assign trig10 = CLKIN_150_count;
|
667 |
|
|
|
668 |
|
|
endmodule
|
669 |
|
|
|
670 |
|
|
|
671 |
|
|
module sata_phy_ila
|
672 |
|
|
(
|
673 |
|
|
control,
|
674 |
|
|
clk,
|
675 |
|
|
trig0,
|
676 |
|
|
trig1,
|
677 |
|
|
trig2,
|
678 |
|
|
trig3,
|
679 |
|
|
trig4,
|
680 |
|
|
trig5,
|
681 |
|
|
trig6,
|
682 |
|
|
trig7,
|
683 |
|
|
trig8,
|
684 |
|
|
trig9,
|
685 |
|
|
trig10
|
686 |
|
|
);
|
687 |
|
|
input [35:0] control;
|
688 |
|
|
input clk;
|
689 |
|
|
input [7:0] trig0;
|
690 |
|
|
input [15:0] trig1;
|
691 |
|
|
input [1:0] trig2;
|
692 |
|
|
input [15:0] trig3;
|
693 |
|
|
input [15:0] trig4;
|
694 |
|
|
input [15:0] trig5;
|
695 |
|
|
input [15:0] trig6;
|
696 |
|
|
input [15:0] trig7;
|
697 |
|
|
input [15:0] trig8;
|
698 |
|
|
input [15:0] trig9;
|
699 |
|
|
input [15:0] trig10;
|
700 |
|
|
|
701 |
|
|
endmodule
|