SimObject.py (8998:c8bf5a20bc07) | SimObject.py (8999:6f306dd5cee0) |
---|---|
1# Copyright (c) 2012 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 30 unchanged lines hidden (view full) --- 39# 40# Authors: Steve Reinhardt 41# Nathan Binkert 42# Andreas Hansson 43 44import sys 45from types import FunctionType, MethodType, ModuleType 46 | 1# Copyright (c) 2012 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 30 unchanged lines hidden (view full) --- 39# 40# Authors: Steve Reinhardt 41# Nathan Binkert 42# Andreas Hansson 43 44import sys 45from types import FunctionType, MethodType, ModuleType 46 |
47try: 48 import pydot 49except: 50 pydot = False 51 | |
52import m5 53from m5.util import * 54 55# Have to import params up top since Param is referenced on initial 56# load (when SimObject class references Param to create a class 57# variable, the 'name' param)... 58from m5.params import * 59# There are a few things we need that aren't in params.__all__ since --- 995 unchanged lines hidden (view full) --- 1055 # i don't know if there's a better way to do this - calling 1056 # setMemoryMode directly from self._ccObject results in calling 1057 # SimObject::setMemoryMode, not the System::setMemoryMode 1058 self._ccObject.setMemoryMode(mode) 1059 1060 def takeOverFrom(self, old_cpu): 1061 self._ccObject.takeOverFrom(old_cpu._ccObject) 1062 | 47import m5 48from m5.util import * 49 50# Have to import params up top since Param is referenced on initial 51# load (when SimObject class references Param to create a class 52# variable, the 'name' param)... 53from m5.params import * 54# There are a few things we need that aren't in params.__all__ since --- 995 unchanged lines hidden (view full) --- 1050 # i don't know if there's a better way to do this - calling 1051 # setMemoryMode directly from self._ccObject results in calling 1052 # SimObject::setMemoryMode, not the System::setMemoryMode 1053 self._ccObject.setMemoryMode(mode) 1054 1055 def takeOverFrom(self, old_cpu): 1056 self._ccObject.takeOverFrom(old_cpu._ccObject) 1057 |
1063 # generate output file for 'dot' to display as a pretty graph. 1064 def outputDot(self, dot): 1065 if isRoot(self): 1066 label = "{root|" 1067 else: 1068 label = "{%s|" % self._name 1069 1070 if isSimObject(self._base): 1071 label += '%s|' % self.type 1072 1073 if self._children: 1074 for c in self._children: 1075 child = self._children[c] 1076 if isSimObjectVector(child): 1077 for obj in child: 1078 dot.add_edge(pydot.Edge(self.path(), obj.path(), style="bold")) 1079 else: 1080 dot.add_edge(pydot.Edge(self.path(), child.path(), style="bold")) 1081 1082 for param in self._params.keys(): 1083 value = self._values.get(param) 1084 if value != None: 1085 ini_str_value = self._values[param].ini_str() 1086 label += '%s = %s\\n' % (param, re.sub(':', '-', ini_str_value)) 1087 1088 label += '}' 1089 1090 dot.add_node(pydot.Node(self.path(), shape="Mrecord",label=label)) 1091 1092 # recursively dump out children 1093 for c in self._children: 1094 child = self._children[c] 1095 if isSimObjectVector(child): 1096 for obj in child: 1097 obj.outputDot(dot) 1098 else: 1099 child.outputDot(dot) 1100 | |
1101# Function to provide to C++ so it can look up instances based on paths 1102def resolveSimObject(name): 1103 obj = instanceDict[name] 1104 return obj.getCCObject() 1105 1106def isSimObject(value): 1107 return isinstance(value, SimObject) 1108 --- 52 unchanged lines hidden --- | 1058# Function to provide to C++ so it can look up instances based on paths 1059def resolveSimObject(name): 1060 obj = instanceDict[name] 1061 return obj.getCCObject() 1062 1063def isSimObject(value): 1064 return isinstance(value, SimObject) 1065 --- 52 unchanged lines hidden --- |