mirror of
https://github.com/Silicon1602/srdl2sv.git
synced 2024-12-22 06:58:41 +00:00
Resolve UnboundLocalError bug when SignalNodes are instantiated
This happened in AddrMap and RegFile because a the width of a new variable 'new_child' is performed. However, SignalNodes will not create such a child.
This commit is contained in:
parent
27c5931101
commit
eb3f1dd57e
@ -54,6 +54,7 @@ class AddrMap(Component):
|
||||
|
||||
# Traverse through children
|
||||
for child in self.obj.children():
|
||||
print(child)
|
||||
if isinstance(child, node.AddrmapNode):
|
||||
# This addressmap opens a completely new scope. For example,
|
||||
# a field_reset does not propagate through to this scope.
|
||||
@ -76,6 +77,7 @@ class AddrMap(Component):
|
||||
new_child.sanity_checks()
|
||||
self.mems[child.inst_name] = new_child
|
||||
elif isinstance(child, node.RegNode):
|
||||
print('here')
|
||||
if child.inst.is_alias:
|
||||
# If the node we found is an alias, we shall not create a
|
||||
# new register. Rather, we bury up the old register and add
|
||||
@ -94,7 +96,7 @@ class AddrMap(Component):
|
||||
try:
|
||||
if (regwidth := new_child.get_regwidth()) > self.regwidth:
|
||||
self.regwidth = regwidth
|
||||
except KeyError:
|
||||
except (KeyError, UnboundLocalError):
|
||||
# Simply ignore nodes like SignalNodes
|
||||
pass
|
||||
|
||||
|
@ -85,7 +85,7 @@ class RegFile(Component):
|
||||
try:
|
||||
if (regwidth := new_child.get_regwidth()) > self.regwidth:
|
||||
self.regwidth = regwidth
|
||||
except KeyError:
|
||||
except (KeyError, UnboundLocalError):
|
||||
# Simply ignore nodes like SignalNodes
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user