litex/soc/cores/cpu/__init__, litex/soc/integration/soc: modifying CPUNone to adapt data_width and io_regions according to bus data_width/address_width

This commit is contained in:
Gwenhael Goavec-Merou 2023-10-30 17:17:16 +01:00
parent 4b9601bdab
commit eedebd8adb
2 changed files with 8 additions and 3 deletions

View File

@ -50,11 +50,9 @@ class CPU(LiteXModule):
class CPUNone(CPU):
variants = ["standard"]
data_width = 32
endianness = "little"
reset_address = 0x00000000
reset_address_check = False
io_regions = {0x0000_0000: 0x1_0000_0000} # origin, length
periph_buses = []
memory_buses = []
mem_map = {
@ -63,6 +61,10 @@ class CPUNone(CPU):
"spiflash" : 0x1000_0000, # FIXME: Remove.
}
def __init__(self, data_width=32, addr_width=32):
self.io_regions = {0: int(2**float(addr_width))} # origin, length
self.data_width = data_width
# CPUs GCC Triples ---------------------------------------------------------------------------------
CPU_GCC_TRIPLE_RISCV64 = (

View File

@ -1082,7 +1082,10 @@ class SoC(LiteXModule, SoCCoreCompat):
colorer("\n - ".join(sorted(cpu_cls.variants)))))
raise SoCError()
self.check_if_exists("cpu")
self.cpu = cpu_cls(self.platform, variant)
if cpu_cls is cpu.CPUNone:
self.cpu = cpu_cls(self.bus.data_width, self.bus.address_width)
else:
self.cpu = cpu_cls(self.platform, variant)
self.logger.info("CPU {} {}.".format(
colorer(name, color="underline"),
colorer("added", color="green")))