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

Subversion Repositories usb_fpga_2_14

[/] [usb_fpga_2_14/] [trunk/] [examples/] [memfifo/] [fpga-2.18/] [memfifo.srcs/] [sources_1/] [ip/] [mig_7series_0/] [mig_7series_0/] [user_design/] [rtl/] [phy/] [mig_7series_v2_3_ddr_phy_ocd_data.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
//*****************************************************************************
2
// (c) Copyright 2009 - 2013 Xilinx, Inc. All rights reserved.
3
//
4
// This file contains confidential and proprietary information
5
// of Xilinx, Inc. and is protected under U.S. and
6
// international copyright and other intellectual property
7
// laws.
8
//
9
// DISCLAIMER
10
// This disclaimer is not a license and does not grant any
11
// rights to the materials distributed herewith. Except as
12
// otherwise provided in a valid license issued to you by
13
// Xilinx, and to the maximum extent permitted by applicable
14
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
15
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
16
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
17
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
18
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
19
// (2) Xilinx shall not be liable (whether in contract or tort,
20
// including negligence, or under any other theory of
21
// liability) for any loss or damage of any kind or nature
22
// related to, arising under or in connection with these
23
// materials, including for any direct, or any indirect,
24
// special, incidental, or consequential loss or damage
25
// (including loss of data, profits, goodwill, or any type of
26
// loss or damage suffered as a result of any action brought
27
// by a third party) even if such damage or loss was
28
// reasonably foreseeable or Xilinx had been advised of the
29
// possibility of the same.
30
//
31
// CRITICAL APPLICATIONS
32
// Xilinx products are not designed or intended to be fail-
33
// safe, or for use in any application requiring fail-safe
34
// performance, such as life-support or safety devices or
35
// systems, Class III medical devices, nuclear facilities,
36
// applications related to the deployment of airbags, or any
37
// other applications that could lead to death, personal
38
// injury, or severe property or environmental damage
39
// (individually and collectively, "Critical
40
// Applications"). Customer assumes the sole risk and
41
// liability of any use of Xilinx products in Critical
42
// Applications, subject only to applicable laws and
43
// regulations governing limitations on product liability.
44
//
45
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
46
// PART OF THIS FILE AT ALL TIMES.
47
//
48
//*****************************************************************************
49
//   ____  ____
50
//  /   /\/   /
51
// /___/  \  /    Vendor: Xilinx
52
// \   \   \/     Version: %version
53
//  \   \         Application: MIG
54
//  /   /         Filename: ddr_phy_v2_3_phy_ocd_data.v
55
// /___/   /\     Date Last Modified: $Date: 2011/02/25 02:07:40 $
56
// \   \  /  \    Date Created: Aug 03 2009 
57
//  \___\/\___\
58
//
59
//Device: 7 Series
60
//Design Name: DDR3 SDRAM
61
//Purpose: Data comparison for both "non-complex" and "complex" data.
62
//
63
// Depending on complex_oclkdelay_calib_start, data provided on the phy_rddata
64
// bus is compared against a fixed ones and zeros pattern, or against data
65
// provided on the prob_o bus.
66
//
67
// In the case of complex data, the phy_rddata data is delayed by two
68
// clocks to match up with the prbs_o data.
69
//
70
// For 4:1 mode, in each fabric clock, a complete DRAM burst may be delivered.
71
// A DRAM burst is 8 times the width of the DQ bus.  For an 8 byte DQ
72
// bus, 64 bytes are delivered on each clock.
73
//
74
// In 2:1 mode the DRAM burst is delivered on two fabric clocks.  For
75
// an 8 byte bus, 32 bytes are delivered with each fabric clock.
76
//
77
// For the most part, this block does not use phy_rddata_en.  It delivers
78
// its results and depends on downstream logic to know when its valid.
79
//
80
// phy_rddata_en is used for the PRBS compares when the last line of data
81
// needs to be carried over to a subsequent line.
82
//
83
// Since we work on a byte at a time, the comparison only works on
84
// one byte of the DQ bus at a time.  The oclkdelay_calib_cnt field is used to
85
// select the proper 8 bytes out of both the phy_rddata and prob_o streams.
86
//
87
// Comparisons are computed for "zero" or "rise" data, and "oneeighty" or
88
// "fall" data.  The "oneeighty" compares assumes the rising edge clock is
89
// landing in the oneeighty data.
90
//
91
// For the simple data, we don't need to worry about first byte or last
92
// byte conditions because the sampled data is taken from the middle
93
// of a 4 burst segment.
94
//
95
// The complex (or PRBS) data starts and stops.  And we need to be
96
// careful about ignoring compares that might be using invalid latched
97
// data. The PRBS generator provides prbs_ignore_first_byte and 
98
// prbs_ignore_last_bytes.  The comparison block is procedural.  It
99
// first compares across the entire line, then comes back and overwrites
100
// any byte compare results as indicated by the _ignore_ wires.
101
// 
102
// The compares generate an eight bit vector, one for each byte.  The
103
// final step is to bitwise AND this eight bit vector.  We end up
104
// with two sets of two bits.  Zero and oneeighty for the fixed pattern
105
// and the prbs.   
106
//
107
// complex_oclkdelay_calib_start is used to
108
// select between the fixed and prbs compares.  The final output
109
// is a two bit match bus.
110
//
111
// There is a deprecated feature to mask the compare for any byte.
112
//
113
//      
114
//Reference:
115
//Revision History:
116
//*****************************************************************************
117
 
118
`timescale 1ps/1ps
119
 
120
module mig_7series_v2_3_ddr_phy_ocd_data #
121
  (parameter TCQ                = 100,
122
   parameter nCK_PER_CLK        = 4,
123
   parameter DQS_CNT_WIDTH      = 3,
124
   parameter DQ_WIDTH           = 64)
125
  (/*AUTOARG*/
126
  // Outputs
127
  match,
128
  // Inputs
129
  clk, rst, complex_oclkdelay_calib_start, phy_rddata, prbs_o,
130
  oclkdelay_calib_cnt, prbs_ignore_first_byte, prbs_ignore_last_bytes,
131
  phy_rddata_en_1
132
  );
133
 
134
  localparam [7:0] OCAL_DQ_MASK = 8'b0000_0000;
135
 
136
  input clk;
137
  input rst;
138
 
139
  input complex_oclkdelay_calib_start;
140
  input [2*nCK_PER_CLK*DQ_WIDTH-1:0] phy_rddata;
141
  input [2*nCK_PER_CLK*DQ_WIDTH-1:0] prbs_o;
142
  input [DQS_CNT_WIDTH:0] oclkdelay_calib_cnt;
143
 
144
  reg [DQ_WIDTH-1:0] word, word_shifted;
145
 
146
  reg [63:0] data_bytes_ns, data_bytes_r, data_bytes_r1, data_bytes_r2, prbs_bytes_ns, prbs_bytes_r;
147
  always @(posedge clk) data_bytes_r <= #TCQ data_bytes_ns;
148
  always @(posedge clk) data_bytes_r1 <= #TCQ data_bytes_r;
149
  always @(posedge clk) data_bytes_r2 <= #TCQ data_bytes_r1;
150
  always @(posedge clk) prbs_bytes_r <= #TCQ prbs_bytes_ns;
151
 
152
  input prbs_ignore_first_byte, prbs_ignore_last_bytes;
153
  reg prbs_ignore_first_byte_r, prbs_ignore_last_bytes_r;
154
  always @(posedge clk) prbs_ignore_first_byte_r <= #TCQ prbs_ignore_first_byte;
155
  always @(posedge clk) prbs_ignore_last_bytes_r <= #TCQ prbs_ignore_last_bytes;
156
 
157
  input phy_rddata_en_1;
158
  reg [7:0] last_byte_r;
159
  wire [63:0] data_bytes = complex_oclkdelay_calib_start ? data_bytes_r2 : data_bytes_r;
160
 
161
  wire [7:0] last_byte_ns;
162
  generate if (nCK_PER_CLK == 4) begin
163
    assign last_byte_ns = phy_rddata_en_1 ? data_bytes[63:56] : last_byte_r;
164
  end else begin
165
    assign last_byte_ns = phy_rddata_en_1 ? data_bytes[31:24] : last_byte_r;
166
  end endgenerate
167
  always @(posedge clk) last_byte_r <= #TCQ last_byte_ns;
168
 
169
  reg second_half_ns, second_half_r;
170
  always @(posedge clk) second_half_r <= #TCQ second_half_ns;
171
  always @(*) begin
172
    second_half_ns = second_half_r;
173
    if (rst) second_half_ns = 1'b0;
174
    else second_half_ns = phy_rddata_en_1 ^ second_half_r;
175
  end
176
 
177
  reg [7:0] comp0, comp180, prbs0, prbs180;
178
 
179
  integer ii;
180
  always @(*) begin
181
    comp0 = 8'hff;
182
    comp180 = 8'hff;
183
    prbs0 = 8'hff;
184
    prbs180 = 8'hff;
185
    data_bytes_ns = 64'b0;
186
    prbs_bytes_ns = 64'b0;
187
    for (ii=0; ii<2*nCK_PER_CLK; ii=ii+1)
188
      begin
189
        word = phy_rddata[ii*DQ_WIDTH+:DQ_WIDTH];
190
        word_shifted = word >> oclkdelay_calib_cnt*8;
191
        data_bytes_ns[ii*8+:8] = word_shifted[7:0];
192
 
193
        word = prbs_o[ii*DQ_WIDTH+:DQ_WIDTH];
194
        word_shifted = word >> oclkdelay_calib_cnt*8;
195
        prbs_bytes_ns[ii*8+:8] = word_shifted[7:0];
196
 
197
        comp0[ii] = data_bytes[ii*8+:8] == (ii%2 ? 8'hff : 8'h00);
198
        comp180[ii] = data_bytes[ii*8+:8] == (ii%2 ? 8'h00 : 8'hff);
199
 
200
        prbs0[ii] = data_bytes[ii*8+:8] == prbs_bytes_r[ii*8+:8];
201
      end // for (ii=0; ii<2*nCK_PER_CLK; ii=ii+1)
202
    prbs180[0] = last_byte_r == prbs_bytes_r[7:0];
203
    for (ii=1; ii<2*nCK_PER_CLK; ii=ii+1)
204
        prbs180[ii] = data_bytes[(ii-1)*8+:8] == prbs_bytes_r[ii*8+:8];
205
    if (nCK_PER_CLK == 4) begin
206
      if (prbs_ignore_last_bytes_r) begin
207
        prbs0[7:6] = 2'b11;
208
        prbs180[7] = 1'b1;
209
      end
210
      if (prbs_ignore_first_byte_r) prbs180[0] = 1'b1;
211
    end else begin
212
      if (second_half_r) begin
213
        if (prbs_ignore_last_bytes_r) begin
214
            prbs0[3:2] = 2'b11;
215
            prbs180[3] = 1'b1;
216
        end
217
      end else if (prbs_ignore_first_byte_r) prbs180[0] = 1'b1;
218
    end // else: !if(nCK_PER_CLK == 4)
219
  end // always @ (*)
220
 
221
  wire [7:0] comp0_masked = comp0 | OCAL_DQ_MASK;
222
  wire [7:0] comp180_masked = comp180 | OCAL_DQ_MASK;
223
  wire [7:0] prbs0_masked = prbs0 | OCAL_DQ_MASK;
224
  wire [7:0] prbs180_masked = prbs180 | OCAL_DQ_MASK;
225
 
226
  output [1:0] match;
227
  assign match = complex_oclkdelay_calib_start ? {&prbs180_masked, &prbs0_masked} : {&comp180_masked , &comp0_masked};
228
 
229
 
230
endmodule // mig_7series_v2_3_ddr_phy_ocd_data
231
 

powered by: WebSVN 2.1.0

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