summaryrefslogtreecommitdiff
path: root/src/python/m5
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:38 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:38 -0500
commite6c57786a43b6e21e11dec95d2fcb2c965d84abb (patch)
tree166881c6a737311088972d4425ae3d20d63690bb /src/python/m5
parente0d93fde993126a2147648586f2fa0526412d841 (diff)
downloadgem5-e6c57786a43b6e21e11dec95d2fcb2c965d84abb.tar.xz
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.
Diffstat (limited to 'src/python/m5')
-rw-r--r--src/python/m5/SimObject.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 9f43fc70c..5db33d4bc 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -872,13 +872,20 @@ class SimObject(object):
all = {}
# search children
for child in self._children.itervalues():
- 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))))
+ # a child could be a list, so ensure we visit each item
+ if isinstance(child, list):
+ children = child
+ else:
+ children = [child]
+
+ 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
for pname,pdesc in self._params.iteritems():
if issubclass(pdesc.ptype, ptype):