From 4364043b087d88742ba41c8be659105810de9fc1 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 24 Aug 2020 18:19:03 +0200 Subject: [PATCH] integration/soc: expose integrated_rom_mode to allow ROM to be writable (useful for BIOS/ROM development where content is reloaded over UARTBone/Etherbone). --- litex/soc/integration/soc.py | 12 ++++++------ litex/soc/integration/soc_core.py | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index e4695b855..99f5532fd 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -803,8 +803,8 @@ class SoC(Module): self.bus.regions[name])) setattr(self.submodules, name, ram) - def add_rom(self, name, origin, size, contents=[]): - self.add_ram(name, origin, size, contents, mode="r") + def add_rom(self, name, origin, size, contents=[], mode="r"): + self.add_ram(name, origin, size, contents, mode=mode) def add_csr_bridge(self, origin, register=False): csr_bridge_cls = { @@ -1170,10 +1170,10 @@ class LiteXSoC(SoC): if spd_byte < len(module._spd_data): mem[i] |= module._spd_data[spd_byte] self.add_rom( - name="spd", - origin=self.mem_map.get("spd", None), - size=len(module._spd_data), - contents=mem, + name = "spd", + origin = self.mem_map.get("spd", None), + size = len(module._spd_data), + contents = mem, ) if not with_soc_interconnect: return diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 4266999a0..344d84f40 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -71,6 +71,7 @@ class SoCCore(LiteXSoC): cpu_cls = None, # ROM parameters integrated_rom_size = 0, + integrated_rom_mode = "r", integrated_rom_init = [], # SRAM parameters integrated_sram_size = 0x2000, @@ -161,7 +162,7 @@ class SoCCore(LiteXSoC): # Add integrated ROM if integrated_rom_size: - self.add_rom("rom", self.cpu.reset_address, integrated_rom_size, integrated_rom_init) + self.add_rom("rom", self.cpu.reset_address, integrated_rom_size, integrated_rom_init, integrated_rom_mode) # Add integrated SRAM if integrated_sram_size: