csr_map.update(SoCSDRAM.csr_map)
def __init__(self, **kwargs):
platform = arty.Platform()
- SoCSDRAM.__init__(self, platform, clk_freq=100*1000000,
+ sys_clk_freq = int(100e6)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
self.submodules.crg = _CRG(platform)
# sdram
- self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"))
- sdram_module = MT41K128M16(self.clk_freq, "1:4")
+ self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
+ sdram_module = MT41K128M16(sys_clk_freq, "1:4")
self.register_sdram(self.ddrphy,
sdram_module.geom_settings,
sdram_module.timing_settings)
from litedram.phy import GENSDRPHY
-class _PLL(Module):
+class _ALTPLL(Module):
def __init__(self, period_in, name, phase_shift, operation_mode):
self.clk_in = Signal()
self.clk_out = Signal()
- self.specials += Instance("ALTPLL",
- p_bandwidth_type = "AUTO",
- p_clk0_divide_by = 1,
- p_clk0_duty_cycle = 50,
- p_clk0_multiply_by = 2,
- p_clk0_phase_shift = "{}".format(str(phase_shift)),
- p_compensate_clock = "CLK0",
- p_inclk0_input_frequency = int(period_in*1000),
- p_intended_device_family = "Cyclone IV E",
- p_lpm_hint = "CBX_MODULE_PREFIX={}_pll".format(name),
- p_lpm_type = "altpll",
- p_operation_mode = operation_mode,
- i_inclk=self.clk_in,
- o_clk=self.clk_out,
- i_areset=0,
- i_clkena=0x3f,
- i_clkswitch=0,
- i_configupdate=0,
- i_extclkena=0xf,
- i_fbin=1,
- i_pfdena=1,
- i_phasecounterselect=0xf,
- i_phasestep=1,
- i_phaseupdown=1,
- i_pllena=1,
- i_scanaclr=0,
- i_scanclk=0,
- i_scanclkena=1,
- i_scandata=0,
- i_scanread=0,
- i_scanwrite=0
- )
+ self.specials += \
+ Instance("ALTPLL",
+ p_bandwidth_type = "AUTO",
+ p_clk0_divide_by = 1,
+ p_clk0_duty_cycle = 50,
+ p_clk0_multiply_by = 2,
+ p_clk0_phase_shift = "{}".format(str(phase_shift)),
+ p_compensate_clock = "CLK0",
+ p_inclk0_input_frequency = int(period_in*1000),
+ p_intended_device_family = "Cyclone IV E",
+ p_lpm_hint = "CBX_MODULE_PREFIX={}_pll".format(name),
+ p_lpm_type = "altpll",
+ p_operation_mode = operation_mode,
+ i_inclk=self.clk_in,
+ o_clk=self.clk_out,
+ i_areset=0,
+ i_clkena=0x3f,
+ i_clkswitch=0,
+ i_configupdate=0,
+ i_extclkena=0xf,
+ i_fbin=1,
+ i_pfdena=1,
+ i_phasecounterselect=0xf,
+ i_phasestep=1,
+ i_phaseupdown=1,
+ i_pllena=1,
+ i_scanaclr=0,
+ i_scanclk=0,
+ i_scanclkena=1,
+ i_scandata=0,
+ i_scanread=0,
+ i_scanwrite=0
+ )
class _CRG(Module):
clk50 = platform.request("clk50")
- sys_pll = _PLL(20, "sys", 0, "NORMAL")
+ sys_pll = _ALTPLL(20, "sys", 0, "NORMAL")
self.submodules += sys_pll
self.comb += [
sys_pll.clk_in.eq(clk50),
self.cd_sys.clk.eq(sys_pll.clk_out)
]
- sdram_pll = _PLL(20, "sdram", -3000, "ZERO_DELAY_BUFFER")
+ sdram_pll = _ALTPLL(20, "sdram", -3000, "ZERO_DELAY_BUFFER")
self.submodules += sdram_pll
self.comb += [
sdram_pll.clk_in.eq(clk50),
class BaseSoC(SoCSDRAM):
def __init__(self, **kwargs):
platform = de0nano.Platform()
- SoCSDRAM.__init__(self, platform,
- clk_freq=100*1000000,
+ sys_clk_freq = int(100e6)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
**kwargs)
self.submodules.crg = _CRG(platform)
if not self.integrated_main_ram_size:
- self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"),)
+ self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = IS42S16160(self.clk_freq, "1:1")
self.register_sdram(self.sdrphy,
sdram_module.geom_settings,
csr_map.update(SoCSDRAM.csr_map)
def __init__(self, **kwargs):
platform = genesys2.Platform()
- SoCSDRAM.__init__(self, platform, clk_freq=125*1000000,
+ sys_clk_freq = int(125e6)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
self.submodules.crg = _CRG(platform)
# sdram
- self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"))
+ self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
sdram_module = MT41J256M16(self.clk_freq, "1:4")
self.register_sdram(self.ddrphy,
sdram_module.geom_settings,
csr_map.update(SoCSDRAM.csr_map)
def __init__(self, **kwargs):
platform = kc705.Platform()
- SoCSDRAM.__init__(self, platform, clk_freq=125*1000000,
+ sys_clk_freq = int(125e6)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
self.submodules.crg = _CRG(platform)
# sdram
- self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"))
- sdram_module = MT8JTF12864(self.clk_freq, "1:4")
+ self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
+ sdram_module = MT8JTF12864(sys_clk_freq, "1:4")
self.register_sdram(self.ddrphy,
sdram_module.geom_settings,
sdram_module.timing_settings)
class BaseSoC(SoCSDRAM):
def __init__(self, **kwargs):
- clk_freq = 80*1000000
platform = minispartan6.Platform()
- SoCSDRAM.__init__(self, platform, clk_freq,
+ sys_clk_freq = int(80e6)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
**kwargs)
- self.submodules.crg = _CRG(platform, clk_freq)
+ self.submodules.crg = _CRG(platform, sys_clk_freq)
if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
- sdram_module = AS4C16M16(clk_freq, "1:1")
+ sdram_module = AS4C16M16(sys_clk_freq, "1:1")
self.register_sdram(self.sdrphy,
sdram_module.geom_settings,
sdram_module.timing_settings)
# sdram
self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), memtype="DDR2", nphases=2, sys_clk_freq=sys_clk_freq)
- sdram_module = MT47H64M16(self.clk_freq, "1:2")
+ sdram_module = MT47H64M16(sys_clk_freq, "1:2")
self.register_sdram(self.ddrphy,
sdram_module.geom_settings,
sdram_module.timing_settings)
csr_map.update(SoCSDRAM.csr_map)
def __init__(self, **kwargs):
platform = nexys_video.Platform()
- SoCSDRAM.__init__(self, platform, clk_freq=100*1000000,
+ sys_clk_freq = int(100e6)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
self.submodules.crg = _CRG(platform)
# sdram
- self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"))
- sdram_module = MT41K256M16(self.clk_freq, "1:4")
+ self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
+ sdram_module = MT41K256M16(sys_clk_freq, "1:4")
self.register_sdram(self.ddrphy,
sdram_module.geom_settings,
sdram_module.timing_settings)
with_analyzer=False,
**kwargs):
platform = sim.Platform()
- SoCSDRAM.__init__(self, platform,
- clk_freq=int(1e9/platform.default_clk_period),
+ sys_clk_freq = int(1e9/platform.default_clk_period)
+ SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
ident="LiteX Simulation", ident_version=True,
with_uart=False,
# sdram
if with_sdram:
- sdram_module = IS42S16160(self.clk_freq, "1:1")
+ sdram_module = IS42S16160(sys_clk_freq, "1:1")
phy_settings = PhySettings(
memtype="SDR",
dfi_databits=1*16,
self.submodules.etherbonephy = LiteEthPHYModel(self.platform.request("eth", 0)) # FIXME
# eth core
etherbonecore = LiteEthUDPIPCore(self.etherbonephy,
- etherbone_mac_address, convert_ip(etherbone_ip_address), self.clk_freq)
+ etherbone_mac_address, convert_ip(etherbone_ip_address), sys_clk_freq)
if with_ethernet:
etherbonecore = ClockDomainsRenamer({"eth_tx": "etherbonephy_eth_tx", "eth_rx": "etherbonephy_eth_rx"})(etherbonecore)
self.submodules.etherbonecore = etherbonecore
if with_analyzer:
analyzer_signals = [
# FIXME: find interesting signals to probe
- self.cpu_or_bridge.ibus,
- self.cpu_or_bridge.dbus
+ self.cpu.ibus,
+ self.cpu.dbus
]
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 512)
class BaseSoC(SoCCore):
def __init__(self, platform, **kwargs):
- SoCCore.__init__(self, platform,
- clk_freq=int((1/(platform.default_clk_period))*1000000000),
+ sys_clk_freq = int(1e9/platform.default_clk_period)
+ SoCCore.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=0x8000,
integrated_main_ram_size=16*1024,
**kwargs)