1 |
3 |
oana.bonca |
//*****************************************************************************
|
2 |
|
|
// DISCLAIMER OF LIABILITY
|
3 |
|
|
//
|
4 |
|
|
// This file contains proprietary and confidential information of
|
5 |
|
|
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
|
6 |
|
|
// from Xilinx, and may be used, copied and/or disclosed only
|
7 |
|
|
// pursuant to the terms of a valid license agreement with Xilinx.
|
8 |
|
|
//
|
9 |
|
|
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION
|
10 |
|
|
// ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
11 |
|
|
// EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT
|
12 |
|
|
// LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT,
|
13 |
|
|
// MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx
|
14 |
|
|
// does not warrant that functions included in the Materials will
|
15 |
|
|
// meet the requirements of Licensee, or that the operation of the
|
16 |
|
|
// Materials will be uninterrupted or error-free, or that defects
|
17 |
|
|
// in the Materials will be corrected. Furthermore, Xilinx does
|
18 |
|
|
// not warrant or make any representations regarding use, or the
|
19 |
|
|
// results of the use, of the Materials in terms of correctness,
|
20 |
|
|
// accuracy, reliability or otherwise.
|
21 |
|
|
//
|
22 |
|
|
// Xilinx products are not designed or intended to be fail-safe,
|
23 |
|
|
// or for use in any application requiring fail-safe performance,
|
24 |
|
|
// such as life-support or safety devices or systems, Class III
|
25 |
|
|
// medical devices, nuclear facilities, applications related to
|
26 |
|
|
// the deployment of airbags, or any other applications that could
|
27 |
|
|
// lead to death, personal injury or severe property or
|
28 |
|
|
// environmental damage (individually and collectively, "critical
|
29 |
|
|
// applications"). Customer assumes the sole risk and liability
|
30 |
|
|
// of any use of Xilinx products in critical applications,
|
31 |
|
|
// subject only to applicable laws and regulations governing
|
32 |
|
|
// limitations on product liability.
|
33 |
|
|
//
|
34 |
|
|
// Copyright 2006, 2007, 2008 Xilinx, Inc.
|
35 |
|
|
// All rights reserved.
|
36 |
|
|
//
|
37 |
|
|
// This disclaimer and copyright notice must be retained as part
|
38 |
|
|
// of this file at all times.
|
39 |
|
|
//*****************************************************************************
|
40 |
|
|
// ____ ____
|
41 |
|
|
// / /\/ /
|
42 |
|
|
// /___/ \ / Vendor: Xilinx
|
43 |
|
|
// \ \ \/ Version: 3.6.1
|
44 |
|
|
// \ \ Application: MIG
|
45 |
|
|
// / / Filename: ddr2_infrastructure.v
|
46 |
|
|
// /___/ /\ Date Last Modified: $Date: 2010/11/26 18:26:02 $
|
47 |
|
|
// \ \ / \ Date Created: Wed Aug 16 2006
|
48 |
|
|
// \___\/\___\
|
49 |
|
|
//
|
50 |
|
|
//Device: Virtex-5
|
51 |
|
|
//Design Name: DDR2
|
52 |
|
|
//Purpose:
|
53 |
|
|
// Clock distribution and reset synchronization
|
54 |
|
|
//Reference:
|
55 |
|
|
//Revision History:
|
56 |
|
|
// Rev 1.1 - Port name changed from dcm_lock to locked. PK. 10/14/08
|
57 |
|
|
//*****************************************************************************
|
58 |
|
|
|
59 |
|
|
`timescale 1ns/1ps
|
60 |
|
|
|
61 |
|
|
module ddr2_infrastructure #
|
62 |
|
|
(
|
63 |
|
|
parameter RST_ACT_LOW = 1
|
64 |
|
|
)
|
65 |
|
|
(
|
66 |
|
|
input clk0,
|
67 |
|
|
input clk90,
|
68 |
|
|
input clk200,
|
69 |
|
|
input clkdiv0,
|
70 |
|
|
input locked,
|
71 |
|
|
input sys_rst_n,
|
72 |
|
|
input idelay_ctrl_rdy,
|
73 |
|
|
output rst0,
|
74 |
|
|
output rst90,
|
75 |
|
|
output rst200,
|
76 |
|
|
output rstdiv0
|
77 |
|
|
);
|
78 |
|
|
|
79 |
|
|
// # of clock cycles to delay deassertion of reset. Needs to be a fairly
|
80 |
|
|
// high number not so much for metastability protection, but to give time
|
81 |
|
|
// for reset (i.e. stable clock cycles) to propagate through all state
|
82 |
|
|
// machines and to all control signals (i.e. not all control signals have
|
83 |
|
|
// resets, instead they rely on base state logic being reset, and the effect
|
84 |
|
|
// of that reset propagating through the logic). Need this because we may not
|
85 |
|
|
// be getting stable clock cycles while reset asserted (i.e. since reset
|
86 |
|
|
// depends on DCM lock status)
|
87 |
|
|
localparam RST_SYNC_NUM = 25;
|
88 |
|
|
|
89 |
|
|
reg [RST_SYNC_NUM-1:0] rst0_sync_r /* synthesis syn_maxfan = 10 */;
|
90 |
|
|
reg [RST_SYNC_NUM-1:0] rst200_sync_r /* synthesis syn_maxfan = 10 */;
|
91 |
|
|
reg [RST_SYNC_NUM-1:0] rst90_sync_r /* synthesis syn_maxfan = 10 */;
|
92 |
|
|
reg [(RST_SYNC_NUM/2)-1:0] rstdiv0_sync_r /* synthesis syn_maxfan = 10 */;
|
93 |
|
|
wire rst_tmp;
|
94 |
|
|
wire sys_clk_ibufg;
|
95 |
|
|
wire sys_rst;
|
96 |
|
|
|
97 |
|
|
assign sys_rst = RST_ACT_LOW ? ~sys_rst_n: sys_rst_n;
|
98 |
|
|
|
99 |
|
|
//***************************************************************************
|
100 |
|
|
// Reset synchronization
|
101 |
|
|
// NOTES:
|
102 |
|
|
// 1. shut down the whole operation if the DCM hasn't yet locked (and by
|
103 |
|
|
// inference, this means that external SYS_RST_IN has been asserted -
|
104 |
|
|
// DCM deasserts LOCKED as soon as SYS_RST_IN asserted)
|
105 |
|
|
// 2. In the case of all resets except rst200, also assert reset if the
|
106 |
|
|
// IDELAY master controller is not yet ready
|
107 |
|
|
// 3. asynchronously assert reset. This was we can assert reset even if
|
108 |
|
|
// there is no clock (needed for things like 3-stating output buffers).
|
109 |
|
|
// reset deassertion is synchronous.
|
110 |
|
|
//***************************************************************************
|
111 |
|
|
|
112 |
|
|
assign rst_tmp = sys_rst | ~locked | ~idelay_ctrl_rdy;
|
113 |
|
|
|
114 |
|
|
// synthesis attribute max_fanout of rst0_sync_r is 10
|
115 |
|
|
always @(posedge clk0 or posedge rst_tmp)
|
116 |
|
|
if (rst_tmp)
|
117 |
|
|
rst0_sync_r <= {RST_SYNC_NUM{1'b1}};
|
118 |
|
|
else
|
119 |
|
|
// logical left shift by one (pads with 0)
|
120 |
|
|
rst0_sync_r <= rst0_sync_r << 1;
|
121 |
|
|
|
122 |
|
|
// synthesis attribute max_fanout of rstdiv0_sync_r is 10
|
123 |
|
|
always @(posedge clkdiv0 or posedge rst_tmp)
|
124 |
|
|
if (rst_tmp)
|
125 |
|
|
rstdiv0_sync_r <= {(RST_SYNC_NUM/2){1'b1}};
|
126 |
|
|
else
|
127 |
|
|
// logical left shift by one (pads with 0)
|
128 |
|
|
rstdiv0_sync_r <= rstdiv0_sync_r << 1;
|
129 |
|
|
|
130 |
|
|
// synthesis attribute max_fanout of rst90_sync_r is 10
|
131 |
|
|
always @(posedge clk90 or posedge rst_tmp)
|
132 |
|
|
if (rst_tmp)
|
133 |
|
|
rst90_sync_r <= {RST_SYNC_NUM{1'b1}};
|
134 |
|
|
else
|
135 |
|
|
rst90_sync_r <= rst90_sync_r << 1;
|
136 |
|
|
|
137 |
|
|
// make sure CLK200 doesn't depend on IDELAY_CTRL_RDY, else chicken n' egg
|
138 |
|
|
// synthesis attribute max_fanout of rst200_sync_r is 10
|
139 |
|
|
always @(posedge clk200 or negedge locked)
|
140 |
|
|
if (!locked)
|
141 |
|
|
rst200_sync_r <= {RST_SYNC_NUM{1'b1}};
|
142 |
|
|
else
|
143 |
|
|
rst200_sync_r <= rst200_sync_r << 1;
|
144 |
|
|
|
145 |
|
|
assign rst0 = rst0_sync_r[RST_SYNC_NUM-1];
|
146 |
|
|
assign rst90 = rst90_sync_r[RST_SYNC_NUM-1];
|
147 |
|
|
assign rst200 = rst200_sync_r[RST_SYNC_NUM-1];
|
148 |
|
|
assign rstdiv0 = rstdiv0_sync_r[(RST_SYNC_NUM/2)-1];
|
149 |
|
|
|
150 |
|
|
endmodule
|