targets: switch to SoCCore/add_sdram instead of SoCSDRAM.

This commit is contained in:
Florent Kermarrec 2020-03-21 12:43:39 +01:00
parent 33bf1d3ee2
commit 83e6fb29f8
32 changed files with 429 additions and 243 deletions

View file

@ -11,6 +11,7 @@ from migen import *
from litex_boards.platforms import ac701 from litex_boards.platforms import ac701
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -45,12 +46,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), **kwargs): def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = ac701.Platform() platform = ac701.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -62,10 +63,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT8JTF12864(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT8JTF12864(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -50,15 +50,15 @@ class CRG(Module):
# PCIeSoC ----------------------------------------------------------------------------------------- # PCIeSoC -----------------------------------------------------------------------------------------
class PCIeSoC(SoCSDRAM): class PCIeSoC(SoCCore):
SoCSDRAM.mem_map["csr"] = 0x80000000 SoCCore.mem_map["csr"] = 0x80000000
SoCSDRAM.mem_map["rom"] = 0x20000000 SoCCore.mem_map["rom"] = 0x20000000
def __init__(self, platform, **kwargs): def __init__(self, platform, **kwargs):
sys_clk_freq = int(100e6) sys_clk_freq = int(100e6)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, sys_clk_freq, SoCCore.__init__(self, platform, sys_clk_freq,
ident = "LiteX SoC on Tagus", ident_version=True, ident = "LiteX SoC on Tagus", ident_version=True,
**kwargs) **kwargs)
@ -82,10 +82,15 @@ class PCIeSoC(SoCSDRAM):
sys_clk_freq = sys_clk_freq, sys_clk_freq = sys_clk_freq,
iodelay_clk_freq = 200e6) iodelay_clk_freq = 200e6)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT41J128M16(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41J128M16(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# PCIe ------------------------------------------------------------------------------------- # PCIe -------------------------------------------------------------------------------------
# pcie phy # pcie phy

View file

@ -11,6 +11,7 @@ from litex_boards.platforms import arty
from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -51,12 +52,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), **kwargs): def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = arty.Platform() platform = arty.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -69,10 +70,15 @@ class BaseSoC(SoCSDRAM):
sys_clk_freq = sys_clk_freq, sys_clk_freq = sys_clk_freq,
interface_type = "MEMORY") interface_type = "MEMORY")
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT41K128M16(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41K128M16(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -82,7 +82,7 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
mem_map = { mem_map = {
"hyperram": 0x20000000, "hyperram": 0x20000000,
} }
@ -93,8 +93,8 @@ class BaseSoC(SoCSDRAM):
assert sys_clk_freq == int(50e6) assert sys_clk_freq == int(50e6)
platform = c10lprefkit.Platform() platform = c10lprefkit.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform) self.submodules.crg = _CRG(platform)
@ -107,10 +107,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = MT48LC16M16(self.clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
geom_settings = sdram_module.geom_settings, module = MT48LC16M16(self.clk_freq, "1:1"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -14,6 +14,7 @@ from litex_boards.platforms import camlink_4k
from litex.build.lattice.trellis import trellis_args, trellis_argdict from litex.build.lattice.trellis import trellis_args, trellis_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -67,13 +68,13 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, toolchain="trellis", **kwargs): def __init__(self, toolchain="trellis", **kwargs):
platform = camlink_4k.Platform(toolchain=toolchain) platform = camlink_4k.Platform(toolchain=toolchain)
sys_clk_freq = int(81e6) sys_clk_freq = int(81e6)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -86,10 +87,15 @@ class BaseSoC(SoCSDRAM):
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("ECP5DDRPHY", None) self.add_constant("ECP5DDRPHY", None)
self.comb += self.crg.stop.eq(self.ddrphy.init.stop) self.comb += self.crg.stop.eq(self.ddrphy.init.stop)
sdram_module = MT41K64M16(sys_clk_freq, "1:2") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41K64M16(sys_clk_freq, "1:2"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import de0nano from litex_boards.platforms import de0nano
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -70,13 +71,13 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(50e6), **kwargs): def __init__(self, sys_clk_freq=int(50e6), **kwargs):
assert sys_clk_freq == int(50e6) assert sys_clk_freq == int(50e6)
platform = de0nano.Platform() platform = de0nano.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform) self.submodules.crg = _CRG(platform)
@ -84,10 +85,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: 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.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
geom_settings = sdram_module.geom_settings, module = IS42S16160(self.clk_freq, "1:1"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import de10lite from litex_boards.platforms import de10lite
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -78,13 +79,13 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(50e6), **kwargs): def __init__(self, sys_clk_freq=int(50e6), **kwargs):
assert sys_clk_freq == int(50e6) assert sys_clk_freq == int(50e6)
platform = de10lite.Platform() platform = de10lite.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform) self.submodules.crg = _CRG(platform)
@ -92,10 +93,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = IS42S16320(self.clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
geom_settings = sdram_module.geom_settings, module = IS42S16320(self.clk_freq, "1:1"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# VGASoC ------------------------------------------------------------------------------------------- # VGASoC -------------------------------------------------------------------------------------------

View file

@ -84,13 +84,13 @@ class BaseSoC(SoCCore):
# MiSTerSDRAMSoC ----------------------------------------------------------------------------------- # MiSTerSDRAMSoC -----------------------------------------------------------------------------------
class MiSTerSDRAMSoC(SoCSDRAM): class MiSTerSDRAMSoC(SoCCore):
def __init__(self, sys_clk_freq=int(50e6), **kwargs): def __init__(self, sys_clk_freq=int(50e6), **kwargs):
assert sys_clk_freq == int(50e6) assert sys_clk_freq == int(50e6)
platform = de10nano.Platform() platform = de10nano.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, with_sdram=True) self.submodules.crg = _CRG(platform, with_sdram=True)
@ -98,10 +98,15 @@ class MiSTerSDRAMSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = AS4C16M16(self.clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
geom_settings = sdram_module.geom_settings, module = AS4C16M16(self.clk_freq, "1:1"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import de1soc from litex_boards.platforms import de1soc
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -70,13 +71,13 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(50e6), **kwargs): def __init__(self, sys_clk_freq=int(50e6), **kwargs):
assert sys_clk_freq == int(50e6) assert sys_clk_freq == int(50e6)
platform = de1soc.Platform() platform = de1soc.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform) self.submodules.crg = _CRG(platform)
@ -84,11 +85,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
# ISSI IS42S16320D-7TL self.add_sdram("sdram",
sdram_module = IS42S16320(self.clk_freq, "1:1") phy = self.sdrphy,
self.register_sdram(self.sdrphy, module = IS42S16320(self.clk_freq, "1:1"),
sdram_module.geom_settings, origin = self.mem_map["main_ram"],
sdram_module.timing_settings) size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import de2_115 from litex_boards.platforms import de2_115
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -70,13 +71,13 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(50e6), **kwargs): def __init__(self, sys_clk_freq=int(50e6), **kwargs):
assert sys_clk_freq == int(50e6) assert sys_clk_freq == int(50e6)
platform = de2_115.Platform() platform = de2_115.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform) self.submodules.crg = _CRG(platform)
@ -84,10 +85,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = IS42S16320(self.clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
geom_settings = sdram_module.geom_settings, module = IS42S16320(self.clk_freq, "1:1"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen import *
from litex_boards.platforms import genesys2 from litex_boards.platforms import genesys2
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -40,12 +41,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = genesys2.Platform() platform = genesys2.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -57,10 +58,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT41J256M16(self.clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41J256M16(self.clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -17,6 +17,7 @@ from litex_boards.platforms import hadbadge
from litex.build.lattice.trellis import trellis_args, trellis_argdict from litex.build.lattice.trellis import trellis_args, trellis_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -49,12 +50,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, toolchain="trellis", sys_clk_freq=int(48e6), sdram_module_cls="AS4C32M8", **kwargs): def __init__(self, toolchain="trellis", sys_clk_freq=int(48e6), sdram_module_cls="AS4C32M8", **kwargs):
platform = hadbadge.Platform(toolchain=toolchain) platform = hadbadge.Platform(toolchain=toolchain)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -62,10 +63,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=2) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=2)
sdram_module = AS4C32M8(sys_clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
sdram_module.geom_settings, module = AS4C32M8(sys_clk_freq, "1:1"),
sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -12,6 +12,7 @@ from migen import *
from litex_boards.platforms import kc705 from litex_boards.platforms import kc705
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -42,12 +43,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = kc705.Platform() platform = kc705.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -61,10 +62,15 @@ class BaseSoC(SoCSDRAM):
cmd_latency = 1) cmd_latency = 1)
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("DDRPHY_CMD_DELAY", 13) self.add_constant("DDRPHY_CMD_DELAY", 13)
sdram_module = MT8JTF12864(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT8JTF12864(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen import *
from litex_boards.platforms import kcu105 from litex_boards.platforms import kcu105
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -49,12 +50,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = kcu105.Platform() platform = kcu105.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -68,10 +69,15 @@ class BaseSoC(SoCSDRAM):
cmd_latency = 0) cmd_latency = 0)
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("USDDRPHY", None) self.add_constant("USDDRPHY", None)
sdram_module = EDY4016A(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = EDY4016A(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen import *
from litex.boards.platforms import kx2 from litex.boards.platforms import kx2
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -39,12 +40,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = kx2.Platform() platform = kx2.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -56,10 +57,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = H5TC4G63CFR(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = H5TC4G63CFR(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -9,6 +9,7 @@ from migen import *
from litex_boards.platforms import linsn_rv901t from litex_boards.platforms import linsn_rv901t
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
from litex.soc.cores.clock import S6PLL from litex.soc.cores.clock import S6PLL
@ -45,21 +46,29 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, **kwargs): def __init__(self, **kwargs):
platform = linsn_rv901t.Platform() platform = linsn_rv901t.Platform()
sys_clk_freq = int(75e6) sys_clk_freq = int(75e6)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) if not self.integrated_main_ram_size:
sdram_module = M12L64322A(sys_clk_freq, "1:1") self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
self.register_sdram(self.sdrphy, sdram_module.geom_settings, sdram_module.timing_settings) self.add_sdram("sdram",
phy = self.sdrphy,
module = M12L64322A(sys_clk_freq, "1:1"),
origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -11,6 +11,7 @@ from migen.genlib.io import CRG
from litex_boards.platforms import mercury_xu5 from litex_boards.platforms import mercury_xu5
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -47,12 +48,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = mercury_xu5.Platform() platform = mercury_xu5.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -66,10 +67,15 @@ class BaseSoC(SoCSDRAM):
cmd_latency = 0) cmd_latency = 0)
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("USDDRPHY", None) self.add_constant("USDDRPHY", None)
sdram_module = MT40A256M16(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT40A256M16(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -12,6 +12,7 @@ from litex_boards.platforms import mimas_a7
from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -44,12 +45,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), **kwargs): def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = mimas_a7.Platform() platform = mimas_a7.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -61,10 +62,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT41J128M16(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41J128M16(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -14,6 +14,7 @@ from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import minispartan6 from litex_boards.platforms import minispartan6
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -43,13 +44,13 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(80e6), **kwargs): def __init__(self, sys_clk_freq=int(80e6), **kwargs):
assert sys_clk_freq == int(80e6) assert sys_clk_freq == int(80e6)
platform = minispartan6.Platform() platform = minispartan6.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -57,10 +58,15 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
sdram_module = AS4C16M16(sys_clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
geom_settings = sdram_module.geom_settings, module = AS4C16M16(sys_clk_freq, "1:1"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -49,15 +49,15 @@ class CRG(Module):
# PCIeSoC ----------------------------------------------------------------------------------------- # PCIeSoC -----------------------------------------------------------------------------------------
class PCIeSoC(SoCSDRAM): class PCIeSoC(SoCCore):
SoCSDRAM.mem_map["csr"] = 0x80000000 SoCCore.mem_map["csr"] = 0x80000000
SoCSDRAM.mem_map["rom"] = 0x20000000 SoCCore.mem_map["rom"] = 0x20000000
def __init__(self, platform, **kwargs): def __init__(self, platform, **kwargs):
sys_clk_freq = int(100e6) sys_clk_freq = int(100e6)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore --------------------_-------------------------------------------------------------
SoCSDRAM.__init__(self, platform, sys_clk_freq, SoCCore.__init__(self, platform, sys_clk_freq,
ident = "LiteX SoC on Nereid", ident_version=True, ident = "LiteX SoC on Nereid", ident_version=True,
**kwargs) **kwargs)
@ -81,10 +81,15 @@ class PCIeSoC(SoCSDRAM):
sys_clk_freq = sys_clk_freq, sys_clk_freq = sys_clk_freq,
iodelay_clk_freq = 200e6) iodelay_clk_freq = 200e6)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT8KTF51264(sys_clk_freq, "1:4", speedgrade="800") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT8KTF51264(sys_clk_freq, "1:4", speedgrade="800"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# PCIe ------------------------------------------------------------------------------------- # PCIe -------------------------------------------------------------------------------------
# pcie phy # pcie phy

View file

@ -10,6 +10,7 @@ from migen import *
from litex_boards.platforms import netv2 from litex_boards.platforms import netv2
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -45,12 +46,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), **kwargs): def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = netv2.Platform() platform = netv2.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ------------------------------------------------------------------------------_---
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -62,10 +63,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = K4B2G1646F(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = K4B2G1646F(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen import *
from litex_boards.platforms import nexys4ddr from litex_boards.platforms import nexys4ddr
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -44,12 +45,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), **kwargs): def __init__(self, sys_clk_freq=int(75e6), **kwargs):
platform = nexys4ddr.Platform() platform = nexys4ddr.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------_-----------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -61,10 +62,15 @@ class BaseSoC(SoCSDRAM):
nphases = 2, nphases = 2,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT47H64M16(sys_clk_freq, "1:2") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT47H64M16(sys_clk_freq, "1:2"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -10,6 +10,7 @@ from migen import *
from litex_boards.platforms import nexys_video from litex_boards.platforms import nexys_video
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -44,12 +45,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), **kwargs): def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = nexys_video.Platform() platform = nexys_video.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -61,10 +62,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT41K256M16(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41K256M16(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -13,6 +13,7 @@ from litex_boards.platforms import orangecrab
from litex.build.lattice.trellis import trellis_args, trellis_argdict from litex.build.lattice.trellis import trellis_args, trellis_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -74,27 +75,33 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(48e6), toolchain="trellis", **kwargs): def __init__(self, sys_clk_freq=int(48e6), toolchain="trellis", **kwargs):
platform = orangecrab.Platform(toolchain=toolchain) platform = orangecrab.Platform(toolchain=toolchain)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------------_-----------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
# DDR3 SDRAM ------------------------------------------------------------------------------- # DDR3 SDRAM -------------------------------------------------------------------------------
self.submodules.ddrphy = ECP5DDRPHY( if not self.integrated_main_ram_size:
platform.request("ddram"), self.submodules.ddrphy = ECP5DDRPHY(
sys_clk_freq=sys_clk_freq) platform.request("ddram"),
self.add_csr("ddrphy") sys_clk_freq=sys_clk_freq)
self.add_constant("ECP5DDRPHY", None) self.add_csr("ddrphy")
self.comb += self.crg.stop.eq(self.ddrphy.init.stop) self.add_constant("ECP5DDRPHY", None)
sdram_module = MT41K64M16(sys_clk_freq, "1:2") self.comb += self.crg.stop.eq(self.ddrphy.init.stop)
self.register_sdram(self.ddrphy, self.add_sdram("sdram",
geom_settings = sdram_module.geom_settings, phy = self.ddrphy,
timing_settings = sdram_module.timing_settings) module = MT41K64M16(sys_clk_freq, "1:2"),
origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -16,6 +16,7 @@ from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import pipistrello from litex_boards.platforms import pipistrello
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -146,33 +147,39 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, **kwargs): def __init__(self, **kwargs):
sys_clk_freq = (83 + Fraction(1, 3))*1000*1000 sys_clk_freq = (83 + Fraction(1, 3))*1000*1000
platform = pipistrello.Platform() platform = pipistrello.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore -----------------------------------------------------------------_----------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/sys_clk_freq) self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/sys_clk_freq)
# LPDDR SDRAM ------------------------------------------------------------------------------ # LPDDR SDRAM ------------------------------------------------------------------------------
self.submodules.ddrphy = s6ddrphy.S6HalfRateDDRPHY(platform.request("ddram"), if not self.integrated_main_ram_size:
memtype = "LPDDR", self.submodules.ddrphy = s6ddrphy.S6HalfRateDDRPHY(platform.request("ddram"),
rd_bitslip = 1, memtype = "LPDDR",
wr_bitslip = 3, rd_bitslip = 1,
dqs_ddr_alignment = "C1") wr_bitslip = 3,
self.comb += [ dqs_ddr_alignment = "C1")
self.ddrphy.clk4x_wr_strb.eq(self.crg.clk4x_wr_strb), self.comb += [
self.ddrphy.clk4x_rd_strb.eq(self.crg.clk4x_rd_strb), self.ddrphy.clk4x_wr_strb.eq(self.crg.clk4x_wr_strb),
] self.ddrphy.clk4x_rd_strb.eq(self.crg.clk4x_rd_strb),
self.add_csr("ddrphy") ]
sdram_module = MT46H32M16(sys_clk_freq, "1:2") self.add_csr("ddrphy")
self.register_sdram(self.ddrphy, self.add_sdram("sdram",
geom_settings = sdram_module.geom_settings, phy = self.ddrphy,
timing_settings = sdram_module.timing_settings) module = MT46H32M16(sys_clk_freq, "1:2"),
origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -51,15 +51,15 @@ class CRG(Module):
# PCIeSoC ----------------------------------------------------------------------------------------- # PCIeSoC -----------------------------------------------------------------------------------------
class PCIeSoC(SoCSDRAM): class PCIeSoC(SoCCore):
SoCSDRAM.mem_map["csr"] = 0x80000000 SoCCore.mem_map["csr"] = 0x80000000
SoCSDRAM.mem_map["rom"] = 0x20000000 SoCCore.mem_map["rom"] = 0x20000000
def __init__(self, platform, **kwargs): def __init__(self, platform, **kwargs):
sys_clk_freq = int(100e6) sys_clk_freq = int(100e6)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ---------------------------------------------------_------------------------------
SoCSDRAM.__init__(self, platform, sys_clk_freq, SoCCore.__init__(self, platform, sys_clk_freq,
ident = "LiteX SoC on Tagus", ident_version=True, ident = "LiteX SoC on Tagus", ident_version=True,
**kwargs) **kwargs)
@ -83,10 +83,15 @@ class PCIeSoC(SoCSDRAM):
sys_clk_freq = sys_clk_freq, sys_clk_freq = sys_clk_freq,
iodelay_clk_freq = 200e6) iodelay_clk_freq = 200e6)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT41J128M16(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41J128M16(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# PCIe ------------------------------------------------------------------------------------- # PCIe -------------------------------------------------------------------------------------
# pcie phy # pcie phy

View file

@ -82,8 +82,8 @@ class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", with_ethernet=False, **kwargs): def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", with_ethernet=False, **kwargs):
platform = trellisboard.Platform(toolchain=toolchain) platform = trellisboard.Platform(toolchain=toolchain)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore -----------------------------------------------------------------_----------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)

View file

@ -15,6 +15,7 @@ from litex_boards.platforms import ulx3s
from litex.build.lattice.trellis import trellis_args, trellis_argdict from litex.build.lattice.trellis import trellis_args, trellis_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -51,13 +52,14 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, device="LFE5U-45F", toolchain="trellis", def __init__(self, device="LFE5U-45F", toolchain="trellis",
sys_clk_freq=int(50e6), sdram_module_cls="MT48LC16M16", **kwargs): sys_clk_freq=int(50e6), sdram_module_cls="MT48LC16M16", **kwargs):
platform = ulx3s.Platform(device=device, toolchain=toolchain) platform = ulx3s.Platform(device=device, toolchain=toolchain)
# SoCSDRAM ---------------------------------------------------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) # SoCCore ----------------------------------------------------------------------------------
SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -65,17 +67,22 @@ class BaseSoC(SoCSDRAM):
# SDR SDRAM -------------------------------------------------------------------------------- # SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size: if not self.integrated_main_ram_size:
self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=2) self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=2)
sdram_module = getattr(litedram_modules, sdram_module_cls)(sys_clk_freq, "1:1") self.add_sdram("sdram",
self.register_sdram(self.sdrphy, phy = self.sdrphy,
sdram_module.geom_settings, module = getattr(litedram_modules, sdram_module_cls)(sys_clk_freq, "1:1"),
sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------
def main(): def main():
parser = argparse.ArgumentParser(description="LiteX SoC on ULX3S") parser = argparse.ArgumentParser(description="LiteX SoC on ULX3S")
parser.add_argument("--gateware-toolchain", dest="toolchain", default="trellis", parser.add_argument("--gateware-toolchain", dest="toolchain", default="trellis",
help="gateware toolchain to use, trellis (default) or diamond") help="gateware toolchain to use, trellis (default) or diamond")
parser.add_argument("--device", dest="device", default="LFE5U-45F", parser.add_argument("--device", dest="device", default="LFE5U-45F",
help="FPGA device, ULX3S can be populated with LFE5U-45F (default) or LFE5U-85F") help="FPGA device, ULX3S can be populated with LFE5U-45F (default) or LFE5U-85F")
parser.add_argument("--sys-clk-freq", default=50e6, parser.add_argument("--sys-clk-freq", default=50e6,

View file

@ -12,6 +12,7 @@ from migen import *
from litex_boards.platforms import vc707 from litex_boards.platforms import vc707
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -39,12 +40,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = vc707.Platform() platform = vc707.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ------------------------------------------------------------------_---------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -56,10 +57,15 @@ class BaseSoC(SoCSDRAM):
nphases = 4, nphases = 4,
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
self.add_csr("ddrphy") self.add_csr("ddrphy")
sdram_module = MT8JTF12864(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT8JTF12864(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -11,6 +11,7 @@ from migen import *
from litex_boards.platforms import vcu118 from litex_boards.platforms import vcu118
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -47,12 +48,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = vcu118.Platform() platform = vcu118.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore ----------------------------------------------------------_-----------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -66,10 +67,15 @@ class BaseSoC(SoCSDRAM):
cmd_latency = 0) cmd_latency = 0)
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("USDDRPHY", None) self.add_constant("USDDRPHY", None)
sdram_module = EDY4016A(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = EDY4016A(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------

View file

@ -14,6 +14,7 @@ from litex_boards.platforms import versa_ecp5
from litex.build.lattice.trellis import trellis_args, trellis_argdict from litex.build.lattice.trellis import trellis_args, trellis_argdict
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -71,12 +72,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", **kwargs): def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", **kwargs):
platform = versa_ecp5.Platform(toolchain=toolchain) platform = versa_ecp5.Platform(toolchain=toolchain)
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore -----------------------------------------_----------------------------------------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -89,10 +90,15 @@ class BaseSoC(SoCSDRAM):
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("ECP5DDRPHY", None) self.add_constant("ECP5DDRPHY", None)
self.comb += self.crg.stop.eq(self.ddrphy.init.stop) self.comb += self.crg.stop.eq(self.ddrphy.init.stop)
sdram_module = MT41K64M16(sys_clk_freq, "1:2") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = MT41K64M16(sys_clk_freq, "1:2"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# EthernetSoC -------------------------------------------------------------------------------------- # EthernetSoC --------------------------------------------------------------------------------------

View file

@ -11,6 +11,7 @@ from migen import *
from litex_boards.platforms import zcu104 from litex_boards.platforms import zcu104
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.soc_sdram import * from litex.soc.integration.soc_sdram import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
@ -46,12 +47,12 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), **kwargs): def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = zcu104.Platform() platform = zcu104.Platform()
# SoCSDRAM --------------------------------------------------------------------------------- # SoCCore -------------------------------------------------------------------------_--------
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq) self.submodules.crg = _CRG(platform, sys_clk_freq)
@ -65,10 +66,15 @@ class BaseSoC(SoCSDRAM):
cmd_latency = 1) cmd_latency = 1)
self.add_csr("ddrphy") self.add_csr("ddrphy")
self.add_constant("USDDRPHY", None) self.add_constant("USDDRPHY", None)
sdram_module = KVR21SE15S84(sys_clk_freq, "1:4") self.add_sdram("sdram",
self.register_sdram(self.ddrphy, phy = self.ddrphy,
geom_settings = sdram_module.geom_settings, module = KVR21SE15S84(sys_clk_freq, "1:4"),
timing_settings = sdram_module.timing_settings) origin = self.mem_map["main_ram"],
size = kwargs.get("max_sdram_size", 0x40000000),
l2_cache_size = kwargs.get("l2_size", 8192),
l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128),
l2_cache_reverse = True
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------