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.04b/] [ipcore_dir/] [mem0/] [user_design/] [rtl/] [infrastructure.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
//*****************************************************************************
2
// (c) Copyright 2010 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           : infrastructure.v
55
// /___/   /\     Date Last Modified : $Date: 2011/06/02 07:17:09 $
56
// \   \  /  \    Date Created       : Mon Mar 2 2009
57
//  \___\/\___\
58
//
59
//Device           : Spartan-6
60
//Design Name      : DDR/DDR2/DDR3/LPDDR
61
//Purpose          : Clock generation/distribution and reset synchronization
62
//Reference        :
63
//Revision History :
64
//*****************************************************************************
65
 
66
 
67
`timescale 1ns/1ps
68
 
69
module infrastructure #
70
  (
71
   parameter C_INCLK_PERIOD    = 2500,
72
   parameter C_RST_ACT_LOW      = 1,
73
   parameter C_INPUT_CLK_TYPE   = "DIFFERENTIAL",
74
   parameter C_CLKOUT0_DIVIDE   = 1,
75
   parameter C_CLKOUT1_DIVIDE   = 1,
76
   parameter C_CLKOUT2_DIVIDE   = 16,
77
   parameter C_CLKOUT3_DIVIDE   = 8,
78
   parameter C_CLKFBOUT_MULT    = 2,
79
   parameter C_DIVCLK_DIVIDE    = 1
80
 
81
   )
82
  (
83
   input  sys_clk_p,
84
   input  sys_clk_n,
85
   input  sys_clk,
86
   input  sys_rst_i,
87
   output clk0,
88
   output rst0,
89
   output async_rst,
90
   output sysclk_2x,
91
   output sysclk_2x_180,
92
   output mcb_drp_clk,
93
   output pll_ce_0,
94
   output pll_ce_90,
95
   output pll_lock
96
 
97
   );
98
 
99
  // # of clock cycles to delay deassertion of reset. Needs to be a fairly
100
  // high number not so much for metastability protection, but to give time
101
  // for reset (i.e. stable clock cycles) to propagate through all state
102
  // machines and to all control signals (i.e. not all control signals have
103
  // resets, instead they rely on base state logic being reset, and the effect
104
  // of that reset propagating through the logic). Need this because we may not
105
  // be getting stable clock cycles while reset asserted (i.e. since reset
106
  // depends on PLL/DCM lock status)
107
 
108
  localparam RST_SYNC_NUM = 25;
109
  localparam CLK_PERIOD_NS = C_INCLK_PERIOD / 1000.0;
110
  localparam CLK_PERIOD_INT = C_INCLK_PERIOD/1000;
111
 
112
  wire                       clk_2x_0;
113
  wire                       clk_2x_180;
114
  wire                       clk0_bufg;
115
  wire                       clk0_bufg_in;
116
  wire                       mcb_drp_clk_bufg_in;
117
  wire                       clkfbout_clkfbin;
118
  wire                       locked;
119
  reg [RST_SYNC_NUM-1:0]     rst0_sync_r    /* synthesis syn_maxfan = 10 */;
120
  wire                       rst_tmp;
121
  reg                        powerup_pll_locked;
122
  reg                        syn_clk0_powerup_pll_locked;
123
 
124
  wire                       sys_rst;
125
  wire                       bufpll_mcb_locked;
126
 
127
  assign sys_rst = C_RST_ACT_LOW ? ~sys_rst_i: sys_rst_i;
128
  assign clk0        = clk0_bufg;
129
  assign pll_lock    = bufpll_mcb_locked;
130
 
131
  //***************************************************************************
132
  // Global clock generation and distribution
133
  //***************************************************************************
134
 
135
    PLL_ADV #
136
        (
137
         .BANDWIDTH          ("OPTIMIZED"),
138
         .CLKIN1_PERIOD      (CLK_PERIOD_NS),
139
         .CLKIN2_PERIOD      (CLK_PERIOD_NS),
140
         .CLKOUT0_DIVIDE     (C_CLKOUT0_DIVIDE),
141
         .CLKOUT1_DIVIDE     (C_CLKOUT1_DIVIDE),
142
         .CLKOUT2_DIVIDE     (C_CLKOUT2_DIVIDE),
143
         .CLKOUT3_DIVIDE     (C_CLKOUT3_DIVIDE),
144
         .CLKOUT4_DIVIDE     (1),
145
         .CLKOUT5_DIVIDE     (1),
146
         .CLKOUT0_PHASE      (0.000),
147
         .CLKOUT1_PHASE      (180.000),
148
         .CLKOUT2_PHASE      (0.000),
149
         .CLKOUT3_PHASE      (0.000),
150
         .CLKOUT4_PHASE      (0.000),
151
         .CLKOUT5_PHASE      (0.000),
152
         .CLKOUT0_DUTY_CYCLE (0.500),
153
         .CLKOUT1_DUTY_CYCLE (0.500),
154
         .CLKOUT2_DUTY_CYCLE (0.500),
155
         .CLKOUT3_DUTY_CYCLE (0.500),
156
         .CLKOUT4_DUTY_CYCLE (0.500),
157
         .CLKOUT5_DUTY_CYCLE (0.500),
158
         .SIM_DEVICE         ("SPARTAN6"),
159
         .COMPENSATION       ("INTERNAL"),
160
         .DIVCLK_DIVIDE      (C_DIVCLK_DIVIDE),
161
         .CLKFBOUT_MULT      (C_CLKFBOUT_MULT),
162
         .CLKFBOUT_PHASE     (0.0),
163
         .REF_JITTER         (0.005000)
164
         )
165
        u_pll_adv
166
          (
167
           .CLKFBIN     (clkfbout_clkfbin),
168
           .CLKINSEL    (1'b1),
169
           .CLKIN1      (sys_clk),
170
           .CLKIN2      (1'b0),
171
           .DADDR       (5'b0),
172
           .DCLK        (1'b0),
173
           .DEN         (1'b0),
174
           .DI          (16'b0),
175
           .DWE         (1'b0),
176
           .REL         (1'b0),
177
           .RST         (sys_rst),
178
           .CLKFBDCM    (),
179
           .CLKFBOUT    (clkfbout_clkfbin),
180
           .CLKOUTDCM0  (),
181
           .CLKOUTDCM1  (),
182
           .CLKOUTDCM2  (),
183
           .CLKOUTDCM3  (),
184
           .CLKOUTDCM4  (),
185
           .CLKOUTDCM5  (),
186
           .CLKOUT0     (clk_2x_0),
187
           .CLKOUT1     (clk_2x_180),
188
           .CLKOUT2     (clk0_bufg_in),
189
           .CLKOUT3     (mcb_drp_clk_bufg_in),
190
           .CLKOUT4     (),
191
           .CLKOUT5     (),
192
           .DO          (),
193
           .DRDY        (),
194
           .LOCKED      (locked)
195
           );
196
 
197
 
198
 
199
   BUFG U_BUFG_CLK0
200
    (
201
     .O (clk0_bufg),
202
     .I (clk0_bufg_in)
203
     );
204
 
205
   BUFGCE U_BUFG_CLK1
206
    (
207
     .O (mcb_drp_clk),
208
     .I (mcb_drp_clk_bufg_in),
209
     .CE (locked)
210
     );
211
 
212
  always @(posedge mcb_drp_clk , posedge sys_rst)
213
      if(sys_rst)
214
         powerup_pll_locked <= 1'b0;
215
 
216
      else if (bufpll_mcb_locked)
217
         powerup_pll_locked <= 1'b1;
218
 
219
 
220
  always @(posedge clk0_bufg , posedge sys_rst)
221
      if(sys_rst)
222
         syn_clk0_powerup_pll_locked <= 1'b0;
223
 
224
      else if (bufpll_mcb_locked)
225
         syn_clk0_powerup_pll_locked <= 1'b1;
226
 
227
 
228
  //***************************************************************************
229
  // Reset synchronization
230
  // NOTES:
231
  //   1. shut down the whole operation if the PLL hasn't yet locked (and
232
  //      by inference, this means that external SYS_RST_IN has been asserted -
233
  //      PLL deasserts LOCKED as soon as SYS_RST_IN asserted)
234
  //   2. asynchronously assert reset. This was we can assert reset even if
235
  //      there is no clock (needed for things like 3-stating output buffers).
236
  //      reset deassertion is synchronous.
237
  //   3. asynchronous reset only look at pll_lock from PLL during power up. After
238
  //      power up and pll_lock is asserted, the powerup_pll_locked will be asserted
239
  //      forever until sys_rst is asserted again. PLL will lose lock when FPGA 
240
  //      enters suspend mode. We don't want reset to MCB get
241
  //      asserted in the application that needs suspend feature.
242
  //***************************************************************************
243
 
244
 
245
  assign async_rst = sys_rst | ~powerup_pll_locked;
246
  // synthesis attribute max_fanout of rst0_sync_r is 10
247
  assign rst_tmp = sys_rst | ~syn_clk0_powerup_pll_locked;
248
 
249
  always @(posedge clk0_bufg or posedge rst_tmp)
250
    if (rst_tmp)
251
      rst0_sync_r <= {RST_SYNC_NUM{1'b1}};
252
    else
253
      // logical left shift by one (pads with 0)
254
      rst0_sync_r <= rst0_sync_r << 1;
255
 
256
 
257
  assign rst0    = rst0_sync_r[RST_SYNC_NUM-1];
258
 
259
 
260
BUFPLL_MCB BUFPLL_MCB1
261
( .IOCLK0         (sysclk_2x),
262
  .IOCLK1         (sysclk_2x_180),
263
  .LOCKED         (locked),
264
  .GCLK           (mcb_drp_clk),
265
  .SERDESSTROBE0  (pll_ce_0),
266
  .SERDESSTROBE1  (pll_ce_90),
267
  .PLLIN0         (clk_2x_0),
268
  .PLLIN1         (clk_2x_180),
269
  .LOCK           (bufpll_mcb_locked)
270
  );
271
 
272
 
273
endmodule

powered by: WebSVN 2.1.0

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