1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 860 unchanged lines hidden (view full) --- 869 def print_ini(self, ini_file): 870 print >>ini_file, '[' + self.path() + ']' # .ini section header 871 872 instanceDict[self.path()] = self 873 874 if hasattr(self, 'type'): 875 print >>ini_file, 'type=%s' % self.type 876 |
877 if len(self._children.keys()): |
878 print >>ini_file, 'children=%s' % \ |
879 ' '.join(self._children[n].get_name() \ 880 for n in sorted(self._children.keys())) |
881 |
882 for param in sorted(self._params.keys()): |
883 value = self._values.get(param) 884 if value != None: 885 print >>ini_file, '%s=%s' % (param, 886 self._values[param].ini_str()) 887 |
888 for port_name in sorted(self._ports.keys()): |
889 port = self._port_refs.get(port_name, None) 890 if port != None: 891 print >>ini_file, '%s=%s' % (port_name, port.ini_str()) 892 893 print >>ini_file # blank line between objects 894 |
895 # generate a tree of dictionaries expressing all the parameters in the 896 # instantiated system for use by scripts that want to do power, thermal 897 # visualization, and other similar tasks 898 def get_config_as_dict(self): 899 d = attrdict() 900 if hasattr(self, 'type'): 901 d.type = self.type 902 if hasattr(self, 'cxx_class'): 903 d.cxx_class = self.cxx_class 904 905 for param in sorted(self._params.keys()): 906 value = self._values.get(param) 907 try: 908 d[param] = self._values[param].value 909 except AttributeError: 910 pass 911 912 for n in sorted(self._children.keys()): 913 d[self._children[n].get_name()] = self._children[n].get_config_as_dict() 914 915 for port_name in sorted(self._ports.keys()): 916 port = self._port_refs.get(port_name, None) 917 if port != None: 918 # Might want to actually make this reference the object 919 # in the future, although execing the string problem would 920 # get some of the way there 921 d[port_name] = port.ini_str() 922 923 return d 924 |
925 def getCCParams(self): 926 if self._ccParams: 927 return self._ccParams 928 929 cc_params_struct = getattr(m5.internal.params, '%sParams' % self.type) 930 cc_params = cc_params_struct() 931 cc_params.pyobj = self 932 cc_params.name = str(self) --- 185 unchanged lines hidden --- |