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_edge.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_edge.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: Detects and stores edges as the test pattern is scanned via
62
// manipulating the phaser out stage 3 taps.
63
//
64
// Scanning always proceeds from the left to the right.  For more
65
// on the scanning algorithm, see the _po_cntlr block.
66
//
67
// Four scan results are reported.  The edges at fuzz2zero, 
68
// zero2fuzz, fuzz2oneeighty, and oneeighty2fuzz.  Each edge
69
// has a 6 bit stg3 tap value and a valid bit.  The valid bits
70
// are reset before the scan starts.
71
//
72
// Once reset_scan is set low, this block waits for the first
73
// samp_done while scanning_right.  This marks the left end
74
// of the scan, and initializes prev_samp_r with samp_result and 
75
// sets the prev_samp_r valid bit to one.
76
//
77
// At each subesquent samp_done, the previous samp is compared
78
// to the current samp_result.  The case statement details how
79
// edges are identified.
80
//
81
// Original design assumed fuzz between valid regions.  Design
82
// has been updated to tolerate transitions from zero to oneeight
83
// and vice-versa without fuzz in between.
84
//
85
//Reference:
86
//Revision History:
87
//*****************************************************************************
88
 
89
`timescale 1ps/1ps
90
 
91
module mig_7series_v2_3_ddr_phy_ocd_edge #
92
  (parameter TCQ                = 100)
93
  (/*AUTOARG*/
94
  // Outputs
95
  scan_right, z2f, f2z, o2f, f2o, zero2fuzz, fuzz2zero,
96
  oneeighty2fuzz, fuzz2oneeighty,
97
  // Inputs
98
  clk, samp_done, phy_rddata_en_2, reset_scan, scanning_right,
99
  samp_result, stg3
100
  );
101
 
102
 
103
  localparam [1:0] NULL       = 2'b11,
104
                   FUZZ       = 2'b00,
105
                   ONEEIGHTY  = 2'b10,
106
                   ZERO       = 2'b01;
107
 
108
  input clk;
109
 
110
  input samp_done;
111
  input phy_rddata_en_2;
112
  wire samp_valid = samp_done && phy_rddata_en_2;
113
 
114
  input reset_scan;
115
 
116
  input scanning_right;
117
 
118
  reg prev_samp_valid_ns, prev_samp_valid_r;
119
  always @(posedge clk) prev_samp_valid_r <= #TCQ prev_samp_valid_ns;
120
  always @(*) begin
121
    prev_samp_valid_ns = prev_samp_valid_r;
122
    if (reset_scan) prev_samp_valid_ns = 1'b0;
123
    else if (samp_valid) prev_samp_valid_ns = 1'b1;
124
  end
125
 
126
  input [1:0] samp_result;
127
 
128
  reg [1:0] prev_samp_ns, prev_samp_r;
129
  always @(posedge clk) prev_samp_r <= #TCQ prev_samp_ns;
130
  always @(*)
131
    if (samp_valid) prev_samp_ns = samp_result;
132
    else prev_samp_ns = prev_samp_r;
133
 
134
  reg scan_right_ns, scan_right_r;
135
  always @(posedge clk) scan_right_r <= #TCQ scan_right_ns;
136
  output scan_right;
137
  assign scan_right = scan_right_r;
138
 
139
  input [5:0] stg3;
140
 
141
  reg z2f_ns, z2f_r, f2z_ns, f2z_r, o2f_ns, o2f_r, f2o_ns, f2o_r;
142
  always @(posedge clk) z2f_r <= #TCQ z2f_ns;
143
  always @(posedge clk) f2z_r <= #TCQ f2z_ns;
144
  always @(posedge clk) o2f_r <= #TCQ o2f_ns;
145
  always @(posedge clk) f2o_r <= #TCQ f2o_ns;
146
 
147
  output z2f, f2z, o2f, f2o;
148
  assign z2f = z2f_r;
149
  assign f2z = f2z_r;
150
  assign o2f = o2f_r;
151
  assign f2o = f2o_r;
152
 
153
  reg [5:0] zero2fuzz_ns, zero2fuzz_r, fuzz2zero_ns, fuzz2zero_r,
154
            oneeighty2fuzz_ns, oneeighty2fuzz_r, fuzz2oneeighty_ns, fuzz2oneeighty_r;
155
  always @(posedge clk) zero2fuzz_r <= #TCQ zero2fuzz_ns;
156
  always @(posedge clk) fuzz2zero_r <= #TCQ fuzz2zero_ns;
157
  always @(posedge clk) oneeighty2fuzz_r <= #TCQ oneeighty2fuzz_ns;
158
  always @(posedge clk) fuzz2oneeighty_r <= #TCQ fuzz2oneeighty_ns;
159
 
160
  output [5:0] zero2fuzz, fuzz2zero, oneeighty2fuzz, fuzz2oneeighty;
161
  assign zero2fuzz = zero2fuzz_r;
162
  assign fuzz2zero = fuzz2zero_r;
163
  assign oneeighty2fuzz = oneeighty2fuzz_r;
164
  assign fuzz2oneeighty = fuzz2oneeighty_r;
165
 
166
  always @(*) begin
167
    z2f_ns = z2f_r;
168
    f2z_ns = f2z_r;
169
    o2f_ns = o2f_r;
170
    f2o_ns = f2o_r;
171
    zero2fuzz_ns = zero2fuzz_r;
172
    fuzz2zero_ns = fuzz2zero_r;
173
    oneeighty2fuzz_ns = oneeighty2fuzz_r;
174
    fuzz2oneeighty_ns = fuzz2oneeighty_r;
175
    scan_right_ns = 1'b0;
176
 
177
    if (reset_scan) begin
178
      z2f_ns = 1'b0;
179
      f2z_ns = 1'b0;
180
      o2f_ns = 1'b0;
181
      f2o_ns = 1'b0;
182
    end
183
    else if (samp_valid && prev_samp_valid_r)
184
      case (prev_samp_r)
185
        FUZZ :
186
          if (scanning_right) begin
187
            if (samp_result == ZERO) begin
188
              fuzz2zero_ns = stg3;
189
              f2z_ns = 1'b1;
190
            end
191
            if (samp_result == ONEEIGHTY) begin
192
              fuzz2oneeighty_ns = stg3;
193
              f2o_ns = 1'b1;
194
            end
195
          end
196
        ZERO : begin
197
          if (samp_result == FUZZ || samp_result == ONEEIGHTY) scan_right_ns = !scanning_right;
198
          if (scanning_right) begin
199
            if (samp_result == FUZZ) begin
200
              zero2fuzz_ns = stg3 - 6'b1;
201
              z2f_ns = 1'b1;
202
            end
203
            if (samp_result == ONEEIGHTY) begin
204
              zero2fuzz_ns = stg3 - 6'b1;
205
              z2f_ns = 1'b1;
206
              fuzz2oneeighty_ns = stg3;
207
              f2o_ns = 1'b1;
208
            end
209
          end
210
        end
211
        ONEEIGHTY :
212
          if (scanning_right) begin
213
            if (samp_result == FUZZ) begin
214
              oneeighty2fuzz_ns = stg3 - 6'b1;
215
              o2f_ns = 1'b1;
216
            end
217
            if (samp_result == ZERO)
218
              if (f2o_r) begin
219
                oneeighty2fuzz_ns = stg3 - 6'b1;
220
                o2f_ns = 1'b1;
221
              end else begin
222
                fuzz2zero_ns = stg3;
223
                f2z_ns = 1'b1;
224
              end
225
 
226
          end // if (scanning_right)
227
//      NULL :  // Should never happen
228
      endcase
229
  end
230
 
231
endmodule // mig_7series_v2_3_ddr_phy_ocd_edge

powered by: WebSVN 2.1.0

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