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.14/] [memfifo.srcs/] [sources_1/] [ip/] [mig_7series_0/] [mig_7series_0/] [user_design/] [rtl/] [phy/] [mig_7series_v2_3_ddr_phy_wrlvl_off_delay.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_ck_addr_cmd_delay.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: Module to decrement initial PO delay to 0 and add 1/4 tck for tdqss
62
//Reference:
63
//Revision History:
64
//*****************************************************************************
65
 
66
`timescale 1ps/1ps
67
 
68
module mig_7series_v2_3_ddr_phy_wrlvl_off_delay #
69
  (
70
   parameter TCQ           = 100,
71
   parameter tCK           = 3636,
72
   parameter nCK_PER_CLK   = 2,
73
   parameter CLK_PERIOD    = 4,
74
   parameter PO_INITIAL_DLY= 46,
75
   parameter DQS_CNT_WIDTH = 3,
76
   parameter DQS_WIDTH     = 8,
77
   parameter N_CTL_LANES   = 3
78
   )
79
  (
80
   input                        clk,
81
   input                        rst,
82
   input                        pi_fine_dly_dec_done,
83
   input                        cmd_delay_start,
84
   // Control lane being shifted using Phaser_Out fine delay taps
85
   output reg [DQS_CNT_WIDTH:0] ctl_lane_cnt,
86
   // Inc/dec Phaser_Out fine delay line
87
   output reg                   po_s2_incdec_f,
88
   output reg                   po_en_s2_f,
89
   // Inc/dec Phaser_Out coarse delay line
90
   output reg                   po_s2_incdec_c,
91
   output reg                   po_en_s2_c,
92
   // Completed adjusting delays for dq, dqs for tdqss 
93
   output                      po_ck_addr_cmd_delay_done,
94
   // completed decrementing initialPO delays 
95
   output                      po_dec_done,
96
   output                      phy_ctl_rdy_dly
97
   );
98
 
99
 
100
  localparam TAP_LIMIT = 63;
101
 
102
 
103
 
104
// PO fine delay tap resolution change by frequency. tCK > 2500, need
105
// twice the amount of taps
106
//  localparam D_DLY_F = (tCK > 2500 ) ? D_DLY * 2 : D_DLY;
107
 
108
 // coarse delay tap is added DQ/DQS to meet the TDQSS specification. 
109
 localparam TDQSS_DLY = (tCK > 2500 )? 2: 1;
110
 
111
   reg       delay_done;
112
   reg       delay_done_r1;
113
   reg       delay_done_r2;
114
   reg       delay_done_r3;
115
   reg       delay_done_r4;
116
   reg [5:0] po_delay_cnt_r;
117
   reg       po_cnt_inc;
118
   reg       cmd_delay_start_r1;
119
   reg       cmd_delay_start_r2;
120
   reg       cmd_delay_start_r3;
121
   reg       cmd_delay_start_r4;
122
   reg       cmd_delay_start_r5;
123
   reg       cmd_delay_start_r6;
124
   reg       po_delay_done;
125
   reg       po_delay_done_r1;
126
   reg       po_delay_done_r2;
127
   reg       po_delay_done_r3;
128
   reg       po_delay_done_r4;
129
   reg       pi_fine_dly_dec_done_r;
130
   reg       po_en_stg2_c;
131
   reg       po_en_stg2_f;
132
   reg       po_stg2_incdec_c;
133
   reg       po_stg2_f_incdec;
134
   reg [DQS_CNT_WIDTH:0] lane_cnt_dqs_c_r;
135
   reg [DQS_CNT_WIDTH:0] lane_cnt_po_r;
136
   reg [5:0]              delay_cnt_r;
137
 
138
   always @(posedge clk) begin
139
      cmd_delay_start_r1     <= #TCQ cmd_delay_start;
140
      cmd_delay_start_r2     <= #TCQ cmd_delay_start_r1;
141
      cmd_delay_start_r3     <= #TCQ cmd_delay_start_r2;
142
      cmd_delay_start_r4     <= #TCQ cmd_delay_start_r3;
143
      cmd_delay_start_r5     <= #TCQ cmd_delay_start_r4;
144
      cmd_delay_start_r6     <= #TCQ cmd_delay_start_r5;
145
      pi_fine_dly_dec_done_r <= #TCQ pi_fine_dly_dec_done;
146
    end
147
 
148
   assign phy_ctl_rdy_dly  = cmd_delay_start_r6;
149
 
150
 
151
  // logic for decrementing initial fine delay taps for all PO
152
  // Decrement done for add, ctrl and data phaser outs
153
 
154
  assign po_dec_done = (PO_INITIAL_DLY == 0) ? 1 : po_delay_done_r4;
155
 
156
 
157
  always @(posedge clk)
158
    if (rst || ~cmd_delay_start_r6 || po_delay_done) begin
159
      po_stg2_f_incdec  <= #TCQ 1'b0;
160
      po_en_stg2_f    <= #TCQ 1'b0;
161
    end else if (po_delay_cnt_r > 6'd0) begin
162
      po_en_stg2_f    <= #TCQ ~po_en_stg2_f;
163
    end
164
 
165
  always @(posedge clk)
166
    if (rst || ~cmd_delay_start_r6 || (po_delay_cnt_r == 6'd0))
167
      // set all the PO delays to 31. Decrement from 46 to 31. 
168
      // Requirement comes from dqs_found logic 
169
      po_delay_cnt_r  <= #TCQ (PO_INITIAL_DLY - 31);
170
    else if ( po_en_stg2_f && (po_delay_cnt_r > 6'd0))
171
      po_delay_cnt_r  <= #TCQ po_delay_cnt_r - 1;
172
 
173
  always @(posedge clk)
174
    if (rst)
175
      lane_cnt_po_r  <= #TCQ 'd0;
176
    else if ( po_en_stg2_f  && (po_delay_cnt_r == 6'd1))
177
      lane_cnt_po_r  <= #TCQ lane_cnt_po_r + 1;
178
 
179
  always @(posedge clk)
180
    if (rst || ~cmd_delay_start_r6 )
181
      po_delay_done    <= #TCQ 1'b0;
182
    else if ((po_delay_cnt_r == 6'd1) && (lane_cnt_po_r ==1'b0))
183
      po_delay_done    <= #TCQ 1'b1;
184
 
185
  always @(posedge clk) begin
186
    po_delay_done_r1 <= #TCQ po_delay_done;
187
    po_delay_done_r2 <= #TCQ po_delay_done_r1;
188
    po_delay_done_r3 <= #TCQ po_delay_done_r2;
189
    po_delay_done_r4 <= #TCQ po_delay_done_r3;
190
  end
191
 
192
  // logic to select between all PO delays and data path delay.  
193
  always @(posedge clk) begin
194
    po_s2_incdec_f <= #TCQ po_stg2_f_incdec;
195
    po_en_s2_f <= #TCQ po_en_stg2_f;
196
  end
197
 
198
// Logic to add 1/4 taps amount of delay to data path for tdqss.
199
// After all the initial PO delays are decremented the 1/4 delay will
200
// be added. Coarse delay taps will be added here .
201
// Delay added only to data path 
202
 
203
   assign po_ck_addr_cmd_delay_done = (TDQSS_DLY == 0) ? pi_fine_dly_dec_done_r
204
                                     : delay_done_r4;
205
 
206
  always @(posedge clk)
207
    if (rst || ~pi_fine_dly_dec_done_r || delay_done) begin
208
      po_stg2_incdec_c   <= #TCQ 1'b1;
209
      po_en_stg2_c    <= #TCQ 1'b0;
210
    end else if (delay_cnt_r > 6'd0) begin
211
      po_en_stg2_c    <= #TCQ ~po_en_stg2_c;
212
    end
213
 
214
  always @(posedge clk)
215
    if (rst || ~pi_fine_dly_dec_done_r || (delay_cnt_r == 6'd0))
216
     delay_cnt_r  <= #TCQ TDQSS_DLY;
217
    else if ( po_en_stg2_c && (delay_cnt_r > 6'd0))
218
      delay_cnt_r  <= #TCQ delay_cnt_r - 1;
219
 
220
  always @(posedge clk)
221
    if (rst)
222
      lane_cnt_dqs_c_r  <= #TCQ 'd0;
223
    else if ( po_en_stg2_c && (delay_cnt_r == 6'd1))
224
      lane_cnt_dqs_c_r  <= #TCQ lane_cnt_dqs_c_r + 1;
225
 
226
  always @(posedge clk)
227
    if (rst || ~pi_fine_dly_dec_done_r)
228
      delay_done    <= #TCQ 1'b0;
229
    else if ((delay_cnt_r == 6'd1) && (lane_cnt_dqs_c_r == 1'b0))
230
      delay_done    <= #TCQ 1'b1;
231
 
232
 
233
   always @(posedge clk) begin
234
     delay_done_r1 <= #TCQ delay_done;
235
     delay_done_r2 <= #TCQ delay_done_r1;
236
     delay_done_r3 <= #TCQ delay_done_r2;
237
     delay_done_r4 <= #TCQ delay_done_r3;
238
   end
239
 
240
  always @(posedge clk) begin
241
    po_s2_incdec_c <= #TCQ po_stg2_incdec_c;
242
    po_en_s2_c <= #TCQ po_en_stg2_c;
243
    ctl_lane_cnt <= #TCQ lane_cnt_dqs_c_r;
244
  end
245
 
246
endmodule

powered by: WebSVN 2.1.0

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