changeset f329e7ec9786 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f329e7ec9786
description:
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:
src/python/m5/SimObject.py | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diffs (31 lines):
diff -r e399b6c18b76 -r f329e7ec9786 src/python/m5/SimObject.py
--- a/src/python/m5/SimObject.py Mon Jan 07 13:05:38 2013 -0500
+++ b/src/python/m5/SimObject.py Mon Jan 07 13:05:38 2013 -0500
@@ -872,13 +872,20 @@
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):
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev