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/] [gtx_rx_valid_filter_v6.v] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 barabba
 
2
//-----------------------------------------------------------------------------
3
//
4
// (c) Copyright 2009 Xilinx, Inc. All rights reserved.
5
//
6
// This file contains confidential and proprietary information of Xilinx, Inc.
7
// and is protected under U.S. and international copyright and other
8
// intellectual property laws.
9
//
10
// DISCLAIMER
11
//
12
// This disclaimer is not a license and does not grant any rights to the
13
// materials distributed herewith. Except as otherwise provided in a valid
14
// license issued to you by Xilinx, and to the maximum extent permitted by
15
// applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
16
// FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
17
// IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
18
// MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
19
// and (2) Xilinx shall not be liable (whether in contract or tort, including
20
// negligence, or under any other theory of liability) for any loss or damage
21
// of any kind or nature related to, arising under or in connection with these
22
// materials, including for any direct, or any indirect, special, incidental,
23
// or consequential loss or damage (including loss of data, profits, goodwill,
24
// or any type of loss or damage suffered as a result of any action brought by
25
// a third party) even if such damage or loss was reasonably foreseeable or
26
// Xilinx had been advised of the possibility of the same.
27
//
28
// CRITICAL APPLICATIONS
29
//
30
// Xilinx products are not designed or intended to be fail-safe, or for use in
31
// any application requiring fail-safe performance, such as life-support or
32
// safety devices or systems, Class III medical devices, nuclear facilities,
33
// applications related to the deployment of airbags, or any other
34
// applications that could lead to death, personal injury, or severe property
35
// or environmental damage (individually and collectively, "Critical
36
// Applications"). Customer assumes the sole risk and liability of any use of
37
// Xilinx products in Critical Applications, subject only to applicable laws
38
// and regulations governing limitations on product liability.
39
//
40
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
41
// AT ALL TIMES.
42
//
43
//-----------------------------------------------------------------------------
44
// Project    : Virtex-6 Integrated Block for PCI Express
45
// File       : gtx_rx_valid_filter_v6.v
46
 
47
`timescale 1ns / 1ns
48
 
49
module GTX_RX_VALID_FILTER_V6 #(
50
 
51
  parameter           CLK_COR_MIN_LAT    = 28
52
 
53
)
54
(
55
  output  [1:0]       USER_RXCHARISK,
56
  output  [15:0]      USER_RXDATA,
57
  output              USER_RXVALID,
58
  output              USER_RXELECIDLE,
59
  output  [ 2:0]      USER_RX_STATUS,
60
  output              USER_RX_PHY_STATUS,
61
 
62
  input  [1:0]        GT_RXCHARISK,
63
  input  [15:0]       GT_RXDATA,
64
  input               GT_RXVALID,
65
  input               GT_RXELECIDLE,
66
  input  [ 2:0]       GT_RX_STATUS,
67
  input               GT_RX_PHY_STATUS,
68
 
69
 
70
  input               USER_CLK,
71
  input               RESET
72
 
73
);
74
 
75
  parameter TCQ = 1;
76
 
77
  parameter EIOS_DET_IDL      = 5'b00001;
78
  parameter EIOS_DET_NO_STR0  = 5'b00010;
79
  parameter EIOS_DET_STR0     = 5'b00100;
80
  parameter EIOS_DET_STR1     = 5'b01000;
81
  parameter EIOS_DET_DONE     = 5'b10000;
82
 
83
  parameter EIOS_COM          = 8'hBC;
84
  parameter EIOS_IDL          = 8'h7C;
85
 
86
  reg    [4:0]        reg_state_eios_det;
87
  wire   [4:0]        state_eios_det;
88
 
89
  reg                 reg_eios_detected;
90
  wire                eios_detected;
91
 
92
  reg                 reg_symbol_after_eios;
93
  wire                symbol_after_eios;
94
 
95
  parameter USER_RXVLD_IDL     = 4'b0001;
96
  parameter USER_RXVLD_EI      = 4'b0010;
97
  parameter USER_RXVLD_EI_DB0  = 4'b0100;
98
  parameter USER_RXVLD_EI_DB1  = 4'b1000;
99
 
100
  reg    [3:0]        reg_state_rxvld_ei;
101
  wire   [3:0]        state_rxvld_ei;
102
 
103
  reg    [4:0]        reg_rxvld_count;
104
  wire   [4:0]        rxvld_count;
105
 
106
  reg    [3:0]        reg_rxvld_fallback;
107
  wire   [3:0]        rxvld_fallback;
108
 
109
  reg    [1:0]        gt_rxcharisk_q;
110
  reg    [15:0]       gt_rxdata_q;
111
  reg                 gt_rxvalid_q;
112
  reg                 gt_rxelecidle_q;
113
 
114
  reg    [ 2:0]       gt_rx_status_q;
115
  reg                 gt_rx_phy_status_q;
116
 
117
  // EIOS detector
118
 
119
  always @(posedge USER_CLK) begin
120
 
121
    if (RESET) begin
122
 
123
      reg_eios_detected <= #TCQ 1'b0;
124
      reg_state_eios_det <= #TCQ EIOS_DET_IDL;
125
      reg_symbol_after_eios <= #TCQ 1'b0;
126
      gt_rxcharisk_q <= #TCQ 2'b00;
127
      gt_rxdata_q <= #TCQ 16'h0;
128
      gt_rxvalid_q <= #TCQ 1'b0;
129
      gt_rxelecidle_q <= #TCQ 1'b0;
130
      gt_rx_status_q <= #TCQ 3'b000;
131
      gt_rx_phy_status_q <= #TCQ 1'b0;
132
 
133
    end else begin
134
 
135
      reg_eios_detected <= #TCQ 1'b0;
136
      reg_symbol_after_eios <= #TCQ 1'b0;
137
      gt_rxcharisk_q <= #TCQ GT_RXCHARISK;
138
      gt_rxdata_q <= #TCQ GT_RXDATA;
139
      gt_rxvalid_q <= #TCQ GT_RXVALID;
140
      gt_rxelecidle_q <= #TCQ GT_RXELECIDLE;
141
      gt_rx_status_q <= #TCQ GT_RX_STATUS;
142
      gt_rx_phy_status_q <= #TCQ GT_RX_PHY_STATUS;
143
 
144
      case ( state_eios_det )
145
 
146
        EIOS_DET_IDL : begin
147
 
148
          if ((gt_rxcharisk_q[0]) && (gt_rxdata_q[7:0] == EIOS_COM) &&
149
              (gt_rxcharisk_q[1]) && (gt_rxdata_q[15:8] == EIOS_IDL)) begin
150
 
151
            reg_state_eios_det <= #TCQ EIOS_DET_NO_STR0;
152
            reg_eios_detected <= #TCQ 1'b1;
153
 
154
          end else if ((gt_rxcharisk_q[1]) && (gt_rxdata_q[15:8] == EIOS_COM))
155
            reg_state_eios_det <= #TCQ EIOS_DET_STR0;
156
          else
157
            reg_state_eios_det <= #TCQ EIOS_DET_IDL;
158
 
159
        end
160
 
161
        EIOS_DET_NO_STR0 : begin
162
 
163
          if ((gt_rxcharisk_q[0] && (gt_rxdata_q[7:0] == EIOS_IDL)) &&
164
              (gt_rxcharisk_q[1] && (gt_rxdata_q[15:8] == EIOS_IDL)))
165
            reg_state_eios_det <= #TCQ EIOS_DET_DONE;
166
          else
167
            reg_state_eios_det <= #TCQ EIOS_DET_IDL;
168
 
169
        end
170
 
171
        EIOS_DET_STR0 : begin
172
 
173
          if ((gt_rxcharisk_q[0] && (gt_rxdata_q[7:0] == EIOS_IDL)) &&
174
              (gt_rxcharisk_q[1] && (gt_rxdata_q[15:8] == EIOS_IDL))) begin
175
 
176
            reg_state_eios_det <= #TCQ EIOS_DET_STR1;
177
            reg_eios_detected <= #TCQ 1'b1;
178
            reg_symbol_after_eios <= #TCQ 1'b1;
179
 
180
          end else
181
            reg_state_eios_det <= #TCQ EIOS_DET_IDL;
182
 
183
        end
184
 
185
        EIOS_DET_STR1 : begin
186
 
187
          if ((gt_rxcharisk_q[0]) && (gt_rxdata_q[7:0] == EIOS_IDL))
188
            reg_state_eios_det <= #TCQ EIOS_DET_DONE;
189
          else
190
            reg_state_eios_det <= #TCQ EIOS_DET_IDL;
191
 
192
        end
193
 
194
        EIOS_DET_DONE : begin
195
 
196
          reg_state_eios_det <= #TCQ EIOS_DET_IDL;
197
 
198
        end
199
 
200
      endcase
201
 
202
    end
203
 
204
  end
205
  assign state_eios_det = reg_state_eios_det;
206
  assign eios_detected = reg_eios_detected;
207
  assign symbol_after_eios = reg_symbol_after_eios;
208
 
209
  // user_rxvalid generation
210
 
211
  always @(posedge USER_CLK) begin
212
 
213
    if (RESET) begin
214
 
215
      reg_state_rxvld_ei <= #TCQ USER_RXVLD_IDL;
216
 
217
    end else begin
218
 
219
      case ( state_rxvld_ei )
220
 
221
        USER_RXVLD_IDL : begin
222
 
223
          if (eios_detected)
224
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_EI;
225
          else
226
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_IDL;
227
 
228
        end
229
 
230
        USER_RXVLD_EI : begin
231
 
232
          if (!gt_rxvalid_q)
233
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_EI_DB0;
234
          else if (rxvld_fallback == 4'b1111)
235
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_IDL;
236
          else
237
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_EI;
238
 
239
        end
240
 
241
        USER_RXVLD_EI_DB0 : begin
242
 
243
          if (gt_rxvalid_q)
244
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_EI_DB1;
245
          else
246
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_EI_DB0;
247
 
248
        end
249
 
250
        USER_RXVLD_EI_DB1 : begin
251
 
252
          if (rxvld_count > CLK_COR_MIN_LAT)
253
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_IDL;
254
          else
255
            reg_state_rxvld_ei <= #TCQ USER_RXVLD_EI_DB1;
256
 
257
        end
258
 
259
      endcase
260
 
261
    end
262
 
263
  end
264
  assign state_rxvld_ei = reg_state_rxvld_ei;
265
 
266
  // RxValid counter
267
 
268
  always @(posedge USER_CLK) begin
269
 
270
    if (RESET) begin
271
 
272
      reg_rxvld_count <= #TCQ 5'b00000;
273
 
274
    end else begin
275
 
276
      if ((gt_rxvalid_q) &&  (state_rxvld_ei == USER_RXVLD_EI_DB1))
277
        reg_rxvld_count <= #TCQ reg_rxvld_count + 1'b1;
278
      else
279
        reg_rxvld_count <= #TCQ 5'b00000;
280
 
281
    end
282
 
283
  end
284
  assign rxvld_count = reg_rxvld_count;
285
 
286
  // RxValid fallback
287
 
288
  always @(posedge USER_CLK) begin
289
 
290
    if (RESET) begin
291
 
292
      reg_rxvld_fallback <= #TCQ 4'b0000;
293
 
294
    end else begin
295
 
296
      if (state_rxvld_ei == USER_RXVLD_EI)
297
        reg_rxvld_fallback <= #TCQ reg_rxvld_fallback + 1'b1;
298
      else
299
        reg_rxvld_fallback <= #TCQ 4'b0000;
300
 
301
    end
302
 
303
  end
304
  assign rxvld_fallback = reg_rxvld_fallback;
305
 
306
  // Delay pipe_rx_elec_idle
307
 
308
  SRL16E #(.INIT(0)) rx_elec_idle_delay (.Q(USER_RXELECIDLE),
309
                                         .D(gt_rxelecidle_q),
310
                                         .CLK(USER_CLK),
311
                                         .CE(1'b1), .A3(1'b1),.A2(1'b1),.A1(1'b1),.A0(1'b1));
312
 
313
  assign USER_RXVALID = (state_rxvld_ei == USER_RXVLD_IDL) ? gt_rxvalid_q : 1'b0;
314
  assign USER_RXCHARISK[0] = USER_RXVALID ? gt_rxcharisk_q[0] : 1'b0;
315
  assign USER_RXCHARISK[1] = (USER_RXVALID && !symbol_after_eios) ? gt_rxcharisk_q[1] : 1'b0;
316
  assign USER_RXDATA = gt_rxdata_q;
317
  assign USER_RX_STATUS = (state_rxvld_ei == USER_RXVLD_IDL) ? gt_rx_status_q : 3'b000;
318
  assign USER_RX_PHY_STATUS = gt_rx_phy_status_q;
319
 
320
endmodule

powered by: WebSVN 2.1.0

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