config: Traverse lists when visiting children in all proxy
This patch makes the all proxy traverse any potential list that is encountered in the object hierarchy instead of only looking at children that are SimObjects. An example of where this is useful is when creating a multi-channel memory system as a list of controllers, whilst ensuring that the memories are still visible in the system.
This commit is contained in:
parent
e0d93fde99
commit
e6c57786a4
1 changed files with 14 additions and 7 deletions
|
@ -872,13 +872,20 @@ class SimObject(object):
|
||||||
all = {}
|
all = {}
|
||||||
# search children
|
# search children
|
||||||
for child in self._children.itervalues():
|
for child in self._children.itervalues():
|
||||||
if isinstance(child, ptype) and not isproxy(child) and \
|
# a child could be a list, so ensure we visit each item
|
||||||
not isNullPointer(child):
|
if isinstance(child, list):
|
||||||
all[child] = True
|
children = child
|
||||||
if isSimObject(child):
|
else:
|
||||||
# also add results from the child itself
|
children = [child]
|
||||||
child_all, done = child.find_all(ptype)
|
|
||||||
all.update(dict(zip(child_all, [done] * len(child_all))))
|
for child in children:
|
||||||
|
if isinstance(child, ptype) and not isproxy(child) and \
|
||||||
|
not isNullPointer(child):
|
||||||
|
all[child] = True
|
||||||
|
if isSimObject(child):
|
||||||
|
# also add results from the child itself
|
||||||
|
child_all, done = child.find_all(ptype)
|
||||||
|
all.update(dict(zip(child_all, [done] * len(child_all))))
|
||||||
# search param space
|
# search param space
|
||||||
for pname,pdesc in self._params.iteritems():
|
for pname,pdesc in self._params.iteritems():
|
||||||
if issubclass(pdesc.ptype, ptype):
|
if issubclass(pdesc.ptype, ptype):
|
||||||
|
|
Loading…
Reference in a new issue