Skip to content

Commit 0706631

Browse files
committed
soc_core:allocate correct size for ROM.
The wishbone and memory allocation code for ROM validated that the CPU reset address was witin the ROM address range. This however only really worked when the cpu_reset_address was 0. A second issue was that the size of the allocated memory mapping was wrongly calculated. Signed-off-by: Kees Jongenburger <[email protected]>
1 parent 8e033c2 commit 0706631

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

misoc/integration/soc_core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ def register_mem(self, name, origin, length, interface):
135135

136136
def register_rom(self, interface, rom_size=0xa000):
137137
self.add_wb_slave(self.mem_map["rom"], rom_size, interface)
138-
assert self.cpu_reset_address < rom_size
139-
self.add_memory_region("rom", self.cpu_reset_address,
140-
rom_size-self.cpu_reset_address)
138+
if not self.mem_map["rom"] <= self.cpu_reset_address < self.mem_map["rom"] + rom_size:
139+
raise ValueError("CPU reset address 0x{:x} should be within ROM address range 0x{:x}-0x{:x}".format(self.cpu_reset_address,self.mem_map["rom"],self.mem_map["rom"] + rom_size ))
140+
self.add_memory_region("rom", self.mem_map["rom"],rom_size)
141141

142142
def get_memory_regions(self):
143143
return self._memory_regions

0 commit comments

Comments
 (0)