interrupts = {}
mem_map = {}
io_regions = {}
+ use_rom = False
def __init__(self, *args, **kwargs):
pass
self._generate_includes()
self._generate_csr_map()
if self.soc.cpu_type is not None:
- self._prepare_rom_software()
- self._generate_rom_software(not self.soc.integrated_rom_initialized)
- if self.soc.integrated_rom_size and self.compile_software:
- if not self.soc.integrated_rom_initialized:
- self._initialize_rom_software()
+ if self.soc.cpu.use_rom:
+ self._prepare_rom_software()
+ self._generate_rom_software(not self.soc.integrated_rom_initialized)
+ if self.soc.integrated_rom_size and self.compile_software:
+ if not self.soc.integrated_rom_initialized:
+ self._initialize_rom_software()
if "run" not in kwargs:
kwargs["run"] = self.compile_gateware
self.csr.update_alignment(self.cpu.data_width)
# Add Bus Masters/CSR/IRQs
if not isinstance(self.cpu, cpu.CPUNone):
+ self.cpu.use_rom = (reset_address is None)
if reset_address is None:
reset_address = self.mem_map["rom"]
self.cpu.set_reset_address(reset_address)
# SoC CPU Check ----------------------------------------------------------------------------
if not isinstance(self.cpu, cpu.CPUNone):
- for name in ["rom", "sram"]:
+ for name in ["sram"] + ["rom"] if self.cpu.use_rom else []:
if name not in self.bus.regions.keys():
self.logger.error("CPU needs {} Region to be {} as Bus or Linker Region.".format(
colorer(name),
self.logger.error(self.bus)
raise
+ cpu_reset_address_valid = False
+ for container in self.bus.regions.values():
+ if self.bus.check_region_is_in(
+ region = SoCRegion(origin=self.cpu.reset_address, size=self.bus.data_width//8),
+ container = container):
+ cpu_reset_address_valid = True
+ if not cpu_reset_address_valid:
+ self.logger.error("CPU needs {} to be in a {} Region.".format(
+ colorer("reset address 0x{:08x}".format(self.cpu.reset_address)),
+ colorer("defined", color="red")))
+ self.logger.error(self.bus)
+ raise
+
# SoC IRQ Interconnect ---------------------------------------------------------------------
if hasattr(self, "cpu"):
if hasattr(self.cpu, "interrupt"):
def __init__(self, platform, clk_freq,
# CPU parameters
cpu_type = "vexriscv",
- cpu_reset_address = 0x00000000,
+ cpu_reset_address = None,
cpu_variant = None,
# ROM parameters
integrated_rom_size = 0,
self.config = {}
# Parameters management --------------------------------------------------------------------
- cpu_type = None if cpu_type == "None" else cpu_type
+ cpu_type = None if cpu_type == "None" else cpu_type
+ cpu_reset_address = None if cpu_reset_address == "None" else cpu_reset_address
cpu_variant = cpu.check_format_cpu_variant(cpu_variant)
if not with_wishbone:
parser.add_argument("--cpu-variant", default=None,
help="select CPU variant, (default=standard)")
parser.add_argument("--cpu-reset-address", default=None, type=auto_int,
- help="CPU reset address (default=0x00000000 or ROM)")
+ help="CPU reset address (default=None (Integrated ROM)")
# ROM parameters
parser.add_argument("--integrated-rom-size", default=0x8000, type=auto_int,
help="size/enable the integrated (BIOS) ROM (default=32KB)")