OpenCores
URL https://opencores.org/ocsvn/pcie_sg_dma/pcie_sg_dma/trunk

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE12.3/] [ipcore_dir_ISE12.1/] [v6_pcie_v1_3/] [source/] [pcie_gtx_v6.v] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 barabba
//-----------------------------------------------------------------------------
2
//
3
// (c) Copyright 2009 Xilinx, Inc. All rights reserved.
4
//
5
// This file contains confidential and proprietary information of Xilinx, Inc.
6
// and is protected under U.S. and international copyright and other
7
// intellectual property laws.
8
//
9
// DISCLAIMER
10
//
11
// This disclaimer is not a license and does not grant any rights to the
12
// materials distributed herewith. Except as otherwise provided in a valid
13
// license issued to you by Xilinx, and to the maximum extent permitted by
14
// applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
15
// FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
16
// IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
17
// MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
18
// and (2) Xilinx shall not be liable (whether in contract or tort, including
19
// negligence, or under any other theory of liability) for any loss or damage
20
// of any kind or nature related to, arising under or in connection with these
21
// materials, including for any direct, or any indirect, special, incidental,
22
// or consequential loss or damage (including loss of data, profits, goodwill,
23
// or any type of loss or damage suffered as a result of any action brought by
24
// a third party) even if such damage or loss was reasonably foreseeable or
25
// Xilinx had been advised of the possibility of the same.
26
//
27
// CRITICAL APPLICATIONS
28
//
29
// Xilinx products are not designed or intended to be fail-safe, or for use in
30
// any application requiring fail-safe performance, such as life-support or
31
// safety devices or systems, Class III medical devices, nuclear facilities,
32
// applications related to the deployment of airbags, or any other
33
// applications that could lead to death, personal injury, or severe property
34
// or environmental damage (individually and collectively, "Critical
35
// Applications"). Customer assumes the sole risk and liability of any use of
36
// Xilinx products in Critical Applications, subject only to applicable laws
37
// and regulations governing limitations on product liability.
38
//
39
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
40
// AT ALL TIMES.
41
//
42
//-----------------------------------------------------------------------------
43
// Project    : Virtex-6 Integrated Block for PCI Express
44
// File       : pcie_gtx_v6.v
45
//-- Description: GTX module for Virtex6 PCIe Block
46
//--
47
//--
48
//--
49
//--------------------------------------------------------------------------------
50
 
51
`timescale 1ns/1ns
52
 
53
module pcie_gtx_v6 #
54
(
55
   parameter                         NO_OF_LANES = 8,         // 1 - x1 , 2 - x2 , 4 - x4 , 8 - x8
56
   parameter                         LINK_CAP_MAX_LINK_SPEED = 4'h1,  // 1 - Gen1, 2 - Gen2
57
   parameter                         REF_CLK_FREQ = 0,        // 0 - 100 MHz , 1 - 125 MHz , 2 - 250 MHz
58
   parameter                         PL_FAST_TRAIN = "FALSE"
59
)
60
(
61
   // Pipe Per-Link Signals     
62
   input   wire                      pipe_tx_rcvr_det       ,
63
   input   wire                      pipe_tx_reset          ,
64
   input   wire                      pipe_tx_rate           ,
65
   input   wire                      pipe_tx_deemph         ,
66
   input   wire [2:0]                pipe_tx_margin         ,
67
   input   wire                      pipe_tx_swing          ,
68
 
69
   // Pipe Per-Lane Signals - Lane 0
70
   output  wire [ 1:0]               pipe_rx0_char_is_k     ,
71
   output  wire [15:0]               pipe_rx0_data          ,
72
   output  wire                      pipe_rx0_valid         ,
73
   output  wire                      pipe_rx0_chanisaligned ,
74
   output  wire [ 2:0]               pipe_rx0_status        ,
75
   output  wire                      pipe_rx0_phy_status    ,
76
   output  wire                      pipe_rx0_elec_idle     ,
77
   input   wire                      pipe_rx0_polarity      ,
78
   input   wire                      pipe_tx0_compliance    ,
79
   input   wire [ 1:0]               pipe_tx0_char_is_k     ,
80
   input   wire [15:0]               pipe_tx0_data          ,
81
   input   wire                      pipe_tx0_elec_idle     ,
82
   input   wire [ 1:0]               pipe_tx0_powerdown     ,
83
 
84
   // Pipe Per-Lane Signals - Lane 1
85
   output  wire [ 1:0]               pipe_rx1_char_is_k     ,
86
   output  wire [15:0]               pipe_rx1_data          ,
87
   output  wire                      pipe_rx1_valid         ,
88
   output  wire                      pipe_rx1_chanisaligned ,
89
   output  wire [ 2:0]               pipe_rx1_status        ,
90
   output  wire                      pipe_rx1_phy_status    ,
91
   output  wire                      pipe_rx1_elec_idle     ,
92
   input   wire                      pipe_rx1_polarity      ,
93
   input   wire                      pipe_tx1_compliance    ,
94
   input   wire [ 1:0]               pipe_tx1_char_is_k     ,
95
   input   wire [15:0]               pipe_tx1_data          ,
96
   input   wire                      pipe_tx1_elec_idle     ,
97
   input   wire [ 1:0]               pipe_tx1_powerdown     ,
98
 
99
   // Pipe Per-Lane Signals - Lane 2
100
   output  wire [ 1:0]               pipe_rx2_char_is_k     ,
101
   output  wire [15:0]               pipe_rx2_data          ,
102
   output  wire                      pipe_rx2_valid         ,
103
   output  wire                      pipe_rx2_chanisaligned ,
104
   output  wire [ 2:0]               pipe_rx2_status        ,
105
   output  wire                      pipe_rx2_phy_status    ,
106
   output  wire                      pipe_rx2_elec_idle     ,
107
   input   wire                      pipe_rx2_polarity      ,
108
   input   wire                      pipe_tx2_compliance    ,
109
   input   wire [ 1:0]               pipe_tx2_char_is_k     ,
110
   input   wire [15:0]               pipe_tx2_data          ,
111
   input   wire                      pipe_tx2_elec_idle     ,
112
   input   wire [ 1:0]               pipe_tx2_powerdown     ,
113
 
114
   // Pipe Per-Lane Signals - Lane 3
115
   output  wire [ 1:0]               pipe_rx3_char_is_k     ,
116
   output  wire [15:0]               pipe_rx3_data          ,
117
   output  wire                      pipe_rx3_valid         ,
118
   output  wire                      pipe_rx3_chanisaligned ,
119
   output  wire [ 2:0]               pipe_rx3_status        ,
120
   output  wire                      pipe_rx3_phy_status    ,
121
   output  wire                      pipe_rx3_elec_idle     ,
122
   input   wire                      pipe_rx3_polarity      ,
123
   input   wire                      pipe_tx3_compliance    ,
124
   input   wire [ 1:0]               pipe_tx3_char_is_k     ,
125
   input   wire [15:0]               pipe_tx3_data          ,
126
   input   wire                      pipe_tx3_elec_idle     ,
127
   input   wire [ 1:0]               pipe_tx3_powerdown     ,
128
 
129
   // Pipe Per-Lane Signals - Lane 4
130
   output  wire [ 1:0]               pipe_rx4_char_is_k     ,
131
   output  wire [15:0]               pipe_rx4_data          ,
132
   output  wire                      pipe_rx4_valid         ,
133
   output  wire                      pipe_rx4_chanisaligned ,
134
   output  wire [ 2:0]               pipe_rx4_status        ,
135
   output  wire                      pipe_rx4_phy_status    ,
136
   output  wire                      pipe_rx4_elec_idle     ,
137
   input   wire                      pipe_rx4_polarity      ,
138
   input   wire                      pipe_tx4_compliance    ,
139
   input   wire [ 1:0]               pipe_tx4_char_is_k     ,
140
   input   wire [15:0]               pipe_tx4_data          ,
141
   input   wire                      pipe_tx4_elec_idle     ,
142
   input   wire [ 1:0]               pipe_tx4_powerdown     ,
143
 
144
   // Pipe Per-Lane Signals - Lane 5
145
   output  wire [ 1:0]               pipe_rx5_char_is_k     ,
146
   output  wire [15:0]               pipe_rx5_data          ,
147
   output  wire                      pipe_rx5_valid         ,
148
   output  wire                      pipe_rx5_chanisaligned ,
149
   output  wire [ 2:0]               pipe_rx5_status        ,
150
   output  wire                      pipe_rx5_phy_status    ,
151
   output  wire                      pipe_rx5_elec_idle     ,
152
   input   wire                      pipe_rx5_polarity      ,
153
   input   wire                      pipe_tx5_compliance    ,
154
   input   wire [ 1:0]               pipe_tx5_char_is_k     ,
155
   input   wire [15:0]               pipe_tx5_data          ,
156
   input   wire                      pipe_tx5_elec_idle     ,
157
   input   wire [ 1:0]               pipe_tx5_powerdown     ,
158
 
159
   // Pipe Per-Lane Signals - Lane 6
160
   output  wire [ 1:0]               pipe_rx6_char_is_k     ,
161
   output  wire [15:0]               pipe_rx6_data          ,
162
   output  wire                      pipe_rx6_valid         ,
163
   output  wire                      pipe_rx6_chanisaligned ,
164
   output  wire [ 2:0]               pipe_rx6_status        ,
165
   output  wire                      pipe_rx6_phy_status    ,
166
   output  wire                      pipe_rx6_elec_idle     ,
167
   input   wire                      pipe_rx6_polarity      ,
168
   input   wire                      pipe_tx6_compliance    ,
169
   input   wire [ 1:0]               pipe_tx6_char_is_k     ,
170
   input   wire [15:0]               pipe_tx6_data          ,
171
   input   wire                      pipe_tx6_elec_idle     ,
172
   input   wire [ 1:0]               pipe_tx6_powerdown     ,
173
 
174
   // Pipe Per-Lane Signals - Lane 7
175
   output  wire [ 1:0]               pipe_rx7_char_is_k     ,
176
   output  wire [15:0]               pipe_rx7_data          ,
177
   output  wire                      pipe_rx7_valid         ,
178
   output  wire                      pipe_rx7_chanisaligned ,
179
   output  wire [ 2:0]               pipe_rx7_status        ,
180
   output  wire                      pipe_rx7_phy_status    ,
181
   output  wire                      pipe_rx7_elec_idle     ,
182
   input   wire                      pipe_rx7_polarity      ,
183
   input   wire                      pipe_tx7_compliance    ,
184
   input   wire [ 1:0]               pipe_tx7_char_is_k     ,
185
   input   wire [15:0]               pipe_tx7_data          ,
186
   input   wire                      pipe_tx7_elec_idle     ,
187
   input   wire [ 1:0]               pipe_tx7_powerdown     ,
188
 
189
   // PCI Express signals
190
   output  wire [ (NO_OF_LANES-1):0] pci_exp_txn            ,
191
   output  wire [ (NO_OF_LANES-1):0] pci_exp_txp            ,
192
   input   wire [ (NO_OF_LANES-1):0] pci_exp_rxn            ,
193
   input   wire [ (NO_OF_LANES-1):0] pci_exp_rxp            ,
194
 
195
   // Non PIPE signals
196
   input   wire                      sys_clk                ,
197
   input   wire                      sys_rst_n              ,
198
   input   wire                      pipe_clk               ,
199
   input   wire                      clock_locked           ,
200
 
201
   output  wire                      gt_pll_lock            ,
202
   input   wire [ 5:0]               pl_ltssm_state         ,
203
   output  reg                       phy_rdy_n
204
);
205
 
206
  parameter                          TCQ  = 1;      // clock to out delay model
207
 
208
  wire [  7:0]                       gt_rx_phy_status_wire    ;
209
  wire [  7:0]                       gt_rxchanisaligned_wire  ;
210
  wire [127:0]                       gt_rx_data_k_wire        ;
211
  wire [127:0]                       gt_rx_data_wire          ;
212
  wire [  7:0]                       gt_rx_elec_idle_wire     ;
213
  wire [ 23:0]                       gt_rx_status_wire        ;
214
  wire [  7:0]                       gt_rx_valid_wire         ;
215
  wire [  7:0]                       gt_rx_polarity           ;
216
  wire [ 15:0]                       gt_power_down            ;
217
  wire [  7:0]                       gt_tx_char_disp_mode     ;
218
  wire [ 15:0]                       gt_tx_data_k             ;
219
  wire [127:0]                       gt_tx_data               ;
220
  wire                               gt_tx_detect_rx_loopback ;
221
  wire [  7:0]                       gt_tx_elec_idle          ;
222
  wire [  7:0]                       gt_rx_elec_idle_reset    ;
223
 
224
  wire [NO_OF_LANES-1:0]             plllkdet;
225
  wire                               RxResetDone;
226
  wire                               plm_in_l0 = (pl_ltssm_state == 6'h16);
227
 
228
  reg                                local_pcs_reset;
229
  reg                                local_pcs_reset_done;
230
  reg  [3:0]                         cnt_local_pcs_reset;
231
  reg  [4:0]                         phy_rdy_pre_cnt;
232
 
233
gtx_wrapper_v6 #(
234
 
235
  .NO_OF_LANES(NO_OF_LANES),
236
  .REF_CLK_FREQ(REF_CLK_FREQ),
237
  .PL_FAST_TRAIN(PL_FAST_TRAIN)
238
 
239
)
240
gtx_v6_i (
241
 
242
  // TX
243
 
244
  .TX(pci_exp_txp[((NO_OF_LANES)-1):0]),
245
  .TX_(pci_exp_txn[((NO_OF_LANES)-1):0]),
246
  .TxData(gt_tx_data[((16*NO_OF_LANES)-1):0]),
247
  .TxDataK(gt_tx_data_k[((2*NO_OF_LANES)-1):0]),
248
  .TxElecIdle(gt_tx_elec_idle[((NO_OF_LANES)-1):0]),
249
  .TxCompliance(gt_tx_char_disp_mode[((NO_OF_LANES)-1):0]),
250
 
251
  // RX
252
 
253
  .RX(pci_exp_rxp[((NO_OF_LANES)-1):0]),
254
  .RX_(pci_exp_rxn[((NO_OF_LANES)-1):0]),
255
  .RxData(gt_rx_data_wire[((16*NO_OF_LANES)-1):0]),
256
  .RxDataK(gt_rx_data_k_wire[((2*NO_OF_LANES)-1):0]),
257
  .RxPolarity(gt_rx_polarity[((NO_OF_LANES)-1):0]),
258
  .RxValid(gt_rx_valid_wire[((NO_OF_LANES)-1):0]),
259
  .RxElecIdle(gt_rx_elec_idle_wire[((NO_OF_LANES)-1):0]),
260
  .RxStatus(gt_rx_status_wire[((3*NO_OF_LANES)-1):0]),
261
 
262
  // other
263
  .GTRefClkout(),
264
  .RxPLLLkDet(plllkdet),
265
  .ChanIsAligned(gt_rxchanisaligned_wire[((NO_OF_LANES)-1):0]),
266
  .TxDetectRx(gt_tx_detect_rx_loopback),
267
  .PhyStatus(gt_rx_phy_status_wire[((NO_OF_LANES)-1):0]),
268
  .TXPdownAsynch(~clock_locked),
269
  .PowerDown(gt_power_down[((2*NO_OF_LANES)-1):0]),
270
  .Rate(pipe_tx_rate),
271
  .Reset_n(clock_locked),
272
  .GTReset_n(sys_rst_n),
273
  .PCLK(pipe_clk),
274
  .REFCLK(sys_clk),
275
  .TxDeemph(pipe_tx_deemph),
276
  .TxMargin(pipe_tx_margin[2]),
277
  .TxSwing(pipe_tx_swing),
278
  .local_pcs_reset(local_pcs_reset),
279
  .RxResetDone(RxResetDone),
280
  .SyncDone(SyncDone)
281
);
282
 
283
assign pipe_rx0_phy_status = gt_rx_phy_status_wire[0] ;
284
assign pipe_rx1_phy_status = (NO_OF_LANES >= 2 ) ? gt_rx_phy_status_wire[1] : 1'b0;
285
assign pipe_rx2_phy_status = (NO_OF_LANES >= 4 ) ? gt_rx_phy_status_wire[2] : 1'b0;
286
assign pipe_rx3_phy_status = (NO_OF_LANES >= 4 ) ? gt_rx_phy_status_wire[3] : 1'b0;
287
assign pipe_rx4_phy_status = (NO_OF_LANES >= 8 ) ? gt_rx_phy_status_wire[4] : 1'b0;
288
assign pipe_rx5_phy_status = (NO_OF_LANES >= 8 ) ? gt_rx_phy_status_wire[5] : 1'b0;
289
assign pipe_rx6_phy_status = (NO_OF_LANES >= 8 ) ? gt_rx_phy_status_wire[6] : 1'b0;
290
assign pipe_rx7_phy_status = (NO_OF_LANES >= 8 ) ? gt_rx_phy_status_wire[7] : 1'b0;
291
 
292
assign pipe_rx0_chanisaligned = gt_rxchanisaligned_wire[0];
293
assign pipe_rx1_chanisaligned = (NO_OF_LANES >= 2 ) ? gt_rxchanisaligned_wire[1] : 1'b0 ;
294
assign pipe_rx2_chanisaligned = (NO_OF_LANES >= 4 ) ? gt_rxchanisaligned_wire[2] : 1'b0 ;
295
assign pipe_rx3_chanisaligned = (NO_OF_LANES >= 4 ) ? gt_rxchanisaligned_wire[3] : 1'b0 ;
296
assign pipe_rx4_chanisaligned = (NO_OF_LANES >= 8 ) ? gt_rxchanisaligned_wire[4] : 1'b0 ;
297
assign pipe_rx5_chanisaligned = (NO_OF_LANES >= 8 ) ? gt_rxchanisaligned_wire[5] : 1'b0 ;
298
assign pipe_rx6_chanisaligned = (NO_OF_LANES >= 8 ) ? gt_rxchanisaligned_wire[6] : 1'b0 ;
299
assign pipe_rx7_chanisaligned = (NO_OF_LANES >= 8 ) ? gt_rxchanisaligned_wire[7] : 1'b0 ;
300
 
301
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
302
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
303
 
304
assign pipe_rx0_char_is_k =  {gt_rx_data_k_wire[1], gt_rx_data_k_wire[0]};
305
assign pipe_rx1_char_is_k =  (NO_OF_LANES >= 2 ) ? {gt_rx_data_k_wire[3], gt_rx_data_k_wire[2]} : 2'b0 ;
306
assign pipe_rx2_char_is_k =  (NO_OF_LANES >= 4 ) ? {gt_rx_data_k_wire[5], gt_rx_data_k_wire[4]} : 2'b0 ;
307
assign pipe_rx3_char_is_k =  (NO_OF_LANES >= 4 ) ? {gt_rx_data_k_wire[7], gt_rx_data_k_wire[6]} : 2'b0 ;
308
assign pipe_rx4_char_is_k =  (NO_OF_LANES >= 8 ) ? {gt_rx_data_k_wire[9], gt_rx_data_k_wire[8]} : 2'b0 ;
309
assign pipe_rx5_char_is_k =  (NO_OF_LANES >= 8 ) ? {gt_rx_data_k_wire[11], gt_rx_data_k_wire[10]} : 2'b0 ;
310
assign pipe_rx6_char_is_k =  (NO_OF_LANES >= 8 ) ? {gt_rx_data_k_wire[13], gt_rx_data_k_wire[12]} : 2'b0 ;
311
assign pipe_rx7_char_is_k =  (NO_OF_LANES >= 8 ) ? {gt_rx_data_k_wire[15], gt_rx_data_k_wire[14]} : 2'b0 ;
312
 
313
assign pipe_rx0_data = {gt_rx_data_wire[ 15: 8], gt_rx_data_wire[ 7: 0]};
314
assign pipe_rx1_data = (NO_OF_LANES >= 2 ) ? {gt_rx_data_wire[31:24], gt_rx_data_wire[23:16]} : 16'h0 ;
315
assign pipe_rx2_data = (NO_OF_LANES >= 4 ) ? {gt_rx_data_wire[47:40], gt_rx_data_wire[39:32]} : 16'h0 ;
316
assign pipe_rx3_data = (NO_OF_LANES >= 4 ) ? {gt_rx_data_wire[63:56], gt_rx_data_wire[55:48]} : 16'h0 ;
317
assign pipe_rx4_data = (NO_OF_LANES >= 8 ) ? {gt_rx_data_wire[79:72], gt_rx_data_wire[71:64]} : 16'h0 ;
318
assign pipe_rx5_data = (NO_OF_LANES >= 8 ) ? {gt_rx_data_wire[95:88], gt_rx_data_wire[87:80]} : 16'h0 ;
319
assign pipe_rx6_data = (NO_OF_LANES >= 8 ) ? {gt_rx_data_wire[111:104], gt_rx_data_wire[103:96]} : 16'h0 ;
320
assign pipe_rx7_data = (NO_OF_LANES >= 8 ) ? {gt_rx_data_wire[127:120], gt_rx_data_wire[119:112]} : 16'h0 ;
321
 
322
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
323
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
324
 
325
assign pipe_rx0_elec_idle = gt_rx_elec_idle_wire[0];
326
assign pipe_rx1_elec_idle = (NO_OF_LANES >= 2 ) ? gt_rx_elec_idle_wire[1] : 1'b1 ;
327
assign pipe_rx2_elec_idle = (NO_OF_LANES >= 4 ) ? gt_rx_elec_idle_wire[2] : 1'b1 ;
328
assign pipe_rx3_elec_idle = (NO_OF_LANES >= 4 ) ? gt_rx_elec_idle_wire[3] : 1'b1 ;
329
assign pipe_rx4_elec_idle = (NO_OF_LANES >= 8 ) ? gt_rx_elec_idle_wire[4] : 1'b1 ;
330
assign pipe_rx5_elec_idle = (NO_OF_LANES >= 8 ) ? gt_rx_elec_idle_wire[5] : 1'b1 ;
331
assign pipe_rx6_elec_idle = (NO_OF_LANES >= 8 ) ? gt_rx_elec_idle_wire[6] : 1'b1 ;
332
assign pipe_rx7_elec_idle = (NO_OF_LANES >= 8 ) ? gt_rx_elec_idle_wire[7] : 1'b1 ;
333
 
334
assign pipe_rx0_status = gt_rx_status_wire[ 2: 0];
335
assign pipe_rx1_status = (NO_OF_LANES >= 2 ) ? gt_rx_status_wire[ 5: 3] : 3'b0 ;
336
assign pipe_rx2_status = (NO_OF_LANES >= 4 ) ? gt_rx_status_wire[ 8: 6] : 3'b0 ;
337
assign pipe_rx3_status = (NO_OF_LANES >= 4 ) ? gt_rx_status_wire[11: 9] : 3'b0 ;
338
assign pipe_rx4_status = (NO_OF_LANES >= 8 ) ? gt_rx_status_wire[14:12] : 3'b0 ;
339
assign pipe_rx5_status = (NO_OF_LANES >= 8 ) ? gt_rx_status_wire[17:15] : 3'b0 ;
340
assign pipe_rx6_status = (NO_OF_LANES >= 8 ) ? gt_rx_status_wire[20:18] : 3'b0 ;
341
assign pipe_rx7_status = (NO_OF_LANES >= 8 ) ? gt_rx_status_wire[23:21] : 3'b0 ;
342
 
343
assign pipe_rx0_valid = gt_rx_valid_wire[0];
344
assign pipe_rx1_valid = (NO_OF_LANES >= 2 ) ? gt_rx_valid_wire[1] : 1'b0 ;
345
assign pipe_rx2_valid = (NO_OF_LANES >= 4 ) ? gt_rx_valid_wire[2] : 1'b0 ;
346
assign pipe_rx3_valid = (NO_OF_LANES >= 4 ) ? gt_rx_valid_wire[3] : 1'b0 ;
347
assign pipe_rx4_valid = (NO_OF_LANES >= 8 ) ? gt_rx_valid_wire[4] : 1'b0 ;
348
assign pipe_rx5_valid = (NO_OF_LANES >= 8 ) ? gt_rx_valid_wire[5] : 1'b0 ;
349
assign pipe_rx6_valid = (NO_OF_LANES >= 8 ) ? gt_rx_valid_wire[6] : 1'b0 ;
350
assign pipe_rx7_valid = (NO_OF_LANES >= 8 ) ? gt_rx_valid_wire[7] : 1'b0 ;
351
 
352
assign gt_rx_polarity[0] = pipe_rx0_polarity;
353
assign gt_rx_polarity[1] = pipe_rx1_polarity;
354
assign gt_rx_polarity[2] = pipe_rx2_polarity;
355
assign gt_rx_polarity[3] = pipe_rx3_polarity;
356
assign gt_rx_polarity[4] = pipe_rx4_polarity;
357
assign gt_rx_polarity[5] = pipe_rx5_polarity;
358
assign gt_rx_polarity[6] = pipe_rx6_polarity;
359
assign gt_rx_polarity[7] = pipe_rx7_polarity;
360
 
361
assign gt_power_down[ 1: 0] = pipe_tx0_powerdown;
362
assign gt_power_down[ 3: 2] = pipe_tx1_powerdown;
363
assign gt_power_down[ 5: 4] = pipe_tx2_powerdown;
364
assign gt_power_down[ 7: 6] = pipe_tx3_powerdown;
365
assign gt_power_down[ 9: 8] = pipe_tx4_powerdown;
366
assign gt_power_down[11:10] = pipe_tx5_powerdown;
367
assign gt_power_down[13:12] = pipe_tx6_powerdown;
368
assign gt_power_down[15:14] = pipe_tx7_powerdown;
369
 
370
assign gt_tx_char_disp_mode = {pipe_tx7_compliance,
371
                               pipe_tx6_compliance,
372
                               pipe_tx5_compliance,
373
                               pipe_tx4_compliance,
374
                               pipe_tx3_compliance,
375
                               pipe_tx2_compliance,
376
                               pipe_tx1_compliance,
377
                               pipe_tx0_compliance};
378
 
379
 
380
assign gt_tx_data_k = {pipe_tx7_char_is_k,
381
                       pipe_tx6_char_is_k,
382
                       pipe_tx5_char_is_k,
383
                       pipe_tx4_char_is_k,
384
                       pipe_tx3_char_is_k,
385
                       pipe_tx2_char_is_k,
386
                       pipe_tx1_char_is_k,
387
                       pipe_tx0_char_is_k};
388
 
389
assign gt_tx_data = {pipe_tx7_data,
390
                     pipe_tx6_data,
391
                     pipe_tx5_data,
392
                     pipe_tx4_data,
393
                     pipe_tx3_data,
394
                     pipe_tx2_data,
395
                     pipe_tx1_data,
396
                     pipe_tx0_data};
397
 
398
assign gt_tx_detect_rx_loopback = pipe_tx_rcvr_det;
399
 
400
assign gt_tx_elec_idle = {pipe_tx7_elec_idle,
401
                          pipe_tx6_elec_idle,
402
                          pipe_tx5_elec_idle,
403
                          pipe_tx4_elec_idle,
404
                          pipe_tx3_elec_idle,
405
                          pipe_tx2_elec_idle,
406
                          pipe_tx1_elec_idle,
407
                          pipe_tx0_elec_idle};
408
 
409
assign gt_pll_lock = &plllkdet[NO_OF_LANES-1:0] | ~phy_rdy_pre_cnt[4];
410
 
411
// Asserted after all workarounds have completed.
412
 
413
always @(posedge pipe_clk or negedge clock_locked) begin
414
 
415
  if (!clock_locked) begin
416
 
417
    phy_rdy_n <= #TCQ 1'b1;
418
 
419
  end else begin
420
 
421
    if (~&plllkdet[NO_OF_LANES-1:0])
422
      phy_rdy_n <= #TCQ 1'b1;
423
    else if (local_pcs_reset_done && RxResetDone && phy_rdy_n &&  SyncDone)
424
      phy_rdy_n <= #TCQ 1'b0;
425
 
426
  end
427
 
428
end
429
 
430
// Handle the warm reset case, where sys_rst_n is asseted when
431
// phy_rdy_n is asserted. phy_rdy_n is to be de-asserted
432
// before gt_pll_lock is de-asserted so that synnchronous
433
// logic see reset de-asset before clock is lost.
434
 
435
always @(posedge pipe_clk or negedge clock_locked) begin
436
 
437
  if (!clock_locked) begin
438
 
439
    phy_rdy_pre_cnt <= #TCQ 5'b11111;
440
 
441
  end else begin
442
 
443
    if (gt_pll_lock && phy_rdy_n)
444
      phy_rdy_pre_cnt <= #TCQ phy_rdy_pre_cnt + 1'b1;
445
 
446
  end
447
 
448
end
449
 
450
always @(posedge pipe_clk or negedge clock_locked) begin
451
 
452
  if (!clock_locked) begin
453
 
454
    cnt_local_pcs_reset <= #TCQ 4'hF;
455
    local_pcs_reset <= #TCQ 1'b0;
456
    local_pcs_reset_done <= #TCQ 1'b0;
457
 
458
  end else begin
459
 
460
    if ((local_pcs_reset == 1'b0) && (cnt_local_pcs_reset == 4'hF))
461
      local_pcs_reset <= #TCQ 1'b1;
462
    else if ((local_pcs_reset == 1'b1) && (cnt_local_pcs_reset != 4'h0)) begin
463
      local_pcs_reset <= #TCQ 1'b1;
464
      cnt_local_pcs_reset <= #TCQ cnt_local_pcs_reset - 1'b1;
465
    end else if ((local_pcs_reset == 1'b1) && (cnt_local_pcs_reset == 4'h0)) begin
466
      local_pcs_reset <= #TCQ 1'b0;
467
      local_pcs_reset_done <= #TCQ 1'b1;
468
    end
469
 
470
  end
471
 
472
end
473
 
474
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
475
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
476
 
477
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.