Merge pull request #297 from mithro/mem-region-pp
Improve the error message on memory region conflict.
This commit is contained in:
commit
3465fc96d4
|
@ -83,6 +83,11 @@ class SoCMemRegion:
|
||||||
self.length = length
|
self.length = length
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "<SoCMemRegion 0x{:x} 0x{:x} {}>".format(
|
||||||
|
self.origin, self.length, self.type)
|
||||||
|
|
||||||
|
|
||||||
class SoCCSRRegion:
|
class SoCCSRRegion:
|
||||||
def __init__(self, origin, busword, obj):
|
def __init__(self, origin, busword, obj):
|
||||||
self.origin = origin
|
self.origin = origin
|
||||||
|
|
|
@ -401,7 +401,11 @@ class SoCCore(Module):
|
||||||
self.mem_regions[name] = SoCMemRegion(origin, length, type)
|
self.mem_regions[name] = SoCMemRegion(origin, length, type)
|
||||||
overlap = self.check_regions_overlap(self.mem_regions)
|
overlap = self.check_regions_overlap(self.mem_regions)
|
||||||
if overlap is not None:
|
if overlap is not None:
|
||||||
raise ValueError("Memory region conflict between {} and {}".format(overlap[0], overlap[1]))
|
o0, o1 = overlap[0], overlap[1]
|
||||||
|
raise ValueError("Memory region conflict between {} ({}) and {} ({})".format(
|
||||||
|
o0, self.mem_regions[o0],
|
||||||
|
o1, self.mem_regions[o1],
|
||||||
|
))
|
||||||
|
|
||||||
def register_mem(self, name, address, interface, size=0x10000000):
|
def register_mem(self, name, address, interface, size=0x10000000):
|
||||||
self.add_wb_slave(address, interface, size)
|
self.add_wb_slave(address, interface, size)
|
||||||
|
|
Loading…
Reference in New Issue