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 --- 917 unchanged lines hidden (view full) --- 926 # instantiated system for use by scripts that want to do power, thermal 927 # visualization, and other similar tasks 928 def get_config_as_dict(self): 929 d = attrdict() 930 if hasattr(self, 'type'): 931 d.type = self.type 932 if hasattr(self, 'cxx_class'): 933 d.cxx_class = self.cxx_class |
934 # Add the name and path of this object to be able to link to 935 # the stats 936 d.name = self.get_name() 937 d.path = self.path() |
938 939 for param in sorted(self._params.keys()): 940 value = self._values.get(param) 941 if value != None: 942 try: 943 # Use native type for those supported by JSON and 944 # strings for everything else. skipkeys=True seems 945 # to not work as well as one would hope 946 if type(self._values[param].value) in \ 947 [str, unicode, int, long, float, bool, None]: 948 d[param] = self._values[param].value 949 else: 950 d[param] = str(self._values[param]) 951 952 except AttributeError: 953 pass 954 955 for n in sorted(self._children.keys()): |
956 child = self._children[n] 957 # Use the name of the attribute (and not get_name()) as 958 # the key in the JSON dictionary to capture the hierarchy 959 # in the Python code that assembled this system 960 d[n] = child.get_config_as_dict() |
961 962 for port_name in sorted(self._ports.keys()): 963 port = self._port_refs.get(port_name, None) 964 if port != None: |
965 # Represent each port with a dictionary containing the 966 # prominent attributes 967 d[port_name] = port.get_config_as_dict() |
968 969 return d 970 971 def getCCParams(self): 972 if self._ccParams: 973 return self._ccParams 974 975 cc_params_struct = getattr(m5.internal.params, '%sParams' % self.type) --- 149 unchanged lines hidden --- |