soc/init_rom: Add SoCError when ROM Size < Contents Size and cosmetic cleanups.
This commit is contained in:
parent
0601bf51c4
commit
f181eabebb
|
@ -1068,8 +1068,15 @@ class SoC(LiteXModule, SoCCoreCompat):
|
||||||
self.logger.info("Initializing ROM {} with contents (Size: {}).".format(
|
self.logger.info("Initializing ROM {} with contents (Size: {}).".format(
|
||||||
colorer(name),
|
colorer(name),
|
||||||
colorer(f"0x{4*len(contents):x}")))
|
colorer(f"0x{4*len(contents):x}")))
|
||||||
|
if self.bus.regions[name].size < 4*len(contents):
|
||||||
|
self.logger.error("Contents Size ({}) {} ROM Size ({}).".format(
|
||||||
|
colorer(f"0x{4*len(contents):x}"),
|
||||||
|
colorer("exceeds", color="red"),
|
||||||
|
colorer(f"0x{self.bus.regions[name].size:x}"),
|
||||||
|
))
|
||||||
|
raise SoCError()
|
||||||
getattr(self, name).mem.init = contents
|
getattr(self, name).mem.init = contents
|
||||||
if auto_size and "w" not in self.bus.regions[name].mode:
|
if auto_size and ("w" not in self.bus.regions[name].mode):
|
||||||
self.logger.info("Auto-Resizing ROM {} from {} to {}.".format(
|
self.logger.info("Auto-Resizing ROM {} from {} to {}.".format(
|
||||||
colorer(name),
|
colorer(name),
|
||||||
colorer(f"0x{self.bus.regions[name].size:x}"),
|
colorer(f"0x{self.bus.regions[name].size:x}"),
|
||||||
|
|
Loading…
Reference in New Issue