1 |
32 |
redbear |
// (C) 2001-2017 Intel Corporation. All rights reserved.
|
2 |
|
|
// Your use of Intel Corporation's design tools, logic functions and other
|
3 |
|
|
// software and tools, and its AMPP partner logic functions, and any output
|
4 |
40 |
redbear |
// files from any of the foregoing (including device programming or simulation
|
5 |
32 |
redbear |
// files), and any associated documentation or information are expressly subject
|
6 |
|
|
// to the terms and conditions of the Intel Program License Subscription
|
7 |
40 |
redbear |
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
8 |
32 |
redbear |
// license agreement, including, without limitation, that your use is for the
|
9 |
|
|
// sole purpose of programming logic devices manufactured by Intel and sold by
|
10 |
|
|
// Intel or its authorized distributors. Please refer to the applicable
|
11 |
|
|
// agreement for further details.
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
// ********************************************************************************************************************************
|
15 |
|
|
// This file instantiates the PLL.
|
16 |
|
|
// ********************************************************************************************************************************
|
17 |
|
|
|
18 |
|
|
`timescale 1 ps / 1 ps
|
19 |
|
|
|
20 |
40 |
redbear |
(* altera_attribute = "-name IP_TOOL_NAME altera_mem_if_hps_pll; -name IP_TOOL_VERSION 17.1; -name FITTER_ADJUST_HC_SHORT_PATH_GUARDBAND 100; -name ALLOW_SYNCH_CTRL_USAGE OFF; -name AUTO_CLOCK_ENABLE_RECOGNITION OFF; -name AUTO_SHIFT_REGISTER_RECOGNITION OFF" *)
|
21 |
32 |
redbear |
|
22 |
|
|
// pll_mem_clk: full-rate clock, 0 degree phase shift, clock output to memory
|
23 |
|
|
// pll_write_clk: full-rate clock, -90 degree phase shift, clocks write data out to memory
|
24 |
|
|
|
25 |
|
|
module hps_sdram_pll (
|
26 |
|
|
global_reset_n,
|
27 |
|
|
pll_ref_clk,
|
28 |
|
|
pll_mem_clk,
|
29 |
|
|
pll_write_clk,
|
30 |
|
|
pll_write_clk_pre_phy_clk,
|
31 |
|
|
pll_addr_cmd_clk,
|
32 |
|
|
pll_avl_clk,
|
33 |
|
|
pll_config_clk,
|
34 |
|
|
pll_locked,
|
35 |
|
|
afi_clk,
|
36 |
|
|
pll_mem_phy_clk,
|
37 |
|
|
afi_phy_clk,
|
38 |
|
|
pll_avl_phy_clk,
|
39 |
|
|
afi_half_clk
|
40 |
|
|
);
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
// ********************************************************************************************************************************
|
44 |
|
|
// BEGIN PARAMETER SECTION
|
45 |
|
|
// All parameters default to "" will have their values passed in from higher level wrapper with the controller and driver.
|
46 |
|
|
parameter DEVICE_FAMILY = "Cyclone V";
|
47 |
|
|
|
48 |
|
|
parameter IS_HHP_HPS = "true";
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
// Clock settings
|
52 |
|
|
parameter GENERIC_PLL = "true";
|
53 |
|
|
parameter REF_CLK_FREQ = "125.0 MHz";
|
54 |
|
|
parameter REF_CLK_PERIOD_PS = 8000;
|
55 |
|
|
|
56 |
|
|
parameter PLL_MEM_CLK_FREQ_STR = "300.0 MHz";
|
57 |
|
|
parameter PLL_WRITE_CLK_FREQ_STR = "300.0 MHz";
|
58 |
|
|
parameter PLL_DR_CLK_FREQ_STR = "";
|
59 |
|
|
|
60 |
|
|
parameter PLL_MEM_CLK_FREQ_SIM_STR = "3334 ps";
|
61 |
|
|
parameter PLL_WRITE_CLK_FREQ_SIM_STR = "3334 ps";
|
62 |
|
|
parameter PLL_DR_CLK_FREQ_SIM_STR = "0 ps";
|
63 |
|
|
|
64 |
|
|
parameter MEM_CLK_PHASE = "0 ps";
|
65 |
|
|
parameter WRITE_CLK_PHASE = "2500 ps";
|
66 |
|
|
parameter DR_CLK_PHASE = "";
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
localparam SIM_FILESET = ("false" == "true");
|
70 |
|
|
|
71 |
|
|
localparam MEM_CLK_FREQ = SIM_FILESET ? PLL_MEM_CLK_FREQ_SIM_STR : PLL_MEM_CLK_FREQ_STR;
|
72 |
|
|
localparam WRITE_CLK_FREQ = SIM_FILESET ? PLL_WRITE_CLK_FREQ_SIM_STR : PLL_WRITE_CLK_FREQ_STR;
|
73 |
|
|
localparam DR_CLK_FREQ = SIM_FILESET ? PLL_DR_CLK_FREQ_SIM_STR : PLL_DR_CLK_FREQ_STR;
|
74 |
|
|
|
75 |
|
|
// END PARAMETER SECTION
|
76 |
|
|
// ********************************************************************************************************************************
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
// ********************************************************************************************************************************
|
80 |
|
|
// BEGIN PORT SECTION
|
81 |
|
|
|
82 |
|
|
input global_reset_n; // Resets (active-low) the whole system (all PHY logic + PLL)
|
83 |
|
|
input pll_ref_clk; // PLL reference clock
|
84 |
|
|
|
85 |
|
|
output pll_mem_clk;
|
86 |
|
|
output pll_write_clk;
|
87 |
|
|
output pll_write_clk_pre_phy_clk;
|
88 |
|
|
output pll_addr_cmd_clk;
|
89 |
|
|
output pll_avl_clk;
|
90 |
|
|
output pll_config_clk;
|
91 |
|
|
output pll_locked;
|
92 |
|
|
|
93 |
|
|
output afi_clk;
|
94 |
|
|
output pll_mem_phy_clk;
|
95 |
|
|
output afi_phy_clk;
|
96 |
|
|
output pll_avl_phy_clk;
|
97 |
|
|
output afi_half_clk;
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
// END PORT SECTION
|
101 |
|
|
// ********************************************************************************************************************************
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
generate
|
105 |
|
|
if (SIM_FILESET) begin
|
106 |
|
|
wire fbout;
|
107 |
|
|
|
108 |
|
|
generic_pll pll1 (
|
109 |
|
|
.refclk({pll_ref_clk}),
|
110 |
|
|
.rst(~global_reset_n),
|
111 |
|
|
.fbclk(fbout),
|
112 |
|
|
.outclk(pll_mem_clk),
|
113 |
|
|
.fboutclk(fbout),
|
114 |
|
|
.locked(pll_locked)
|
115 |
|
|
);
|
116 |
|
|
defparam pll1.reference_clock_frequency = REF_CLK_FREQ,
|
117 |
|
|
pll1.output_clock_frequency = MEM_CLK_FREQ,
|
118 |
|
|
pll1.phase_shift = MEM_CLK_PHASE,
|
119 |
|
|
pll1.duty_cycle = 50;
|
120 |
|
|
|
121 |
|
|
generic_pll pll2 (
|
122 |
|
|
.refclk({pll_ref_clk}),
|
123 |
|
|
.rst(~global_reset_n),
|
124 |
|
|
.fbclk(fbout),
|
125 |
|
|
.outclk(pll_write_clk),
|
126 |
|
|
.fboutclk(),
|
127 |
|
|
.locked()
|
128 |
|
|
);
|
129 |
|
|
defparam pll2.reference_clock_frequency = REF_CLK_FREQ,
|
130 |
|
|
pll2.output_clock_frequency = WRITE_CLK_FREQ,
|
131 |
|
|
pll2.phase_shift = WRITE_CLK_PHASE,
|
132 |
|
|
pll2.duty_cycle = 50;
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
end else begin
|
136 |
|
|
|
137 |
|
|
wire [4-1:0] clk_out;
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
if (DEVICE_FAMILY == "Arria V") begin
|
141 |
|
|
arriav_hps_sdram_pll pll (
|
142 |
|
|
.clk_out(clk_out)
|
143 |
|
|
);
|
144 |
|
|
defparam pll.reference_clock_frequency = REF_CLK_FREQ,
|
145 |
|
|
pll.clk0_frequency = MEM_CLK_FREQ,
|
146 |
|
|
pll.clk0_phase_shift = MEM_CLK_PHASE,
|
147 |
|
|
pll.clk1_frequency = WRITE_CLK_FREQ,
|
148 |
|
|
pll.clk1_phase_shift = WRITE_CLK_PHASE,
|
149 |
|
|
pll.clk2_frequency = DR_CLK_FREQ,
|
150 |
|
|
pll.clk2_phase_shift = DR_CLK_PHASE;
|
151 |
|
|
end else if (DEVICE_FAMILY == "Cyclone V") begin
|
152 |
|
|
cyclonev_hps_sdram_pll pll (
|
153 |
|
|
.clk_out(clk_out)
|
154 |
|
|
);
|
155 |
|
|
defparam pll.reference_clock_frequency = REF_CLK_FREQ,
|
156 |
|
|
pll.clk0_frequency = MEM_CLK_FREQ,
|
157 |
|
|
pll.clk0_phase_shift = MEM_CLK_PHASE,
|
158 |
|
|
pll.clk1_frequency = WRITE_CLK_FREQ,
|
159 |
|
|
pll.clk1_phase_shift = WRITE_CLK_PHASE,
|
160 |
|
|
pll.clk2_frequency = DR_CLK_FREQ,
|
161 |
|
|
pll.clk2_phase_shift = DR_CLK_PHASE;
|
162 |
|
|
end else begin
|
163 |
|
|
unknown_family_hps_sdram_pll pll();
|
164 |
|
|
end
|
165 |
|
|
|
166 |
|
|
assign pll_mem_clk = clk_out[0];
|
167 |
|
|
assign pll_write_clk = clk_out[1];
|
168 |
|
|
assign pll_dr_clk = clk_out[2];
|
169 |
|
|
end
|
170 |
|
|
endgenerate
|
171 |
|
|
|
172 |
|
|
assign pll_addr_cmd_clk = pll_mem_clk;
|
173 |
|
|
assign pll_avl_clk = pll_mem_clk;
|
174 |
|
|
assign pll_config_clk = pll_mem_clk;
|
175 |
|
|
assign afi_clk = pll_mem_clk;
|
176 |
|
|
assign pll_mem_phy_clk = pll_mem_clk;
|
177 |
|
|
assign afi_phy_clk = pll_mem_clk;
|
178 |
|
|
assign pll_avl_phy_clk = pll_mem_clk;
|
179 |
|
|
assign afi_half_clk = pll_mem_clk;
|
180 |
|
|
|
181 |
|
|
assign pll_write_clk_pre_phy_clk = pll_write_clk;
|
182 |
|
|
|
183 |
|
|
endmodule
|
184 |
|
|
|