Skip to content

Commit

Permalink
targets: fix CLKIN1_PERIOD on ppro and pipistrello
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Mar 21, 2015
1 parent 30c2521 commit cf17f06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions targets/pipistrello.py
Expand Up @@ -20,7 +20,7 @@ def __init__(self, platform, clk_freq):
self.clk4x_wr_strb = Signal()
self.clk4x_rd_strb = Signal()

f0 = 50*1000*1000
f0 = 50*10e6

This comment has been minimized.

Copy link
@sbourdeauducq

sbourdeauducq Mar 26, 2015

Member

Keep this integer, floating point is imprecise.

This comment has been minimized.

Copy link
@jordens

jordens Mar 26, 2015

Member

on my machines, i == int(float(i)) for all integers up to 1e9

This comment has been minimized.

Copy link
@sbourdeauducq

sbourdeauducq Mar 26, 2015

Member

Certainly so, but floating point is contagious in Python and submodules using clk_freq may introduce rounding errors elsewhere if they were expecting an integer.

I also like to be able to use fractional frequencies (e.g. 83 1/3MHz is pretty common). For this purpose it helps to assume that clk_freq is either integer or Fraction.

clk50 = platform.request("clk50")
clk50a = Signal()
self.specials += Instance("IBUFG", i_I=clk50, o_O=clk50a)
Expand All @@ -41,7 +41,7 @@ def __init__(self, platform, clk_freq):
i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
i_CLKIN1=clk50b, i_CLKIN2=0, i_CLKINSEL=1,
p_CLKIN1_PERIOD=1/f0, p_CLKIN2_PERIOD=0.,
p_CLKIN1_PERIOD=10e9/f0, p_CLKIN2_PERIOD=0.,
i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
Expand Down Expand Up @@ -91,7 +91,7 @@ class BaseSoC(SDRAMSoC):
csr_map.update(SDRAMSoC.csr_map)

def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
clk_freq = 75*1000*1000
clk_freq = 75*10e6

This comment has been minimized.

Copy link
@sbourdeauducq

sbourdeauducq Mar 26, 2015

Member

ditto

if not kwargs.get("with_integrated_rom"):
kwargs["rom_size"] = 0x1000000 # 128 Mb
SDRAMSoC.__init__(self, platform, clk_freq,
Expand Down
6 changes: 3 additions & 3 deletions targets/ppro.py
Expand Up @@ -15,7 +15,7 @@ def __init__(self, platform, clk_freq):
self.clock_domains.cd_sys = ClockDomain()
self.clock_domains.cd_sys_ps = ClockDomain()

f0 = 32*1000*1000
f0 = 32*10e6
clk32 = platform.request("clk32")
clk32a = Signal()
self.specials += Instance("IBUFG", i_I=clk32, o_O=clk32a)
Expand All @@ -35,7 +35,7 @@ def __init__(self, platform, clk_freq):
i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
i_CLKIN1=clk32b, i_CLKIN2=0, i_CLKINSEL=1,
p_CLKIN1_PERIOD=1/f0, p_CLKIN2_PERIOD=0.,
p_CLKIN1_PERIOD=10e9/f0, p_CLKIN2_PERIOD=0.,
i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
Expand Down Expand Up @@ -69,7 +69,7 @@ class BaseSoC(SDRAMSoC):
csr_map.update(SDRAMSoC.csr_map)

def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
clk_freq = 80*1000*1000
clk_freq = 80*10e6
SDRAMSoC.__init__(self, platform, clk_freq,
cpu_reset_address=0x60000,
sdram_controller_settings=sdram_controller_settings,
Expand Down

0 comments on commit cf17f06

Please sign in to comment.