# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = ac701.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
# sdram
self.submodules.ddrphy = s7ddrphy.A7DDRPHY(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,
# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
if phy == "rgmii":
self.submodules.ethphy = LiteEthPHYRGMII(self.platform.request("eth_clocks"),
self.platform.request("eth"))
+ self.add_csr("ethphy")
self.ethphy.crg.cd_eth_rx.clk.attr.add("keep")
self.ethphy.crg.cd_eth_tx.clk.attr.add("keep")
self.platform.add_period_constraint(self.ethphy.crg.cd_eth_rx.clk, 1e9/125e6)
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
# Build --------------------------------------------------------------------------------------------
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = arty.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=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,
# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.submodules.ethphy = LiteEthPHYMII(self.platform.request("eth_clocks"),
self.platform.request("eth"))
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
self.ethphy.crg.cd_eth_rx.clk.attr.add("keep")
self.ethphy.crg.cd_eth_rx.clk,
self.ethphy.crg.cd_eth_tx.clk)
+
# Build --------------------------------------------------------------------------------------------
def main():
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = genesys2.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=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,
# EthernetSoC ------------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.submodules.ethphy = LiteEthPHYRGMII(self.platform.request("eth_clocks"),
self.platform.request("eth"))
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
self.ethphy.crg.cd_eth_rx.clk.attr.add("keep")
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = kc705.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=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,
# EthernetSoC ------------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.submodules.ethphy = LiteEthPHY(self.platform.request("eth_clocks"),
self.platform.request("eth"), clk_freq=self.clk_freq)
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
self.ethphy.crg.cd_eth_rx.clk.attr.add("keep")
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(125e6), **kwargs):
platform = kcu105.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=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,
# EthernetSoC ------------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.comb += self.platform.request("sfp_tx_disable_n", 0).eq(1)
self.submodules.ethphy = KU_1000BASEX(self.crg.cd_clk200.clk,
self.platform.request("sfp", 0), sys_clk_freq=self.clk_freq)
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
self.ethphy.cd_eth_rx.clk.attr.add("keep")
# CRG ----------------------------------------------------------------------------------------------
-
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
self.clock_domains.cd_sys = ClockDomain()
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = nexys4ddr.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=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,
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(100e6), **kwargs):
platform = nexys_video.Platform()
SoCSDRAM.__init__(self, platform, clk_freq=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,
# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.submodules.ethphy = LiteEthPHYRGMII(self.platform.request("eth_clocks"),
self.platform.request("eth"))
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
self.ethphy.crg.cd_eth_rx.clk.attr.add("keep")
# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 20,
- "ethmac": 21
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.submodules.ethphy = LiteEthPHY(platform.request("eth_clocks"),
platform.request("eth"))
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness, with_preamble_crc=False)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
# Build --------------------------------------------------------------------------------------------
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCSDRAM):
- csr_map = {
- "ddrphy": 16,
- }
- csr_map.update(SoCSDRAM.csr_map)
def __init__(self, sys_clk_freq=int(75e6), toolchain="diamond", **kwargs):
platform = versa_ecp5.Platform(toolchain=toolchain)
SoCSDRAM.__init__(self, platform, clk_freq=sys_clk_freq,
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")
# EthernetSoC --------------------------------------------------------------------------------------
class EthernetSoC(BaseSoC):
- csr_map = {
- "ethphy": 18,
- "ethmac": 19
- }
- csr_map.update(BaseSoC.csr_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
self.submodules.ethphy = LiteEthPHYRGMII(
self.platform.request("eth_clocks"),
self.platform.request("eth"))
+ self.add_csr("ethphy")
self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
self.add_interrupt("ethmac")
self.ethphy.crg.cd_eth_rx.clk.attr.add("keep")
class SimSoC(SoCSDRAM):
- csr_peripherals = [
- "ethphy",
- "ethmac",
-
- "etherbonephy",
- "etherbonecore",
-
- "analyzer",
- ]
- csr_map_update(SoCSDRAM.csr_map, csr_peripherals)
-
- interrupt_map = {
- "ethmac": 3,
- }
- interrupt_map.update(SoCSDRAM.interrupt_map)
-
mem_map = {
"ethmac": 0x30000000, # (shadow @0xb0000000)
}
if with_ethernet:
# eth phy
self.submodules.ethphy = LiteEthPHYModel(self.platform.request("eth", 0))
+ self.add_csr("ethphy")
# eth mac
ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
interface="wishbone", endianness=self.cpu.endianness)
self.submodules.ethmac = ethmac
self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
self.add_memory_region("ethmac", self.mem_map["ethmac"] | self.shadow_base, 0x2000)
+ self.add_csr("ethmac")
+ self.add_interrupt("ethmac")
# etherbone
if with_etherbone:
# eth phy
self.submodules.etherbonephy = LiteEthPHYModel(self.platform.request("eth", 0)) # FIXME
+ self.add_csr("etherbonephy")
# eth core
etherbonecore = LiteEthUDPIPCore(self.etherbonephy,
etherbone_mac_address, convert_ip(etherbone_ip_address), sys_clk_freq)
self.cpu.dbus
]
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 512)
+ self.add_csr("analyzer")
def main():