class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
self.clock_domains.cd_sys4x_dqs = ClockDomain(reset_less=True)
- self.clock_domains.cd_clk200 = ClockDomain()
- self.clock_domains.cd_eth = ClockDomain()
+ self.clock_domains.cd_clk200 = ClockDomain()
+ self.clock_domains.cd_eth = ClockDomain()
# # #
self.submodules.pll = pll = S7PLL(speedgrade=-1)
self.comb += pll.reset.eq(~platform.request("cpu_reset"))
pll.register_clkin(platform.request("clk100"), 100e6)
- pll.create_clkout(self.cd_sys, sys_clk_freq)
- pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
+ pll.create_clkout(self.cd_sys, sys_clk_freq)
+ pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
pll.create_clkout(self.cd_sys4x_dqs, 4*sys_clk_freq, phase=90)
- pll.create_clkout(self.cd_clk200, 200e6)
- pll.create_clkout(self.cd_eth, 25e6)
+ pll.create_clkout(self.cd_clk200, 200e6)
+ pll.create_clkout(self.cd_eth, 25e6)
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_clk200)
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(100e6), integrated_rom_size=0x8000, **kwargs):
platform = arty.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=integrated_rom_size,
integrated_sram_size=0x8000,
**kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- sdram_module = MT41K128M16(sys_clk_freq, "1:4")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ # DDR3 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"),
+ memtype = "DDR3",
+ nphases = 4,
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ sdram_module = MT41K128M16(sys_clk_freq, "1:4")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# EthernetSoC --------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform):
- self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys = ClockDomain()
self.clock_domains.cd_sys_ps = ClockDomain()
- self.clock_domains.cd_por = ClockDomain(reset_less=True)
+ self.clock_domains.cd_por = ClockDomain(reset_less=True)
# # #
self.cd_sys_ps.clk.attr.add("keep")
self.cd_por.clk.attr.add("keep")
- # power on rst
+ # Power on reset
rst_n = Signal()
self.sync.por += rst_n.eq(1)
self.comb += [
self.cd_sys_ps.rst.eq(~rst_n)
]
- # sys clk / sdram clk
+ # Sys Clk / SDRAM Clk
clk50 = platform.request("clk50")
self.comb += self.cd_sys.clk.eq(clk50)
self.specials += \
Instance("ALTPLL",
- p_BANDWIDTH_TYPE="AUTO",
- p_CLK0_DIVIDE_BY=1,
- p_CLK0_DUTY_CYCLE=50,
- p_CLK0_MULTIPLY_BY=1,
- p_CLK0_PHASE_SHIFT="-3000",
- p_COMPENSATE_CLOCK="CLK0",
- p_INCLK0_INPUT_FREQUENCY=20000,
- p_OPERATION_MODE="ZERO_DELAY_BUFFER",
- i_INCLK=clk50,
- o_CLK=self.cd_sys_ps.clk,
- i_ARESET=~rst_n,
- i_CLKENA=0x3f,
- i_EXTCLKENA=0xf,
- i_FBIN=1,
- i_PFDENA=1,
- i_PLLENA=1,
+ p_BANDWIDTH_TYPE = "AUTO",
+ p_CLK0_DIVIDE_BY = 1,
+ p_CLK0_DUTY_CYCLE = 50,
+ p_CLK0_MULTIPLY_BY = 1,
+ p_CLK0_PHASE_SHIFT = "-3000",
+ p_COMPENSATE_CLOCK = "CLK0",
+ p_INCLK0_INPUT_FREQUENCY = 20000,
+ p_OPERATION_MODE = "ZERO_DELAY_BUFFER",
+ i_INCLK = clk50,
+ o_CLK = self.cd_sys_ps.clk,
+ i_ARESET = ~rst_n,
+ i_CLKENA = 0x3f,
+ i_EXTCLKENA = 0xf,
+ i_FBIN = 1,
+ i_PFDENA = 1,
+ i_PLLENA = 1,
)
self.comb += platform.request("sdram_clock").eq(self.cd_sys_ps.clk)
def __init__(self, sys_clk_freq=int(50e6), **kwargs):
assert sys_clk_freq == int(50e6)
platform = de0nano.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=0x8000,
- **kwargs)
+ integrated_rom_size=0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform)
+ # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = IS42S16160(self.clk_freq, "1:1")
self.register_sdram(self.sdrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# Build --------------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
self.clock_domains.cd_clk200 = ClockDomain()
# # #
self.submodules.pll = pll = S7MMCM(speedgrade=-2)
self.comb += pll.reset.eq(~platform.request("cpu_reset_n"))
pll.register_clkin(platform.request("clk200"), 200e6)
- pll.create_clkout(self.cd_sys, sys_clk_freq)
- pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
+ pll.create_clkout(self.cd_sys, sys_clk_freq)
+ pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
pll.create_clkout(self.cd_clk200, 200e6)
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_clk200)
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(125e6), integrated_rom_size=0x8000, **kwargs):
platform = genesys2.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- integrated_sram_size=0x8000,
- **kwargs)
+ integrated_rom_size = integrated_rom_size,
+ integrated_sram_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- sdram_module = MT41J256M16(self.clk_freq, "1:4")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
-
-# EthernetSoC ------------------------------------------------------------------------------------------
+ # DDR3 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"),
+ memtype = "DDR3",
+ nphases = 4,
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ sdram_module = MT41J256M16(self.clk_freq, "1:4")
+ self.register_sdram(self.ddrphy, sdram_module.geom_settings, sdram_module.timing_settings)
+
+# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
mem_map = {
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
self.clock_domains.cd_clk200 = ClockDomain()
# # #
self.submodules.pll = pll = S7MMCM(speedgrade=-2)
self.comb += pll.reset.eq(platform.request("cpu_reset"))
pll.register_clkin(platform.request("clk200"), 200e6)
- pll.create_clkout(self.cd_sys, sys_clk_freq)
- pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
+ pll.create_clkout(self.cd_sys, sys_clk_freq)
+ pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
pll.create_clkout(self.cd_clk200, 200e6)
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_clk200)
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(125e6), integrated_rom_size=0x8000, **kwargs):
platform = kc705.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- integrated_sram_size=0x8000,
- **kwargs)
+ integrated_rom_size = integrated_rom_size,
+ integrated_sram_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- sdram_module = MT8JTF12864(sys_clk_freq, "1:4")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
-
-# EthernetSoC ------------------------------------------------------------------------------------------
+ # DDR3 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = s7ddrphy.K7DDRPHY(platform.request("ddram"),
+ memtype = "DDR3",
+ nphases = 4,
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ sdram_module = MT8JTF12864(sys_clk_freq, "1:4")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
+
+# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
mem_map = {
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
self.clock_domains.cd_clk200 = ClockDomain()
- self.clock_domains.cd_ic = ClockDomain()
+ self.clock_domains.cd_ic = ClockDomain()
# # #
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(125e6), integrated_rom_size=0x8000, **kwargs):
platform = kcu105.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- integrated_sram_size=0x8000,
- **kwargs)
+ integrated_rom_size = integrated_rom_size,
+ integrated_sram_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = usddrphy.USDDRPHY(platform.request("ddram"), memtype="DDR4", sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- self.add_constant("USDDRPHY", None)
- sdram_module = EDY4016A(sys_clk_freq, "1:4")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings,
- main_ram_size_limit=0x40000000)
-
-# EthernetSoC ------------------------------------------------------------------------------------------
+ # DDR4 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = usddrphy.USDDRPHY(platform.request("ddram"),
+ memtype = "DDR4",
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ self.add_constant("USDDRPHY", None)
+ sdram_module = EDY4016A(sys_clk_freq, "1:4")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings,
+ main_ram_size_limit = 0x40000000)
+
+# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
mem_map = {
class _CRG(Module):
def __init__(self, platform, clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys = ClockDomain()
self.clock_domains.cd_sys_ps = ClockDomain()
# # #
self.submodules.pll = pll = S6PLL(speedgrade=-1)
pll.register_clkin(platform.request("clk32"), 32e6)
- pll.create_clkout(self.cd_sys, clk_freq)
+ pll.create_clkout(self.cd_sys, clk_freq)
pll.create_clkout(self.cd_sys_ps, clk_freq, phase=270)
self.specials += Instance("ODDR2",
def __init__(self, sys_clk_freq=int(80e6), **kwargs):
assert sys_clk_freq == int(80e6)
platform = minispartan6.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=0x8000,
- **kwargs)
+ integrated_rom_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
+ # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = AS4C16M16(sys_clk_freq, "1:1")
self.register_sdram(self.sdrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# Build --------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(100e6), integrated_rom_size=0x8000, **kwargs):
platform = netv2.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- integrated_sram_size=0x8000,
- **kwargs)
+ integrated_rom_size = integrated_rom_size,
+ integrated_sram_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- sdram_module = MT41J128M16(sys_clk_freq, "1:4")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ # DDR3 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"),
+ memtype = "DDR3",
+ nphases = 4,
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ sdram_module = MT41J128M16(sys_clk_freq, "1:4")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# EthernetSoC --------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys2x = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys2x = ClockDomain(reset_less=True)
self.clock_domains.cd_sys2x_dqs = ClockDomain(reset_less=True)
- self.clock_domains.cd_clk200 = ClockDomain()
- self.clock_domains.cd_eth = ClockDomain()
+ self.clock_domains.cd_clk200 = ClockDomain()
+ self.clock_domains.cd_eth = ClockDomain()
# # #
self.submodules.pll = pll = S7MMCM(speedgrade=-1)
self.comb += pll.reset.eq(~platform.request("cpu_reset"))
pll.register_clkin(platform.request("clk100"), 100e6)
- pll.create_clkout(self.cd_sys, sys_clk_freq)
- pll.create_clkout(self.cd_sys2x, 2*sys_clk_freq)
+ pll.create_clkout(self.cd_sys, sys_clk_freq)
+ pll.create_clkout(self.cd_sys2x, 2*sys_clk_freq)
pll.create_clkout(self.cd_sys2x_dqs, 2*sys_clk_freq, phase=90)
- pll.create_clkout(self.cd_clk200, 200e6)
- pll.create_clkout(self.cd_eth, 50e6)
+ pll.create_clkout(self.cd_clk200, 200e6)
+ pll.create_clkout(self.cd_eth, 50e6)
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_clk200)
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(100e6), integrated_rom_size=0x8000, **kwargs):
platform = nexys4ddr.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- integrated_sram_size=0x8000,
- **kwargs)
+ integrated_rom_size = integrated_rom_size,
+ integrated_sram_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), memtype="DDR2", nphases=2, sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- sdram_module = MT47H64M16(sys_clk_freq, "1:2")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
- self.add_constant("MEMTEST_ADDR_SIZE", 0) # FIXME
+ # DDR2 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"),
+ memtype = "DDR2",
+ nphases = 2,
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ sdram_module = MT47H64M16(sys_clk_freq, "1:2")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
+ self.add_constant("MEMTEST_ADDR_SIZE", 0) # FIXME
# EthernetSoC --------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
self.clock_domains.cd_sys4x_dqs = ClockDomain(reset_less=True)
- self.clock_domains.cd_clk200 = ClockDomain()
- self.clock_domains.cd_clk100 = ClockDomain()
+ self.clock_domains.cd_clk200 = ClockDomain()
+ self.clock_domains.cd_clk100 = ClockDomain()
# # #
self.submodules.pll = pll = S7MMCM(speedgrade=-1)
self.comb += pll.reset.eq(~platform.request("cpu_reset"))
pll.register_clkin(platform.request("clk100"), 100e6)
- pll.create_clkout(self.cd_sys, sys_clk_freq)
- pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
+ pll.create_clkout(self.cd_sys, sys_clk_freq)
+ pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
pll.create_clkout(self.cd_sys4x_dqs, 4*sys_clk_freq, phase=90)
- pll.create_clkout(self.cd_clk200, 200e6)
- pll.create_clkout(self.cd_clk100, 100e6)
+ pll.create_clkout(self.cd_clk200, 200e6)
+ pll.create_clkout(self.cd_clk100, 100e6)
self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_clk200)
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(100e6), integrated_rom_size=0x8000, **kwargs):
platform = nexys_video.Platform()
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- integrated_sram_size=0x8000,
- **kwargs)
+ integrated_rom_size = integrated_rom_size,
+ integrated_sram_size = 0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
- # sdram
- self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"), sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- sdram_module = MT41K256M16(sys_clk_freq, "1:4")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ # DDR3 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram"),
+ memtype = "DDR3",
+ nphases = 4,
+ sys_clk_freq = sys_clk_freq)
+ self.add_csr("ddrphy")
+ sdram_module = MT41K256M16(sys_clk_freq, "1:4")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# EthernetSoC --------------------------------------------------------------------------------------
class BaseSoC(SoCCore):
def __init__(self, platform, integrated_rom_size=0x8000, **kwargs):
sys_clk_freq = int(1e9/platform.default_clk_period)
+
+ # SoCCore ----------------------------------------------------------------------------------
SoCCore.__init__(self, platform, clk_freq=sys_clk_freq,
integrated_rom_size=integrated_rom_size,
integrated_main_ram_size=16*1024,
**kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = CRG(platform.request(platform.default_clk_name))
# EthernetSoC --------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys = ClockDomain()
self.clock_domains.cd_sys_ps = ClockDomain(reset_less=True)
# # #
# clk / rst
clk25 = platform.request("clk25")
- rst = platform.request("rst")
+ rst = platform.request("rst")
platform.add_period_constraint(clk25, 40.0)
# pll
def __init__(self, device="LFE5U-45F", toolchain="diamond", **kwargs):
platform = ulx3s.Platform(device=device, toolchain=toolchain)
sys_clk_freq = int(50e6)
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=0x8000,
- **kwargs)
+ integrated_rom_size=0x8000,
+ **kwargs)
+ # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
+ # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=2)
sdram_module = MT48LC16M16(sys_clk_freq, "1:1")
self.register_sdram(self.sdrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# Build --------------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
- self.clock_domains.cd_init = ClockDomain()
- self.clock_domains.cd_por = ClockDomain(reset_less=True)
- self.clock_domains.cd_sys = ClockDomain()
- self.clock_domains.cd_sys2x = ClockDomain()
+ self.clock_domains.cd_init = ClockDomain()
+ self.clock_domains.cd_por = ClockDomain(reset_less=True)
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_sys2x = ClockDomain()
self.clock_domains.cd_sys2x_i = ClockDomain(reset_less=True)
# # #
# clk / rst
clk100 = platform.request("clk100")
- rst_n = platform.request("rst_n")
+ rst_n = platform.request("rst_n")
platform.add_period_constraint(clk100, 1e9/100e6)
# power on reset
por_count = Signal(16, reset=2**16-1)
- por_done = Signal()
+ por_done = Signal()
self.comb += self.cd_por.clk.eq(ClockSignal())
self.comb += por_done.eq(por_count == 0)
self.sync.por += If(~por_done, por_count.eq(por_count - 1))
pll.create_clkout(self.cd_init, 25e6)
self.specials += [
Instance("ECLKSYNCB",
- i_ECLKI=self.cd_sys2x_i.clk,
- i_STOP=self.stop,
- o_ECLKO=self.cd_sys2x.clk),
+ i_ECLKI = self.cd_sys2x_i.clk,
+ i_STOP = self.stop,
+ o_ECLKO = self.cd_sys2x.clk),
Instance("CLKDIVF",
- p_DIV="2.0",
- i_ALIGNWD=0,
- i_CLKI=self.cd_sys2x.clk,
- i_RST=self.cd_sys2x.rst,
- o_CDIVX=self.cd_sys.clk),
+ p_DIV = "2.0",
+ i_ALIGNWD = 0,
+ i_CLKI = self.cd_sys2x.clk,
+ i_RST = self.cd_sys2x.rst,
+ o_CDIVX = self.cd_sys.clk),
AsyncResetSynchronizer(self.cd_init, ~por_done | ~pll.locked | ~rst_n),
AsyncResetSynchronizer(self.cd_sys, ~por_done | ~pll.locked | ~rst_n)
]
class BaseSoC(SoCSDRAM):
def __init__(self, sys_clk_freq=int(75e6), toolchain="diamond", integrated_rom_size=0x8000, **kwargs):
platform = versa_ecp5.Platform(toolchain=toolchain)
+
+ # SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
- integrated_rom_size=integrated_rom_size,
- **kwargs)
-
- # crg
- crg = _CRG(platform, sys_clk_freq)
- self.submodules.crg = crg
-
- # sdram
- self.submodules.ddrphy = ECP5DDRPHY(
- platform.request("ddram"),
- sys_clk_freq=sys_clk_freq)
- self.add_csr("ddrphy")
- self.add_constant("ECP5DDRPHY", None)
- self.comb += crg.stop.eq(self.ddrphy.init.stop)
- sdram_module = MT41K64M16(sys_clk_freq, "1:2")
- self.register_sdram(self.ddrphy,
- sdram_module.geom_settings,
- sdram_module.timing_settings)
+ integrated_rom_size=integrated_rom_size,
+ **kwargs)
+
+ # CRG --------------------------------------------------------------------------------------
+ self.submodules.crg = _CRG(platform, sys_clk_freq)
+
+ # DDR3 SDRAM -------------------------------------------------------------------------------
+ if not self.integrated_main_ram_size:
+ self.submodules.ddrphy = ECP5DDRPHY(
+ platform.request("ddram"),
+ sys_clk_freq=sys_clk_freq)
+ self.add_csr("ddrphy")
+ self.add_constant("ECP5DDRPHY", None)
+ self.comb += self.crg.stop.eq(self.ddrphy.init.stop)
+ sdram_module = MT41K64M16(sys_clk_freq, "1:2")
+ self.register_sdram(self.ddrphy,
+ geom_settings = sdram_module.geom_settings,
+ timing_settings = sdram_module.timing_settings)
# EthernetSoC --------------------------------------------------------------------------------------