3 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Sebastien Bourdeauducq
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 parameter in_period = 0.0,
22 parameter clk2x_period = (in_period*f_div)/(2.0*f_mult)
30 /* Reset off-chip devices */
47 reg [19:0] rst_debounce;
48 always @(posedge sys_clk) begin
50 rst_debounce <= 20'hFFFFF;
51 else if(rst_debounce != 20'd0)
52 rst_debounce <= rst_debounce - 20'd1;
53 sys_rst <= rst_debounce != 20'd0;
56 assign ac97_rst_n = ~sys_rst;
57 assign videoin_rst_n = ~sys_rst;
60 * We must release the Flash reset before the system reset
61 * because the Flash needs some time to come out of reset
62 * and the CPU begins fetching instructions from it
63 * as soon as the system reset is released.
64 * From datasheet, minimum reset pulse width is 100ns
65 * and reset-to-read time is 150ns.
68 reg [7:0] flash_rstcounter;
70 always @(posedge sys_clk) begin
72 flash_rstcounter <= 8'd0;
73 else if(~flash_rstcounter[7])
74 flash_rstcounter <= flash_rstcounter + 8'd1;
77 assign flash_rst_n = flash_rstcounter[7];
80 * Clock management. Inspired by the NWL reference design.
87 .IOSTANDARD("DEFAULT")
95 .DIVIDE_BYPASS("FALSE"),
112 .BANDWIDTH("OPTIMIZED"),
113 .CLKFBOUT_MULT(4*f_mult),
114 .CLKFBOUT_PHASE(0.0),
115 .CLKIN1_PERIOD(in_period),
116 .CLKIN2_PERIOD(in_period),
117 .CLKOUT0_DIVIDE(f_div),
118 .CLKOUT0_DUTY_CYCLE(0.5),
120 .CLKOUT1_DIVIDE(f_div),
121 .CLKOUT1_DUTY_CYCLE(0.5),
123 .CLKOUT2_DIVIDE(2*f_div),
124 .CLKOUT2_DUTY_CYCLE(0.5),
125 .CLKOUT2_PHASE(90.0),
126 .CLKOUT3_DIVIDE(4*f_div),
127 .CLKOUT3_DUTY_CYCLE(0.5),
130 .CLKOUT4_DUTY_CYCLE(0.5),
133 .CLKOUT5_DUTY_CYCLE(0.5),
135 .COMPENSATION("INTERNAL"),
138 .CLK_FEEDBACK("CLKFBOUT"),
139 .SIM_DEVICE("SPARTAN6")
142 .CLKFBOUT(buf_pll_fb_out),
143 .CLKOUT0(pllout0), /* < x4 clock for writes */
144 .CLKOUT1(pllout1), /* < x4 clock for reads */
145 .CLKOUT2(pllout2), /* < x2 90 clock to generate memory clock, clock DQS and memory address and control signals. */
146 .CLKOUT3(pllout3), /* < x1 clock for system and memory controller */
158 .CLKFBIN(buf_pll_fb_out),
179 .SERDESSTROBE(clk4x_wr_strb)
190 .SERDESSTROBE(clk4x_rd_strb)