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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [core/] [ds_dma64/] [pcie_src/] [pcie_core64_m1/] [source/] [prod_fixes.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dsmv
 
2
//-----------------------------------------------------------------------------
3
//
4
// (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.
5
//
6
// This file contains confidential and proprietary information
7
// of Xilinx, Inc. and is protected under U.S. and
8
// international copyright and other intellectual property
9
// laws.
10
//
11
// DISCLAIMER
12
// This disclaimer is not a license and does not grant any
13
// rights to the materials distributed herewith. Except as
14
// otherwise provided in a valid license issued to you by
15
// Xilinx, and to the maximum extent permitted by applicable
16
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
17
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
18
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
19
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
20
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
21
// (2) Xilinx shall not be liable (whether in contract or tort,
22
// including negligence, or under any other theory of
23
// liability) for any loss or damage of any kind or nature
24
// related to, arising under or in connection with these
25
// materials, including for any direct, or any indirect,
26
// special, incidental, or consequential loss or damage
27
// (including loss of data, profits, goodwill, or any type of
28
// loss or damage suffered as a result of any action brought
29
// by a third party) even if such damage or loss was
30
// reasonably foreseeable or Xilinx had been advised of the
31
// possibility of the same.
32
//
33
// CRITICAL APPLICATIONS
34
// Xilinx products are not designed or intended to be fail-
35
// safe, or for use in any application requiring fail-safe
36
// performance, such as life-support or safety devices or
37
// systems, Class III medical devices, nuclear facilities,
38
// applications related to the deployment of airbags, or any
39
// other applications that could lead to death, personal
40
// injury, or severe property or environmental damage
41
// (individually and collectively, "Critical
42
// Applications"). Customer assumes the sole risk and
43
// liability of any use of Xilinx products in Critical
44
// Applications, subject only to applicable laws and
45
// regulations governing limitations on product liability.
46
//
47
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
48
// PART OF THIS FILE AT ALL TIMES.
49
//
50
//-----------------------------------------------------------------------------
51
// Project    : V5-Block Plus for PCI Express
52
// File       : prod_fixes.v
53
//--------------------------------------------------------------------------------
54
//--------------------------------------------------------------------------------
55
//
56
//   ____  ____
57
//  /   /\/   /
58
// /___/  \  /    Vendor      : Xilinx
59
// \   \   \/     Version     : 1.1
60
//  \   \         Application : Generated by Xilinx PCI Express Wizard
61
//  /   /         Filename    : prod_fixes.v
62
// /___/   /\     Module      : Snoop and Fix Production Issues
63
// \   \  /  \
64
//  \___\/\___\
65
//
66
//------------------------------------------------------------------------------
67
 
68
// PCIE Spec 2.0 Gen2 upconfigure capable TS2 bit 6 workaround.
69
// Force all reserved fields in TS1 and TS2s to 0 on PCIe block 
70
// receive path on all lanes when in Polling and Configuration.
71
 
72
module prod_fixes
73
(
74
   input            clk,
75
   input            bit_reset_n,
76
   input  [3:0]     l0_ltssm_state,
77
   input            chan_bond_done,
78
   input  [3:0]     negotiated_link_width,
79
   input            trn_lnk_up_n,
80
 
81
   // for pipelining
82
   input  [7:0]     pipe_rx_data_k,
83
   input  [7:0]     pipe_rx_valid,
84
 
85
   input  [7:0]     pipe_rx_data_l0,
86
   input  [7:0]     pipe_rx_data_l1,
87
   input  [7:0]     pipe_rx_data_l2,
88
   input  [7:0]     pipe_rx_data_l3,
89
   input  [7:0]     pipe_rx_data_l4,
90
   input  [7:0]     pipe_rx_data_l5,
91
   input  [7:0]     pipe_rx_data_l6,
92
   input  [7:0]     pipe_rx_data_l7,
93
 
94
   output reg [7:0]    pipe_rx_data_l0_out,
95
   output reg [7:0]    pipe_rx_data_l1_out,
96
   output reg [7:0]    pipe_rx_data_l2_out,
97
   output reg [7:0]    pipe_rx_data_l3_out,
98
   output reg [7:0]    pipe_rx_data_l4_out,
99
   output reg [7:0]    pipe_rx_data_l5_out,
100
   output reg [7:0]    pipe_rx_data_l6_out,
101
   output reg [7:0]    pipe_rx_data_l7_out,
102
   output              upcfgcap_cycle,
103
   output              masking_ack,
104
   output reg [7:0]    pipe_rx_data_k_out,
105
   output reg [7:0]    pipe_rx_valid_out
106
 
107
);
108
 
109
   parameter STATE_SIZE = 5;
110
   parameter [STATE_SIZE-1:0]
111
                   ALGN     = 'h1,
112
                   Q_TS     = 'h2,
113
                   SYM2     = 'h4,
114
                   SYM3     = 'h8,
115
                   SYM4     = 'h10;
116
 
117
   parameter [8:0] PAD       = 9'h1F7;
118
   parameter [8:0] COM       = 9'h1BC;
119
   parameter [8:0] SKP       = 9'h11C;
120
   parameter [8:0] IDL       = 9'h17C;
121
   parameter [8:0] SDP       = 9'h15C;
122
   parameter [8:0] END       = 9'h1FD;
123
 
124
   parameter [3:0] LT_POLLING  = 4'b0010;
125
   parameter [3:0] LT_CONFIG   = 4'b0011;
126
   parameter [3:0] LT_RECOVERY = 4'b1100;
127
 
128
   parameter       IS_D = 1'b0;
129
   parameter       IS_K = 1'b1;
130
 
131
   reg  [STATE_SIZE-1:0]
132
                   curr_state_l0, next_state_l0,
133
                   curr_state_l1, next_state_l1,
134
                   curr_state_l2, next_state_l2,
135
                   curr_state_l3, next_state_l3,
136
                   curr_state_l4, next_state_l4,
137
                   curr_state_l5, next_state_l5,
138
                   curr_state_l6, next_state_l6,
139
                   curr_state_l7, next_state_l7;
140
 
141
   wire [8:0]      l0_pipe_rx_input;
142
   wire [8:0]      l1_pipe_rx_input;
143
   wire [8:0]      l2_pipe_rx_input;
144
   wire [8:0]      l3_pipe_rx_input;
145
   wire [8:0]      l4_pipe_rx_input;
146
   wire [8:0]      l5_pipe_rx_input;
147
   wire [8:0]      l6_pipe_rx_input;
148
   wire [8:0]      l7_pipe_rx_input;
149
   reg             dllp_ack_l0 = 1'b0;
150
   reg             dllp_ack_l4 = 1'b0;
151
   reg             dllp_ack_l0_r = 1'b0;
152
   reg             dllp_ack_l4_r = 1'b0;
153
   reg             dllp_ack_l4_rr = 1'b0;
154
 
155
   reg             dllp_ack_l7_reverse = 1'b0;
156
   reg             dllp_ack_l3_reverse= 1'b0;
157
   reg             dllp_ack_l7_reverse_r = 1'b0;
158
   reg             dllp_ack_l3_reverse_r = 1'b0;
159
   reg             dllp_ack_l3_reverse_rr = 1'b0;
160
 
161
   reg  [3:0]      l0_ltssm_state_d;
162
   reg             trn_lnk_up_n_d;
163
 
164
   reg  [7:0]      seq_num_xor_curr = 8'h0;
165
   reg  [7:0]      seq_num_xor_prev = 8'h0;
166
 
167
   reg  [3:0]      negotiated_link_width_d;
168
 
169
   integer i = 0;
170
 
171
   assign l0_pipe_rx_input = {pipe_rx_data_k[0], pipe_rx_data_l0};
172
   assign l1_pipe_rx_input = {pipe_rx_data_k[1], pipe_rx_data_l1};
173
   assign l2_pipe_rx_input = {pipe_rx_data_k[2], pipe_rx_data_l2};
174
   assign l3_pipe_rx_input = {pipe_rx_data_k[3], pipe_rx_data_l3};
175
   assign l4_pipe_rx_input = {pipe_rx_data_k[4], pipe_rx_data_l4};
176
   assign l5_pipe_rx_input = {pipe_rx_data_k[5], pipe_rx_data_l5};
177
   assign l6_pipe_rx_input = {pipe_rx_data_k[6], pipe_rx_data_l6};
178
   assign l7_pipe_rx_input = {pipe_rx_data_k[7], pipe_rx_data_l7};
179
 
180
   reg          upcfgcap_cycle_l0;
181
   reg          upcfgcap_cycle_l1;
182
   reg          upcfgcap_cycle_l2;
183
   reg          upcfgcap_cycle_l3;
184
   reg          upcfgcap_cycle_l4;
185
   reg          upcfgcap_cycle_l5;
186
   reg          upcfgcap_cycle_l6;
187
   reg          upcfgcap_cycle_l7;
188
 
189
 
190
   always @(posedge clk)
191
   begin : REGISTER_LTSSM_STATE
192
      if (!bit_reset_n)
193
      begin
194
         l0_ltssm_state_d <= 4'b0;
195
         trn_lnk_up_n_d   <= 1'b1;
196
      end else begin
197
         l0_ltssm_state_d <= l0_ltssm_state;
198
         trn_lnk_up_n_d   <= trn_lnk_up_n;
199
      end
200
   end
201
 
202
 
203
 
204
////////////////////////////Lane 0///////////////////// 
205
   always @(curr_state_l0, l0_pipe_rx_input, l0_ltssm_state_d)
206
   begin: FSM_COMB_L0
207
 
208
 
209
      case (curr_state_l0)
210
 
211
 
212
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
213
                || l0_ltssm_state_d == LT_POLLING)
214
                && l0_pipe_rx_input == COM) begin
215
 
216
                next_state_l0 <= Q_TS;
217
                upcfgcap_cycle_l0 <= 1'b0;
218
            end else begin
219
 
220
                next_state_l0 <= ALGN;
221
                upcfgcap_cycle_l0 <= 1'b0;
222
 
223
            end
224
      Q_TS: if (l0_pipe_rx_input == PAD || l0_pipe_rx_input[8] == IS_D) begin
225
 
226
                next_state_l0 <= SYM2;
227
                upcfgcap_cycle_l0 <= 1'b0;
228
 
229
            end else begin
230
 
231
                next_state_l0 <= ALGN;
232
                upcfgcap_cycle_l0 <= 1'b0;
233
 
234
            end
235
      SYM2: begin
236
                next_state_l0 <= SYM3;
237
                upcfgcap_cycle_l0 <= 1'b0;
238
            end
239
 
240
      SYM3: begin
241
                next_state_l0 <= SYM4;
242
                upcfgcap_cycle_l0 <= 1'b0;
243
            end
244
 
245
      SYM4: begin
246
                next_state_l0 <= ALGN;
247
                upcfgcap_cycle_l0 <= 1'b1;
248
            end
249
 
250
      default:
251
            begin
252
                next_state_l0 <= ALGN;
253
                upcfgcap_cycle_l0 <= 1'b0;
254
            end
255
 
256
      endcase
257
 
258
   end
259
 
260
   always @(posedge clk)
261
   begin : FSM_SYNC_L0
262
      if (!bit_reset_n)
263
         curr_state_l0 <= ALGN;
264
      else
265
         curr_state_l0 <= next_state_l0;
266
   end
267
 
268
 
269
////////////////////////////Lane 1///////////////////// 
270
   always @(curr_state_l1, l1_pipe_rx_input, l0_ltssm_state_d)
271
   begin: FSM_COMB_L1
272
 
273
 
274
      case (curr_state_l1)
275
 
276
 
277
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
278
                || l0_ltssm_state_d == LT_POLLING)
279
                && l1_pipe_rx_input == COM) begin
280
 
281
                next_state_l1 <= Q_TS;
282
                upcfgcap_cycle_l1 <= 1'b0;
283
            end else begin
284
 
285
                next_state_l1 <= ALGN;
286
                upcfgcap_cycle_l1 <= 1'b0;
287
 
288
            end
289
      Q_TS: if (l1_pipe_rx_input == PAD || l1_pipe_rx_input[8] == IS_D) begin
290
 
291
                next_state_l1 <= SYM2;
292
                upcfgcap_cycle_l1 <= 1'b0;
293
 
294
            end else begin
295
 
296
                next_state_l1 <= ALGN;
297
                upcfgcap_cycle_l1 <= 1'b0;
298
 
299
            end
300
      SYM2: begin
301
                next_state_l1 <= SYM3;
302
                upcfgcap_cycle_l1 <= 1'b0;
303
            end
304
 
305
      SYM3: begin
306
                next_state_l1 <= SYM4;
307
                upcfgcap_cycle_l1 <= 1'b0;
308
            end
309
 
310
      SYM4: begin
311
                next_state_l1 <= ALGN;
312
                upcfgcap_cycle_l1 <= 1'b1;
313
            end
314
 
315
      default:
316
            begin
317
                next_state_l1 <= ALGN;
318
                upcfgcap_cycle_l1 <= 1'b0;
319
            end
320
 
321
      endcase
322
 
323
   end
324
 
325
   always @(posedge clk)
326
   begin : FSM_SYNC_L1
327
      if (!bit_reset_n)
328
         curr_state_l1 <= ALGN;
329
      else
330
         curr_state_l1 <= next_state_l1;
331
   end
332
 
333
 
334
 
335
////////////////////////////Lane 2///////////////////// 
336
   always @(curr_state_l2, l2_pipe_rx_input, l0_ltssm_state_d)
337
   begin: FSM_COMB_L2
338
 
339
 
340
      case (curr_state_l2)
341
 
342
 
343
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
344
                || l0_ltssm_state_d == LT_POLLING)
345
                && l2_pipe_rx_input == COM) begin
346
 
347
                next_state_l2 <= Q_TS;
348
                upcfgcap_cycle_l2 <= 1'b0;
349
            end else begin
350
 
351
                next_state_l2 <= ALGN;
352
                upcfgcap_cycle_l2 <= 1'b0;
353
 
354
            end
355
      Q_TS: if (l2_pipe_rx_input == PAD || l2_pipe_rx_input[8] == IS_D) begin
356
 
357
                next_state_l2 <= SYM2;
358
                upcfgcap_cycle_l2 <= 1'b0;
359
 
360
            end else begin
361
 
362
                next_state_l2 <= ALGN;
363
                upcfgcap_cycle_l2 <= 1'b0;
364
 
365
            end
366
      SYM2: begin
367
                next_state_l2 <= SYM3;
368
                upcfgcap_cycle_l2 <= 1'b0;
369
            end
370
 
371
      SYM3: begin
372
                next_state_l2 <= SYM4;
373
                upcfgcap_cycle_l2 <= 1'b0;
374
            end
375
 
376
      SYM4: begin
377
                next_state_l2 <= ALGN;
378
                upcfgcap_cycle_l2 <= 1'b1;
379
            end
380
 
381
      default:
382
            begin
383
                next_state_l2 <= ALGN;
384
                upcfgcap_cycle_l2 <= 1'b0;
385
            end
386
 
387
      endcase
388
 
389
   end
390
 
391
   always @(posedge clk)
392
   begin : FSM_SYNC_L2
393
      if (!bit_reset_n)
394
         curr_state_l2 <= ALGN;
395
      else
396
         curr_state_l2 <= next_state_l2;
397
   end
398
 
399
 
400
 
401
////////////////////////////Lane 3///////////////////// 
402
   always @(curr_state_l3, l3_pipe_rx_input, l0_ltssm_state_d)
403
   begin: FSM_COMB_L3
404
 
405
 
406
      case (curr_state_l3)
407
 
408
 
409
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
410
                || l0_ltssm_state_d == LT_POLLING)
411
                && l3_pipe_rx_input == COM) begin
412
 
413
                next_state_l3 <= Q_TS;
414
                upcfgcap_cycle_l3 <= 1'b0;
415
            end else begin
416
 
417
                next_state_l3 <= ALGN;
418
                upcfgcap_cycle_l3 <= 1'b0;
419
 
420
            end
421
      Q_TS: if (l3_pipe_rx_input == PAD || l3_pipe_rx_input[8] == IS_D) begin
422
 
423
                next_state_l3 <= SYM2;
424
                upcfgcap_cycle_l3 <= 1'b0;
425
 
426
            end else begin
427
 
428
                next_state_l3 <= ALGN;
429
                upcfgcap_cycle_l3 <= 1'b0;
430
 
431
            end
432
      SYM2: begin
433
                next_state_l3 <= SYM3;
434
                upcfgcap_cycle_l3 <= 1'b0;
435
            end
436
 
437
      SYM3: begin
438
                next_state_l3 <= SYM4;
439
                upcfgcap_cycle_l3 <= 1'b0;
440
            end
441
 
442
      SYM4: begin
443
                next_state_l3 <= ALGN;
444
                upcfgcap_cycle_l3 <= 1'b1;
445
            end
446
 
447
      default:
448
            begin
449
                next_state_l3 <= ALGN;
450
                upcfgcap_cycle_l3 <= 1'b0;
451
            end
452
 
453
      endcase
454
 
455
   end
456
 
457
   always @(posedge clk)
458
   begin : FSM_SYNC_L3
459
      if (!bit_reset_n)
460
         curr_state_l3 <= ALGN;
461
      else
462
         curr_state_l3 <= next_state_l3;
463
   end
464
 
465
 
466
////////////////////////////Lane 4///////////////////// 
467
   always @(curr_state_l4, l4_pipe_rx_input, l0_ltssm_state_d)
468
   begin: FSM_COMB_L4
469
 
470
 
471
      case (curr_state_l4)
472
 
473
 
474
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
475
                || l0_ltssm_state_d == LT_POLLING)
476
                && l4_pipe_rx_input == COM) begin
477
 
478
                next_state_l4 <= Q_TS;
479
                upcfgcap_cycle_l4 <= 1'b0;
480
            end else begin
481
 
482
                next_state_l4 <= ALGN;
483
                upcfgcap_cycle_l4 <= 1'b0;
484
 
485
            end
486
      Q_TS: if (l4_pipe_rx_input == PAD || l4_pipe_rx_input[8] == IS_D) begin
487
 
488
                next_state_l4 <= SYM2;
489
                upcfgcap_cycle_l4 <= 1'b0;
490
 
491
            end else begin
492
 
493
                next_state_l4 <= ALGN;
494
                upcfgcap_cycle_l4 <= 1'b0;
495
 
496
            end
497
      SYM2: begin
498
                next_state_l4 <= SYM3;
499
                upcfgcap_cycle_l4 <= 1'b0;
500
            end
501
 
502
      SYM3: begin
503
                next_state_l4 <= SYM4;
504
                upcfgcap_cycle_l4 <= 1'b0;
505
            end
506
 
507
      SYM4: begin
508
                next_state_l4 <= ALGN;
509
                upcfgcap_cycle_l4 <= 1'b1;
510
            end
511
 
512
      default:
513
            begin
514
                next_state_l4 <= ALGN;
515
                upcfgcap_cycle_l4 <= 1'b0;
516
            end
517
 
518
      endcase
519
 
520
   end
521
 
522
   always @(posedge clk)
523
   begin : FSM_SYNC_L4
524
      if (!bit_reset_n)
525
         curr_state_l4 <= ALGN;
526
      else
527
         curr_state_l4 <= next_state_l4;
528
   end
529
 
530
 
531
////////////////////////////Lane 5///////////////////// 
532
   always @(curr_state_l5, l5_pipe_rx_input, l0_ltssm_state_d)
533
   begin: FSM_COMB_L5
534
 
535
 
536
      case (curr_state_l5)
537
 
538
 
539
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
540
                || l0_ltssm_state_d == LT_POLLING)
541
                && l5_pipe_rx_input == COM) begin
542
 
543
                next_state_l5 <= Q_TS;
544
                upcfgcap_cycle_l5 <= 1'b0;
545
            end else begin
546
 
547
                next_state_l5 <= ALGN;
548
                upcfgcap_cycle_l5 <= 1'b0;
549
 
550
            end
551
      Q_TS: if (l5_pipe_rx_input == PAD || l5_pipe_rx_input[8] == IS_D) begin
552
 
553
                next_state_l5 <= SYM2;
554
                upcfgcap_cycle_l5 <= 1'b0;
555
 
556
            end else begin
557
 
558
                next_state_l5 <= ALGN;
559
                upcfgcap_cycle_l5 <= 1'b0;
560
 
561
            end
562
      SYM2: begin
563
                next_state_l5 <= SYM3;
564
                upcfgcap_cycle_l5 <= 1'b0;
565
            end
566
 
567
      SYM3: begin
568
                next_state_l5 <= SYM4;
569
                upcfgcap_cycle_l5 <= 1'b0;
570
            end
571
 
572
      SYM4: begin
573
                next_state_l5 <= ALGN;
574
                upcfgcap_cycle_l5 <= 1'b1;
575
            end
576
 
577
      default:
578
            begin
579
                next_state_l5 <= ALGN;
580
                upcfgcap_cycle_l5 <= 1'b0;
581
            end
582
 
583
      endcase
584
 
585
   end
586
 
587
   always @(posedge clk)
588
   begin : FSM_SYNC_L5
589
      if (!bit_reset_n)
590
         curr_state_l5 <= ALGN;
591
      else
592
         curr_state_l5 <= next_state_l5;
593
   end
594
 
595
 
596
////////////////////////////Lane 6///////////////////// 
597
   always @(curr_state_l6, l6_pipe_rx_input, l0_ltssm_state_d)
598
   begin: FSM_COMB_L6
599
 
600
 
601
      case (curr_state_l6)
602
 
603
 
604
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
605
                || l0_ltssm_state_d == LT_POLLING)
606
                && l6_pipe_rx_input == COM) begin
607
 
608
                next_state_l6 <= Q_TS;
609
                upcfgcap_cycle_l6 <= 1'b0;
610
            end else begin
611
 
612
                next_state_l6 <= ALGN;
613
                upcfgcap_cycle_l6 <= 1'b0;
614
 
615
            end
616
      Q_TS: if (l6_pipe_rx_input == PAD || l6_pipe_rx_input[8] == IS_D) begin
617
 
618
                next_state_l6 <= SYM2;
619
                upcfgcap_cycle_l6 <= 1'b0;
620
 
621
            end else begin
622
 
623
                next_state_l6 <= ALGN;
624
                upcfgcap_cycle_l6 <= 1'b0;
625
 
626
            end
627
      SYM2: begin
628
                next_state_l6 <= SYM3;
629
                upcfgcap_cycle_l6 <= 1'b0;
630
            end
631
 
632
      SYM3: begin
633
                next_state_l6 <= SYM4;
634
                upcfgcap_cycle_l6 <= 1'b0;
635
            end
636
 
637
      SYM4: begin
638
                next_state_l6 <= ALGN;
639
                upcfgcap_cycle_l6 <= 1'b1;
640
            end
641
 
642
      default:
643
            begin
644
                next_state_l6 <= ALGN;
645
                upcfgcap_cycle_l6 <= 1'b0;
646
            end
647
 
648
      endcase
649
 
650
   end
651
 
652
   always @(posedge clk)
653
   begin : FSM_SYNC_L6
654
      if (!bit_reset_n)
655
         curr_state_l6 <= ALGN;
656
      else
657
         curr_state_l6 <= next_state_l6;
658
   end
659
 
660
////////////////////////////Lane 7///////////////////// 
661
   always @(curr_state_l7, l7_pipe_rx_input, l0_ltssm_state_d)
662
   begin: FSM_COMB_L7
663
 
664
 
665
      case (curr_state_l7)
666
 
667
 
668
      ALGN: if ((l0_ltssm_state_d == LT_CONFIG || l0_ltssm_state_d == LT_RECOVERY
669
                || l0_ltssm_state_d == LT_POLLING)
670
                && l7_pipe_rx_input == COM) begin
671
 
672
                next_state_l7 <= Q_TS;
673
                upcfgcap_cycle_l7 <= 1'b0;
674
            end else begin
675
 
676
                next_state_l7 <= ALGN;
677
                upcfgcap_cycle_l7 <= 1'b0;
678
 
679
            end
680
      Q_TS: if (l7_pipe_rx_input == PAD || l7_pipe_rx_input[8] == IS_D) begin
681
 
682
                next_state_l7 <= SYM2;
683
                upcfgcap_cycle_l7 <= 1'b0;
684
 
685
            end else begin
686
 
687
                next_state_l7 <= ALGN;
688
                upcfgcap_cycle_l7 <= 1'b0;
689
 
690
            end
691
      SYM2: begin
692
                next_state_l7 <= SYM3;
693
                upcfgcap_cycle_l7 <= 1'b0;
694
            end
695
 
696
      SYM3: begin
697
                next_state_l7 <= SYM4;
698
                upcfgcap_cycle_l7 <= 1'b0;
699
            end
700
 
701
      SYM4: begin
702
                next_state_l7 <= ALGN;
703
                upcfgcap_cycle_l7 <= 1'b1;
704
            end
705
 
706
      default:
707
            begin
708
                next_state_l7 <= ALGN;
709
                upcfgcap_cycle_l7 <= 1'b0;
710
            end
711
 
712
      endcase
713
 
714
   end
715
 
716
   always @(posedge clk)
717
   begin : FSM_SYNC_L7
718
      if (!bit_reset_n)
719
         curr_state_l7 <= ALGN;
720
      else
721
         curr_state_l7 <= next_state_l7;
722
   end
723
 
724
 
725
 
726
//tie off for output port
727
assign upcfgcap_cycle = upcfgcap_cycle_l0;
728
 
729
 
730
 
731
   always @(posedge clk)
732
   begin : REG_NEGOTIATED_LINK_WIDTH
733
         negotiated_link_width_d  <= negotiated_link_width;
734
   end
735
 
736
 
737
   // Double ACK masking
738
   // 1. Recognizing an ACK when it comes in on Lane 0
739
   //     a.  lanes 1 and 2 should be the same scrambled value (decrambled: 00 00)
740
   always @(l0_pipe_rx_input or pipe_rx_data_l1 or pipe_rx_data_l2 or negotiated_link_width_d[3] or trn_lnk_up_n_d)
741
   begin : ACK_RECOGNITION_L0
742
      if ((l0_pipe_rx_input == SDP  &&           // DLLP
743
          pipe_rx_data_l1 == pipe_rx_data_l2 && // ACK
744
          negotiated_link_width_d[3] == 1'b1)     // 8-lane only 
745
          && !trn_lnk_up_n_d)
746
 
747
           dllp_ack_l0 = 1'b1;
748
 
749
      else
750
           dllp_ack_l0 = 1'b0;
751
 
752
   end
753
 
754
   // Double ACK masking
755
   // 1. Recognizing an ACK when it comes in on Lane 4
756
   //     a.  lanes 5 and 6 should be the same scrambled value (decrambled: 00 00)
757
   always @(l4_pipe_rx_input or pipe_rx_data_l5 or pipe_rx_data_l6 or negotiated_link_width_d[3] or trn_lnk_up_n_d)
758
   begin : ACK_RECOGNITION_L4
759
      if ((l4_pipe_rx_input == SDP  &&           // DLLP
760
          pipe_rx_data_l5 == pipe_rx_data_l6 && // ACK
761
          negotiated_link_width_d[3] == 1'b1)     // 8-lane only 
762
          && !trn_lnk_up_n_d)
763
 
764
           dllp_ack_l4 = 1'b1;
765
 
766
      else
767
           dllp_ack_l4 = 1'b0;
768
 
769
   end
770
 
771
 
772
   // Double ACK masking(Lanes Reversed)
773
   // 1. Recognizing an ACK when it comes in on Lane 7
774
   //     a.  lanes 5 and 6 should be the same scrambled value (decrambled: 00 00)
775
   always @(l7_pipe_rx_input or pipe_rx_data_l5 or pipe_rx_data_l6 or negotiated_link_width_d[3] or trn_lnk_up_n_d)
776
   begin : ACK_RECOGNITION_L7
777
      if ((l7_pipe_rx_input == SDP  &&           // DLLP
778
          pipe_rx_data_l5 == pipe_rx_data_l6 && // ACK
779
          negotiated_link_width_d[3] == 1'b1)     // 8-lane only 
780
          && !trn_lnk_up_n_d)
781
 
782
           dllp_ack_l7_reverse = 1'b1;
783
 
784
      else
785
           dllp_ack_l7_reverse = 1'b0;
786
 
787
   end
788
 
789
   // Double ACK masking(Lanes Reversed)
790
   // 1. Recognizing an ACK when it comes in on Lane 3
791
   //     a.  lanes 1 and 2 should be the same scrambled value (decrambled: 00 00)
792
   always @(l3_pipe_rx_input or pipe_rx_data_l1 or pipe_rx_data_l2 or negotiated_link_width_d[3] or trn_lnk_up_n_d)
793
   begin : ACK_RECOGNITION_L3
794
      if ((l3_pipe_rx_input == SDP  &&           // DLLP
795
          pipe_rx_data_l1 == pipe_rx_data_l2 && // ACK
796
          negotiated_link_width_d[3] == 1'b1)     // 8-lane only 
797
          && !trn_lnk_up_n_d)
798
 
799
           dllp_ack_l3_reverse = 1'b1;
800
 
801
      else
802
           dllp_ack_l3_reverse = 1'b0;
803
 
804
   end
805
 
806
 
807
 
808
 
809
   always @(posedge clk)
810
   begin : REG_ACK
811
         dllp_ack_l0_r  <= dllp_ack_l0;
812
         dllp_ack_l4_r  <= dllp_ack_l4;
813
         dllp_ack_l4_rr <= dllp_ack_l4 && dllp_ack_l4_r;
814
 
815
         dllp_ack_l7_reverse_r  <= dllp_ack_l7_reverse;
816
         dllp_ack_l3_reverse_r  <= dllp_ack_l3_reverse;
817
         dllp_ack_l3_reverse_rr <= dllp_ack_l3_reverse && dllp_ack_l3_reverse_r;
818
   end
819
 
820
 
821
   // 3. Masking out the ACK that is redundant, in the same step where the up-configure fix takes place
822
   //    Register for better timing
823
   always @(posedge clk)
824
   begin : NEW_PIPE_OUT
825
 
826
     // Upconfigure fix     
827
     if(upcfgcap_cycle_l7 || upcfgcap_cycle_l6 || upcfgcap_cycle_l5 || upcfgcap_cycle_l4 ||
828
           upcfgcap_cycle_l3 || upcfgcap_cycle_l2 || upcfgcap_cycle_l1 || upcfgcap_cycle_l0) begin
829
 
830
     if (upcfgcap_cycle_l7 == 1'b1)
831
        pipe_rx_data_l7_out <= 8'h02;
832
 
833
     if (upcfgcap_cycle_l6 == 1'b1)
834
        pipe_rx_data_l6_out <= 8'h02;
835
 
836
     if (upcfgcap_cycle_l5 == 1'b1)
837
        pipe_rx_data_l5_out <= 8'h02;
838
 
839
     if (upcfgcap_cycle_l4 == 1'b1)
840
        pipe_rx_data_l4_out <= 8'h02;
841
 
842
     if (upcfgcap_cycle_l3 == 1'b1)
843
        pipe_rx_data_l3_out <= 8'h02;
844
 
845
     if (upcfgcap_cycle_l2 == 1'b1)
846
        pipe_rx_data_l2_out <= 8'h02;
847
 
848
     if (upcfgcap_cycle_l1 == 1'b1)
849
        pipe_rx_data_l1_out <= 8'h02;
850
 
851
     if (upcfgcap_cycle_l0 == 1'b1)
852
        pipe_rx_data_l0_out <= 8'h02;
853
 
854
        pipe_rx_data_k_out <= pipe_rx_data_k;
855
        pipe_rx_valid_out  <= pipe_rx_valid;
856
 
857
          // Double ACK fix (+ Lane Reversal)
858
     end else if ((dllp_ack_l0 == 1'b1 && dllp_ack_l0_r == 1'b1) ||
859
                  (dllp_ack_l7_reverse == 1'b1 && dllp_ack_l7_reverse_r == 1'b1)) begin
860
        pipe_rx_data_l7_out <= 8'b0;
861
        pipe_rx_data_l6_out <= 8'b0;
862
        pipe_rx_data_l5_out <= 8'b0;
863
        pipe_rx_data_l4_out <= 8'b0;
864
        pipe_rx_data_l3_out <= 8'b0;
865
        pipe_rx_data_l2_out <= 8'b0;
866
        pipe_rx_data_l1_out <= 8'b0;
867
        pipe_rx_data_l0_out <= 8'b0;
868
 
869
        pipe_rx_data_k_out <= 8'b0; // don't drive K char
870
        pipe_rx_valid_out  <= 8'b0; // indicate data not valid
871
 
872
     // Double ACK fix L4 (first clock) (+ Lane Reversal)
873
     end else if ((dllp_ack_l4 == 1'b1 && dllp_ack_l4_r == 1'b1) ||
874
                 (dllp_ack_l3_reverse_rr == 1'b1)) begin
875
        pipe_rx_data_l7_out <= 8'b0;
876
        pipe_rx_data_l6_out <= 8'b0;
877
        pipe_rx_data_l5_out <= 8'b0;
878
        pipe_rx_data_l4_out <= 8'b0;
879
        pipe_rx_data_l3_out <= pipe_rx_data_l3;
880
        pipe_rx_data_l2_out <= pipe_rx_data_l2;
881
        pipe_rx_data_l1_out <= pipe_rx_data_l1;
882
        pipe_rx_data_l0_out <= pipe_rx_data_l0;
883
 
884
        pipe_rx_data_k_out <= {4'b0, pipe_rx_data_k[3:0]}; // don't drive K char
885
        pipe_rx_valid_out  <= {4'b0, pipe_rx_valid[3:0]}; // indicate data not valid
886
 
887
     // Double ACK fix L4 (second clock) (+ Lane Reversal)
888
     end else if ((dllp_ack_l4_rr == 1'b1) ||
889
                 (dllp_ack_l3_reverse == 1'b1 && dllp_ack_l3_reverse_r == 1'b1)) begin
890
        pipe_rx_data_l7_out <= pipe_rx_data_l7;
891
        pipe_rx_data_l6_out <= pipe_rx_data_l6;
892
        pipe_rx_data_l5_out <= pipe_rx_data_l5;
893
        pipe_rx_data_l4_out <= pipe_rx_data_l4;
894
        pipe_rx_data_l3_out <= 8'b0;
895
        pipe_rx_data_l2_out <= 8'b0;
896
        pipe_rx_data_l1_out <= 8'b0;
897
        pipe_rx_data_l0_out <= 8'b0;
898
 
899
        pipe_rx_data_k_out <= {pipe_rx_data_k[7:4], 4'b0}; // don't drive K char
900
        pipe_rx_valid_out  <= {pipe_rx_valid[7:4],  4'b0}; // indicate data not valid
901
 
902
     // Normal
903
     end else begin
904
        pipe_rx_data_l7_out <= pipe_rx_data_l7;
905
        pipe_rx_data_l6_out <= pipe_rx_data_l6;
906
        pipe_rx_data_l5_out <= pipe_rx_data_l5;
907
        pipe_rx_data_l4_out <= pipe_rx_data_l4;
908
        pipe_rx_data_l3_out <= pipe_rx_data_l3;
909
        pipe_rx_data_l2_out <= pipe_rx_data_l2;
910
        pipe_rx_data_l1_out <= pipe_rx_data_l1;
911
        pipe_rx_data_l0_out <= pipe_rx_data_l0;
912
 
913
        pipe_rx_data_k_out <= pipe_rx_data_k;
914
        pipe_rx_valid_out  <= pipe_rx_valid;
915
 
916
     end
917
   end
918
 
919
endmodule
920
 
921
 
922
 
923
 
924
 
925
 

powered by: WebSVN 2.1.0

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