@@ -20,28 +20,30 @@ def __init__(self, platform, clk_freq):
20
20
self .clk4x_wr_strb = Signal ()
21
21
self .clk4x_rd_strb = Signal ()
22
22
23
- f0 = 50 * 1000000
23
+ f0 = Fraction (50 , 1 )* 1000000
24
+ p = 12
25
+ f = Fraction (clk_freq * p , f0 )
26
+ n , d = f .numerator , f .denominator
27
+ assert 19e6 <= f0 / d <= 500e6 # pfd
28
+ assert 400e6 <= f0 * n / d <= 1080e6 # vco
29
+
24
30
clk50 = platform .request ("clk50" )
25
31
clk50a = Signal ()
26
32
self .specials += Instance ("IBUFG" , i_I = clk50 , o_O = clk50a )
27
33
clk50b = Signal ()
28
34
self .specials += Instance ("BUFIO2" , p_DIVIDE = 1 ,
29
35
p_DIVIDE_BYPASS = "TRUE" , p_I_INVERT = "FALSE" ,
30
36
i_I = clk50a , o_DIVCLK = clk50b )
31
- f = Fraction (int (clk_freq ), int (f0 ))
32
- n , m = f .denominator , f .numerator
33
- assert f0 / n * m == clk_freq
34
- p = 8
35
37
pll_lckd = Signal ()
36
38
pll_fb = Signal ()
37
39
pll = Signal (6 )
38
40
self .specials .pll = Instance ("PLL_ADV" , p_SIM_DEVICE = "SPARTAN6" ,
39
41
p_BANDWIDTH = "OPTIMIZED" , p_COMPENSATION = "INTERNAL" ,
40
42
p_REF_JITTER = .01 , p_CLK_FEEDBACK = "CLKFBOUT" ,
41
43
i_DADDR = 0 , i_DCLK = 0 , i_DEN = 0 , i_DI = 0 , i_DWE = 0 , i_RST = 0 , i_REL = 0 ,
42
- p_DIVCLK_DIVIDE = 1 , p_CLKFBOUT_MULT = m * p // n , p_CLKFBOUT_PHASE = 0. ,
44
+ p_DIVCLK_DIVIDE = d , p_CLKFBOUT_MULT = n , p_CLKFBOUT_PHASE = 0. ,
43
45
i_CLKIN1 = clk50b , i_CLKIN2 = 0 , i_CLKINSEL = 1 ,
44
- p_CLKIN1_PERIOD = 1000000000 / f0 , p_CLKIN2_PERIOD = 0. ,
46
+ p_CLKIN1_PERIOD = 1e9 / f0 , p_CLKIN2_PERIOD = 0. ,
45
47
i_CLKFBIN = pll_fb , o_CLKFBOUT = pll_fb , o_LOCKED = pll_lckd ,
46
48
o_CLKOUT0 = pll [0 ], p_CLKOUT0_DUTY_CYCLE = .5 ,
47
49
o_CLKOUT1 = pll [1 ], p_CLKOUT1_DUTY_CYCLE = .5 ,
@@ -50,7 +52,7 @@ def __init__(self, platform, clk_freq):
50
52
o_CLKOUT4 = pll [4 ], p_CLKOUT4_DUTY_CYCLE = .5 ,
51
53
o_CLKOUT5 = pll [5 ], p_CLKOUT5_DUTY_CYCLE = .5 ,
52
54
p_CLKOUT0_PHASE = 0. , p_CLKOUT0_DIVIDE = p // 4 , # sdram wr rd
53
- p_CLKOUT1_PHASE = 0. , p_CLKOUT1_DIVIDE = p // 8 ,
55
+ p_CLKOUT1_PHASE = 0. , p_CLKOUT1_DIVIDE = p // 4 ,
54
56
p_CLKOUT2_PHASE = 270. , p_CLKOUT2_DIVIDE = p // 2 , # sdram dqs adr ctrl
55
57
p_CLKOUT3_PHASE = 250. , p_CLKOUT3_DIVIDE = p // 2 , # off-chip ddr
56
58
p_CLKOUT4_PHASE = 0. , p_CLKOUT4_DIVIDE = p // 1 ,
@@ -96,8 +98,8 @@ class BaseSoC(SDRAMSoC):
96
98
}
97
99
csr_map .update (SDRAMSoC .csr_map )
98
100
99
- def __init__ (self , platform , sdram_controller_settings = LASMIconSettings (), ** kwargs ):
100
- clk_freq = 75 * 1000000
101
+ def __init__ (self , platform , sdram_controller_settings = LASMIconSettings (),
102
+ clk_freq = ( 83 + Fraction ( 1 , 3 )) * 1000 * 1000 , ** kwargs ):
101
103
SDRAMSoC .__init__ (self , platform , clk_freq ,
102
104
cpu_reset_address = 0x170000 , # 1.5 MB
103
105
sdram_controller_settings = sdram_controller_settings ,
0 commit comments