soc: improve memory region conflict check
This commit is contained in:
parent
980791e2b8
commit
5113301130
|
@ -133,13 +133,13 @@ class SoC(Module):
|
||||||
raise FinalizeError
|
raise FinalizeError
|
||||||
self._wb_slaves.append((address_decoder, interface))
|
self._wb_slaves.append((address_decoder, interface))
|
||||||
|
|
||||||
def check_memory_region(self, name, origin):
|
def add_memory_region(self, name, origin, length):
|
||||||
|
def in_this_region(addr):
|
||||||
|
return addr >= origin and addr < origin + length
|
||||||
for n, o, l in self.memory_regions:
|
for n, o, l in self.memory_regions:
|
||||||
if n == name or o == origin:
|
if n == name or in_this_region(o) or in_this_region(o+l-1):
|
||||||
raise ValueError("Memory region conflict between {} and {}".format(n, name))
|
raise ValueError("Memory region conflict between {} and {}".format(n, name))
|
||||||
|
|
||||||
def add_memory_region(self, name, origin, length):
|
|
||||||
self.check_memory_region(name, origin)
|
|
||||||
self.memory_regions.append((name, origin, length))
|
self.memory_regions.append((name, origin, length))
|
||||||
|
|
||||||
def register_mem(self, name, address, interface, size=None):
|
def register_mem(self, name, address, interface, size=None):
|
||||||
|
|
Loading…
Reference in New Issue