Skip to content

Commit 9be0e62

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 9be0e62

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

misoc/integration/soc_core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ 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:
139+
raise ValueError(
140+
"CPU reset address 0x{:x} is not equal to the rom start addres 0x{:x}"
141+
.format(self.cpu_reset_address,self.mem_map["rom"]))
142+
self.add_memory_region("rom", self.mem_map["rom"],rom_size)
141143

142144
def get_memory_regions(self):
143145
return self._memory_regions

0 commit comments

Comments
 (0)