Merge pull request #1823 from trabucayre/cpuNone_config

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:
enjoy-digital 2023-10-30 18:42:54 +01:00 committed by GitHub
commit 8c73afea91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -50,11 +50,9 @@ class CPU(LiteXModule):
class CPUNone(CPU): class CPUNone(CPU):
variants = ["standard"] variants = ["standard"]
data_width = 32
endianness = "little" endianness = "little"
reset_address = 0x00000000 reset_address = 0x00000000
reset_address_check = False reset_address_check = False
io_regions = {0x0000_0000: 0x1_0000_0000} # origin, length
periph_buses = [] periph_buses = []
memory_buses = [] memory_buses = []
mem_map = { mem_map = {
@ -63,6 +61,10 @@ class CPUNone(CPU):
"spiflash" : 0x1000_0000, # FIXME: Remove. "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 --------------------------------------------------------------------------------- # CPUs GCC Triples ---------------------------------------------------------------------------------
CPU_GCC_TRIPLE_RISCV64 = ( CPU_GCC_TRIPLE_RISCV64 = (

View File

@ -1082,7 +1082,10 @@ class SoC(LiteXModule, SoCCoreCompat):
colorer("\n - ".join(sorted(cpu_cls.variants))))) colorer("\n - ".join(sorted(cpu_cls.variants)))))
raise SoCError() raise SoCError()
self.check_if_exists("cpu") 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( self.logger.info("CPU {} {}.".format(
colorer(name, color="underline"), colorer(name, color="underline"),
colorer("added", color="green"))) colorer("added", color="green")))