SimObject.py revision 5454
12740SN/A# Copyright (c) 2004-2006 The Regents of The University of Michigan 21046SN/A# All rights reserved. 31046SN/A# 41046SN/A# Redistribution and use in source and binary forms, with or without 51046SN/A# modification, are permitted provided that the following conditions are 61046SN/A# met: redistributions of source code must retain the above copyright 71046SN/A# notice, this list of conditions and the following disclaimer; 81046SN/A# redistributions in binary form must reproduce the above copyright 91046SN/A# notice, this list of conditions and the following disclaimer in the 101046SN/A# documentation and/or other materials provided with the distribution; 111046SN/A# neither the name of the copyright holders nor the names of its 121046SN/A# contributors may be used to endorse or promote products derived from 131046SN/A# this software without specific prior written permission. 141046SN/A# 151046SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 161046SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 171046SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 181046SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 191046SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 201046SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 211046SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 221046SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 231046SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 241046SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 251046SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262665SN/A# 272665SN/A# Authors: Steve Reinhardt 282665SN/A# Nathan Binkert 291046SN/A 303101Sstever@eecs.umich.eduimport sys, types 311438SN/A 324762Snate@binkert.orgimport proxy 334762Snate@binkert.orgimport m5 343102Sstever@eecs.umich.edufrom util import * 351585SN/Afrom multidict import multidict 361438SN/A 373102Sstever@eecs.umich.edu# These utility functions have to come first because they're 383102Sstever@eecs.umich.edu# referenced in params.py... otherwise they won't be defined when we 393102Sstever@eecs.umich.edu# import params below, and the recursive import of this file from 403102Sstever@eecs.umich.edu# params.py will not find these names. 413102Sstever@eecs.umich.edudef isSimObject(value): 423102Sstever@eecs.umich.edu return isinstance(value, SimObject) 433102Sstever@eecs.umich.edu 443102Sstever@eecs.umich.edudef isSimObjectClass(value): 453102Sstever@eecs.umich.edu return issubclass(value, SimObject) 463102Sstever@eecs.umich.edu 473102Sstever@eecs.umich.edudef isSimObjectSequence(value): 483102Sstever@eecs.umich.edu if not isinstance(value, (list, tuple)) or len(value) == 0: 493102Sstever@eecs.umich.edu return False 503102Sstever@eecs.umich.edu 513102Sstever@eecs.umich.edu for val in value: 523102Sstever@eecs.umich.edu if not isNullPointer(val) and not isSimObject(val): 533102Sstever@eecs.umich.edu return False 543102Sstever@eecs.umich.edu 553102Sstever@eecs.umich.edu return True 563102Sstever@eecs.umich.edu 573102Sstever@eecs.umich.edudef isSimObjectOrSequence(value): 583102Sstever@eecs.umich.edu return isSimObject(value) or isSimObjectSequence(value) 593102Sstever@eecs.umich.edu 603102Sstever@eecs.umich.edu# Have to import params up top since Param is referenced on initial 613102Sstever@eecs.umich.edu# load (when SimObject class references Param to create a class 623102Sstever@eecs.umich.edu# variable, the 'name' param)... 633102Sstever@eecs.umich.edufrom params import * 643102Sstever@eecs.umich.edu# There are a few things we need that aren't in params.__all__ since 653102Sstever@eecs.umich.edu# normal users don't need them 664762Snate@binkert.orgfrom params import ParamDesc, VectorParamDesc, isNullPointer, SimObjVector 673102Sstever@eecs.umich.edu 681342SN/AnoDot = False 691342SN/Atry: 701378SN/A import pydot 711342SN/Aexcept: 721378SN/A noDot = True 73679SN/A 74679SN/A##################################################################### 75679SN/A# 76679SN/A# M5 Python Configuration Utility 77679SN/A# 78679SN/A# The basic idea is to write simple Python programs that build Python 791692SN/A# objects corresponding to M5 SimObjects for the desired simulation 80679SN/A# configuration. For now, the Python emits a .ini file that can be 81679SN/A# parsed by M5. In the future, some tighter integration between M5 82679SN/A# and the Python interpreter may allow bypassing the .ini file. 83679SN/A# 84679SN/A# Each SimObject class in M5 is represented by a Python class with the 85679SN/A# same name. The Python inheritance tree mirrors the M5 C++ tree 86679SN/A# (e.g., SimpleCPU derives from BaseCPU in both cases, and all 87679SN/A# SimObjects inherit from a single SimObject base class). To specify 88679SN/A# an instance of an M5 SimObject in a configuration, the user simply 89679SN/A# instantiates the corresponding Python object. The parameters for 90679SN/A# that SimObject are given by assigning to attributes of the Python 91679SN/A# object, either using keyword assignment in the constructor or in 92679SN/A# separate assignment statements. For example: 93679SN/A# 941692SN/A# cache = BaseCache(size='64KB') 95679SN/A# cache.hit_latency = 3 96679SN/A# cache.assoc = 8 97679SN/A# 98679SN/A# The magic lies in the mapping of the Python attributes for SimObject 99679SN/A# classes to the actual SimObject parameter specifications. This 100679SN/A# allows parameter validity checking in the Python code. Continuing 101679SN/A# the example above, the statements "cache.blurfl=3" or 102679SN/A# "cache.assoc='hello'" would both result in runtime errors in Python, 103679SN/A# since the BaseCache object has no 'blurfl' parameter and the 'assoc' 104679SN/A# parameter requires an integer, respectively. This magic is done 105679SN/A# primarily by overriding the special __setattr__ method that controls 106679SN/A# assignment to object attributes. 107679SN/A# 108679SN/A# Once a set of Python objects have been instantiated in a hierarchy, 109679SN/A# calling 'instantiate(obj)' (where obj is the root of the hierarchy) 1102740SN/A# will generate a .ini file. 111679SN/A# 112679SN/A##################################################################### 113679SN/A 1144762Snate@binkert.org# list of all SimObject classes 1154762Snate@binkert.orgallClasses = {} 1164762Snate@binkert.org 1172738SN/A# dict to look up SimObjects based on path 1182738SN/AinstanceDict = {} 1192738SN/A 1202740SN/A# The metaclass for SimObject. This class controls how new classes 1212740SN/A# that derive from SimObject are instantiated, and provides inherited 1222740SN/A# class behavior (just like a class controls how instances of that 1232740SN/A# class are instantiated, and provides inherited instance behavior). 1241692SN/Aclass MetaSimObject(type): 1251427SN/A # Attributes that can be set only at initialization time 1261692SN/A init_keywords = { 'abstract' : types.BooleanType, 1274762Snate@binkert.org 'cxx_namespace' : types.StringType, 1284762Snate@binkert.org 'cxx_class' : types.StringType, 1294762Snate@binkert.org 'cxx_type' : types.StringType, 1304762Snate@binkert.org 'cxx_predecls' : types.ListType, 1314859Snate@binkert.org 'swig_objdecls' : types.ListType, 1324762Snate@binkert.org 'swig_predecls' : types.ListType, 1331692SN/A 'type' : types.StringType } 1341427SN/A # Attributes that can be set any time 1354762Snate@binkert.org keywords = { 'check' : types.FunctionType } 136679SN/A 137679SN/A # __new__ is called before __init__, and is where the statements 138679SN/A # in the body of the class definition get loaded into the class's 1392740SN/A # __dict__. We intercept this to filter out parameter & port assignments 140679SN/A # and only allow "private" attributes to be passed to the base 141679SN/A # __new__ (starting with underscore). 1421310SN/A def __new__(mcls, name, bases, dict): 1434762Snate@binkert.org assert name not in allClasses 1444762Snate@binkert.org 1452740SN/A # Copy "private" attributes, functions, and classes to the 1462740SN/A # official dict. Everything else goes in _init_dict to be 1472740SN/A # filtered in __init__. 1482740SN/A cls_dict = {} 1492740SN/A value_dict = {} 1502740SN/A for key,val in dict.items(): 1512740SN/A if key.startswith('_') or isinstance(val, (types.FunctionType, 1522740SN/A types.TypeType)): 1532740SN/A cls_dict[key] = val 1542740SN/A else: 1552740SN/A # must be a param/port setting 1562740SN/A value_dict[key] = val 1574762Snate@binkert.org if 'abstract' not in value_dict: 1584762Snate@binkert.org value_dict['abstract'] = False 1592740SN/A cls_dict['_value_dict'] = value_dict 1604762Snate@binkert.org cls = super(MetaSimObject, mcls).__new__(mcls, name, bases, cls_dict) 1614762Snate@binkert.org if 'type' in value_dict: 1624762Snate@binkert.org allClasses[name] = cls 1634762Snate@binkert.org return cls 164679SN/A 1652711SN/A # subclass initialization 166679SN/A def __init__(cls, name, bases, dict): 1672711SN/A # calls type.__init__()... I think that's a no-op, but leave 1682711SN/A # it here just in case it's not. 1691692SN/A super(MetaSimObject, cls).__init__(name, bases, dict) 1701310SN/A 1711427SN/A # initialize required attributes 1722740SN/A 1732740SN/A # class-only attributes 1742740SN/A cls._params = multidict() # param descriptions 1752740SN/A cls._ports = multidict() # port descriptions 1762740SN/A 1772740SN/A # class or instance attributes 1782740SN/A cls._values = multidict() # param values 1793105Sstever@eecs.umich.edu cls._port_refs = multidict() # port ref objects 1802740SN/A cls._instantiated = False # really instantiated, cloned, or subclassed 1811310SN/A 1821692SN/A # We don't support multiple inheritance. If you want to, you 1831585SN/A # must fix multidict to deal with it properly. 1841692SN/A if len(bases) > 1: 1851692SN/A raise TypeError, "SimObjects do not support multiple inheritance" 1861692SN/A 1871692SN/A base = bases[0] 1881692SN/A 1892740SN/A # Set up general inheritance via multidicts. A subclass will 1902740SN/A # inherit all its settings from the base class. The only time 1912740SN/A # the following is not true is when we define the SimObject 1922740SN/A # class itself (in which case the multidicts have no parent). 1931692SN/A if isinstance(base, MetaSimObject): 1941692SN/A cls._params.parent = base._params 1952740SN/A cls._ports.parent = base._ports 1961692SN/A cls._values.parent = base._values 1973105Sstever@eecs.umich.edu cls._port_refs.parent = base._port_refs 1982740SN/A # mark base as having been subclassed 1992712SN/A base._instantiated = True 2001692SN/A 2014762Snate@binkert.org # default keyword values 2024762Snate@binkert.org if 'type' in cls._value_dict: 2034762Snate@binkert.org _type = cls._value_dict['type'] 2044762Snate@binkert.org if 'cxx_class' not in cls._value_dict: 2054762Snate@binkert.org cls._value_dict['cxx_class'] = _type 2064762Snate@binkert.org 2074762Snate@binkert.org namespace = cls._value_dict.get('cxx_namespace', None) 2084762Snate@binkert.org 2094762Snate@binkert.org _cxx_class = cls._value_dict['cxx_class'] 2104762Snate@binkert.org if 'cxx_type' not in cls._value_dict: 2114762Snate@binkert.org t = _cxx_class + '*' 2124762Snate@binkert.org if namespace: 2134762Snate@binkert.org t = '%s::%s' % (namespace, t) 2144762Snate@binkert.org cls._value_dict['cxx_type'] = t 2154762Snate@binkert.org if 'cxx_predecls' not in cls._value_dict: 2164762Snate@binkert.org # A forward class declaration is sufficient since we are 2174762Snate@binkert.org # just declaring a pointer. 2184762Snate@binkert.org decl = 'class %s;' % _cxx_class 2194762Snate@binkert.org if namespace: 2205454Sgblack@eecs.umich.edu namespaces = namespace.split('::') 2215454Sgblack@eecs.umich.edu namespaces.reverse() 2225454Sgblack@eecs.umich.edu for namespace in namespaces: 2235454Sgblack@eecs.umich.edu decl = 'namespace %s { %s }' % (namespace, decl) 2244762Snate@binkert.org cls._value_dict['cxx_predecls'] = [decl] 2254762Snate@binkert.org 2264762Snate@binkert.org if 'swig_predecls' not in cls._value_dict: 2274762Snate@binkert.org # A forward class declaration is sufficient since we are 2284762Snate@binkert.org # just declaring a pointer. 2294762Snate@binkert.org cls._value_dict['swig_predecls'] = \ 2304762Snate@binkert.org cls._value_dict['cxx_predecls'] 2314762Snate@binkert.org 2324859Snate@binkert.org if 'swig_objdecls' not in cls._value_dict: 2334859Snate@binkert.org cls._value_dict['swig_objdecls'] = [] 2344859Snate@binkert.org 2352740SN/A # Now process the _value_dict items. They could be defining 2362740SN/A # new (or overriding existing) parameters or ports, setting 2372740SN/A # class keywords (e.g., 'abstract'), or setting parameter 2382740SN/A # values or port bindings. The first 3 can only be set when 2392740SN/A # the class is defined, so we handle them here. The others 2402740SN/A # can be set later too, so just emulate that by calling 2412740SN/A # setattr(). 2422740SN/A for key,val in cls._value_dict.items(): 2431527SN/A # param descriptions 2442740SN/A if isinstance(val, ParamDesc): 2451585SN/A cls._new_param(key, val) 2461427SN/A 2472738SN/A # port objects 2482738SN/A elif isinstance(val, Port): 2493105Sstever@eecs.umich.edu cls._new_port(key, val) 2502738SN/A 2511427SN/A # init-time-only keywords 2521427SN/A elif cls.init_keywords.has_key(key): 2531427SN/A cls._set_keyword(key, val, cls.init_keywords[key]) 2541427SN/A 2551427SN/A # default: use normal path (ends up in __setattr__) 2561427SN/A else: 2571427SN/A setattr(cls, key, val) 2581427SN/A 2591427SN/A def _set_keyword(cls, keyword, val, kwtype): 2601427SN/A if not isinstance(val, kwtype): 2611427SN/A raise TypeError, 'keyword %s has bad type %s (expecting %s)' % \ 2621427SN/A (keyword, type(val), kwtype) 2631427SN/A if isinstance(val, types.FunctionType): 2641427SN/A val = classmethod(val) 2651427SN/A type.__setattr__(cls, keyword, val) 2661427SN/A 2673100SN/A def _new_param(cls, name, pdesc): 2683100SN/A # each param desc should be uniquely assigned to one variable 2693100SN/A assert(not hasattr(pdesc, 'name')) 2703100SN/A pdesc.name = name 2713100SN/A cls._params[name] = pdesc 2723100SN/A if hasattr(pdesc, 'default'): 2733105Sstever@eecs.umich.edu cls._set_param(name, pdesc.default, pdesc) 2743105Sstever@eecs.umich.edu 2753105Sstever@eecs.umich.edu def _set_param(cls, name, value, param): 2763105Sstever@eecs.umich.edu assert(param.name == name) 2773105Sstever@eecs.umich.edu try: 2783105Sstever@eecs.umich.edu cls._values[name] = param.convert(value) 2793105Sstever@eecs.umich.edu except Exception, e: 2803105Sstever@eecs.umich.edu msg = "%s\nError setting param %s.%s to %s\n" % \ 2813105Sstever@eecs.umich.edu (e, cls.__name__, name, value) 2823105Sstever@eecs.umich.edu e.args = (msg, ) 2833105Sstever@eecs.umich.edu raise 2843105Sstever@eecs.umich.edu 2853105Sstever@eecs.umich.edu def _new_port(cls, name, port): 2863105Sstever@eecs.umich.edu # each port should be uniquely assigned to one variable 2873105Sstever@eecs.umich.edu assert(not hasattr(port, 'name')) 2883105Sstever@eecs.umich.edu port.name = name 2893105Sstever@eecs.umich.edu cls._ports[name] = port 2903105Sstever@eecs.umich.edu if hasattr(port, 'default'): 2913105Sstever@eecs.umich.edu cls._cls_get_port_ref(name).connect(port.default) 2923105Sstever@eecs.umich.edu 2933105Sstever@eecs.umich.edu # same as _get_port_ref, effectively, but for classes 2943105Sstever@eecs.umich.edu def _cls_get_port_ref(cls, attr): 2953105Sstever@eecs.umich.edu # Return reference that can be assigned to another port 2963105Sstever@eecs.umich.edu # via __setattr__. There is only ever one reference 2973105Sstever@eecs.umich.edu # object per port, but we create them lazily here. 2983105Sstever@eecs.umich.edu ref = cls._port_refs.get(attr) 2993105Sstever@eecs.umich.edu if not ref: 3003105Sstever@eecs.umich.edu ref = cls._ports[attr].makeRef(cls) 3013105Sstever@eecs.umich.edu cls._port_refs[attr] = ref 3023105Sstever@eecs.umich.edu return ref 3031585SN/A 3041310SN/A # Set attribute (called on foo.attr = value when foo is an 3051310SN/A # instance of class cls). 3061310SN/A def __setattr__(cls, attr, value): 3071310SN/A # normal processing for private attributes 3081310SN/A if attr.startswith('_'): 3091310SN/A type.__setattr__(cls, attr, value) 3101310SN/A return 3111310SN/A 3121310SN/A if cls.keywords.has_key(attr): 3131427SN/A cls._set_keyword(attr, value, cls.keywords[attr]) 3141310SN/A return 3151310SN/A 3162738SN/A if cls._ports.has_key(attr): 3173105Sstever@eecs.umich.edu cls._cls_get_port_ref(attr).connect(value) 3182738SN/A return 3192738SN/A 3202740SN/A if isSimObjectOrSequence(value) and cls._instantiated: 3212740SN/A raise RuntimeError, \ 3222740SN/A "cannot set SimObject parameter '%s' after\n" \ 3232740SN/A " class %s has been instantiated or subclassed" \ 3242740SN/A % (attr, cls.__name__) 3252740SN/A 3262740SN/A # check for param 3273105Sstever@eecs.umich.edu param = cls._params.get(attr) 3281310SN/A if param: 3293105Sstever@eecs.umich.edu cls._set_param(attr, value, param) 3303105Sstever@eecs.umich.edu return 3313105Sstever@eecs.umich.edu 3323105Sstever@eecs.umich.edu if isSimObjectOrSequence(value): 3333105Sstever@eecs.umich.edu # If RHS is a SimObject, it's an implicit child assignment. 3343105Sstever@eecs.umich.edu # Classes don't have children, so we just put this object 3353105Sstever@eecs.umich.edu # in _values; later, each instance will do a 'setattr(self, 3363105Sstever@eecs.umich.edu # attr, _values[attr])' in SimObject.__init__ which will 3373105Sstever@eecs.umich.edu # add this object as a child. 3382740SN/A cls._values[attr] = value 3393105Sstever@eecs.umich.edu return 3403105Sstever@eecs.umich.edu 3413105Sstever@eecs.umich.edu # no valid assignment... raise exception 3423105Sstever@eecs.umich.edu raise AttributeError, \ 3433105Sstever@eecs.umich.edu "Class %s has no parameter \'%s\'" % (cls.__name__, attr) 3441310SN/A 3451585SN/A def __getattr__(cls, attr): 3461692SN/A if cls._values.has_key(attr): 3471692SN/A return cls._values[attr] 3481585SN/A 3491585SN/A raise AttributeError, \ 3501585SN/A "object '%s' has no attribute '%s'" % (cls.__name__, attr) 3511585SN/A 3523100SN/A def __str__(cls): 3533100SN/A return cls.__name__ 3543100SN/A 3554859Snate@binkert.org def get_base(cls): 3564859Snate@binkert.org if str(cls) == 'SimObject': 3574859Snate@binkert.org return None 3584859Snate@binkert.org 3594859Snate@binkert.org return cls.__bases__[0].type 3604859Snate@binkert.org 3613100SN/A def cxx_decl(cls): 3624762Snate@binkert.org code = "#ifndef __PARAMS__%s\n" % cls 3634762Snate@binkert.org code += "#define __PARAMS__%s\n\n" % cls 3644762Snate@binkert.org 3653100SN/A # The 'dict' attribute restricts us to the params declared in 3663100SN/A # the object itself, not including inherited params (which 3673100SN/A # will also be inherited from the base class's param struct 3683100SN/A # here). 3694762Snate@binkert.org params = cls._params.local.values() 3703100SN/A try: 3713100SN/A ptypes = [p.ptype for p in params] 3723100SN/A except: 3733100SN/A print cls, p, p.ptype_str 3743100SN/A print params 3753100SN/A raise 3763100SN/A 3773100SN/A # get a list of lists of predeclaration lines 3784762Snate@binkert.org predecls = [] 3794762Snate@binkert.org predecls.extend(cls.cxx_predecls) 3804762Snate@binkert.org for p in params: 3814762Snate@binkert.org predecls.extend(p.cxx_predecls()) 3824762Snate@binkert.org # remove redundant lines 3834762Snate@binkert.org predecls2 = [] 3844762Snate@binkert.org for pd in predecls: 3854762Snate@binkert.org if pd not in predecls2: 3864762Snate@binkert.org predecls2.append(pd) 3874762Snate@binkert.org predecls2.sort() 3884762Snate@binkert.org code += "\n".join(predecls2) 3894762Snate@binkert.org code += "\n\n"; 3904762Snate@binkert.org 3914859Snate@binkert.org base = cls.get_base() 3924762Snate@binkert.org if base: 3934762Snate@binkert.org code += '#include "params/%s.hh"\n\n' % base 3944762Snate@binkert.org 3954762Snate@binkert.org for ptype in ptypes: 3964762Snate@binkert.org if issubclass(ptype, Enum): 3974762Snate@binkert.org code += '#include "enums/%s.hh"\n' % ptype.__name__ 3984762Snate@binkert.org code += "\n\n" 3994762Snate@binkert.org 4004762Snate@binkert.org # now generate the actual param struct 4014762Snate@binkert.org code += "struct %sParams" % cls 4024762Snate@binkert.org if base: 4034762Snate@binkert.org code += " : public %sParams" % base 4044762Snate@binkert.org code += "\n{\n" 4054762Snate@binkert.org if cls == SimObject: 4064762Snate@binkert.org code += " virtual ~%sParams() {}\n" % cls 4074762Snate@binkert.org if not hasattr(cls, 'abstract') or not cls.abstract: 4084762Snate@binkert.org if 'type' in cls.__dict__: 4094762Snate@binkert.org code += " %s create();\n" % cls.cxx_type 4104762Snate@binkert.org decls = [p.cxx_decl() for p in params] 4114762Snate@binkert.org decls.sort() 4124762Snate@binkert.org code += "".join([" %s\n" % d for d in decls]) 4134762Snate@binkert.org code += "};\n" 4144762Snate@binkert.org 4154762Snate@binkert.org # close #ifndef __PARAMS__* guard 4164762Snate@binkert.org code += "\n#endif\n" 4174762Snate@binkert.org return code 4184762Snate@binkert.org 4194762Snate@binkert.org def cxx_type_decl(cls): 4204859Snate@binkert.org base = cls.get_base() 4214762Snate@binkert.org code = '' 4224762Snate@binkert.org 4234762Snate@binkert.org if base: 4244762Snate@binkert.org code += '#include "%s_type.h"\n' % base 4254762Snate@binkert.org 4264762Snate@binkert.org # now generate dummy code for inheritance 4274762Snate@binkert.org code += "struct %s" % cls.cxx_class 4284762Snate@binkert.org if base: 4294762Snate@binkert.org code += " : public %s" % base.cxx_class 4304762Snate@binkert.org code += "\n{};\n" 4314762Snate@binkert.org 4324762Snate@binkert.org return code 4334762Snate@binkert.org 4344762Snate@binkert.org def swig_decl(cls): 4354859Snate@binkert.org base = cls.get_base() 4364859Snate@binkert.org 4374762Snate@binkert.org code = '%%module %s\n' % cls 4384762Snate@binkert.org 4394762Snate@binkert.org code += '%{\n' 4404762Snate@binkert.org code += '#include "params/%s.hh"\n' % cls 4414762Snate@binkert.org code += '%}\n\n' 4424762Snate@binkert.org 4434762Snate@binkert.org # The 'dict' attribute restricts us to the params declared in 4444762Snate@binkert.org # the object itself, not including inherited params (which 4454762Snate@binkert.org # will also be inherited from the base class's param struct 4464762Snate@binkert.org # here). 4474762Snate@binkert.org params = cls._params.local.values() 4484762Snate@binkert.org ptypes = [p.ptype for p in params] 4494762Snate@binkert.org 4504762Snate@binkert.org # get a list of lists of predeclaration lines 4514762Snate@binkert.org predecls = [] 4524762Snate@binkert.org predecls.extend([ p.swig_predecls() for p in params ]) 4533100SN/A # flatten 4543100SN/A predecls = reduce(lambda x,y:x+y, predecls, []) 4553100SN/A # remove redundant lines 4563100SN/A predecls2 = [] 4573100SN/A for pd in predecls: 4583100SN/A if pd not in predecls2: 4593100SN/A predecls2.append(pd) 4603100SN/A predecls2.sort() 4613100SN/A code += "\n".join(predecls2) 4623100SN/A code += "\n\n"; 4633100SN/A 4643100SN/A if base: 4654762Snate@binkert.org code += '%%import "params/%s.i"\n\n' % base 4663100SN/A 4674762Snate@binkert.org for ptype in ptypes: 4684762Snate@binkert.org if issubclass(ptype, Enum): 4694762Snate@binkert.org code += '%%import "enums/%s.hh"\n' % ptype.__name__ 4704762Snate@binkert.org code += "\n\n" 4713100SN/A 4724762Snate@binkert.org code += '%%import "params/%s_type.hh"\n\n' % cls 4733100SN/A code += '%%include "params/%s.hh"\n\n' % cls 4743100SN/A 4753100SN/A return code 4763100SN/A 4772740SN/A# The SimObject class is the root of the special hierarchy. Most of 478679SN/A# the code in this class deals with the configuration hierarchy itself 479679SN/A# (parent/child node relationships). 4801692SN/Aclass SimObject(object): 4811692SN/A # Specify metaclass. Any class inheriting from SimObject will 482679SN/A # get this metaclass. 4831692SN/A __metaclass__ = MetaSimObject 4843100SN/A type = 'SimObject' 4854762Snate@binkert.org abstract = True 4863100SN/A 4873100SN/A name = Param.String("Object name") 4884859Snate@binkert.org swig_objdecls = [ '%include "python/swig/sim_object.i"' ] 489679SN/A 4902740SN/A # Initialize new instance. For objects with SimObject-valued 4912740SN/A # children, we need to recursively clone the classes represented 4922740SN/A # by those param values as well in a consistent "deep copy"-style 4932740SN/A # fashion. That is, we want to make sure that each instance is 4942740SN/A # cloned only once, and that if there are multiple references to 4952740SN/A # the same original object, we end up with the corresponding 4962740SN/A # cloned references all pointing to the same cloned instance. 4972740SN/A def __init__(self, **kwargs): 4982740SN/A ancestor = kwargs.get('_ancestor') 4992740SN/A memo_dict = kwargs.get('_memo') 5002740SN/A if memo_dict is None: 5012740SN/A # prepare to memoize any recursively instantiated objects 5022740SN/A memo_dict = {} 5032740SN/A elif ancestor: 5042740SN/A # memoize me now to avoid problems with recursive calls 5052740SN/A memo_dict[ancestor] = self 5062711SN/A 5072740SN/A if not ancestor: 5082740SN/A ancestor = self.__class__ 5092740SN/A ancestor._instantiated = True 5102711SN/A 5112740SN/A # initialize required attributes 5122740SN/A self._parent = None 5132740SN/A self._children = {} 5142740SN/A self._ccObject = None # pointer to C++ object 5154762Snate@binkert.org self._ccParams = None 5162740SN/A self._instantiated = False # really "cloned" 5172712SN/A 5182711SN/A # Inherit parameter values from class using multidict so 5192711SN/A # individual value settings can be overridden. 5202740SN/A self._values = multidict(ancestor._values) 5212740SN/A # clone SimObject-valued parameters 5222740SN/A for key,val in ancestor._values.iteritems(): 5232740SN/A if isSimObject(val): 5242740SN/A setattr(self, key, val(_memo=memo_dict)) 5252740SN/A elif isSimObjectSequence(val) and len(val): 5262740SN/A setattr(self, key, [ v(_memo=memo_dict) for v in val ]) 5272740SN/A # clone port references. no need to use a multidict here 5282740SN/A # since we will be creating new references for all ports. 5293105Sstever@eecs.umich.edu self._port_refs = {} 5303105Sstever@eecs.umich.edu for key,val in ancestor._port_refs.iteritems(): 5313105Sstever@eecs.umich.edu self._port_refs[key] = val.clone(self, memo_dict) 5321692SN/A # apply attribute assignments from keyword args, if any 5331692SN/A for key,val in kwargs.iteritems(): 5341692SN/A setattr(self, key, val) 535679SN/A 5362740SN/A # "Clone" the current instance by creating another instance of 5372740SN/A # this instance's class, but that inherits its parameter values 5382740SN/A # and port mappings from the current instance. If we're in a 5392740SN/A # "deep copy" recursive clone, check the _memo dict to see if 5402740SN/A # we've already cloned this instance. 5411692SN/A def __call__(self, **kwargs): 5422740SN/A memo_dict = kwargs.get('_memo') 5432740SN/A if memo_dict is None: 5442740SN/A # no memo_dict: must be top-level clone operation. 5452740SN/A # this is only allowed at the root of a hierarchy 5462740SN/A if self._parent: 5472740SN/A raise RuntimeError, "attempt to clone object %s " \ 5482740SN/A "not at the root of a tree (parent = %s)" \ 5492740SN/A % (self, self._parent) 5502740SN/A # create a new dict and use that. 5512740SN/A memo_dict = {} 5522740SN/A kwargs['_memo'] = memo_dict 5532740SN/A elif memo_dict.has_key(self): 5542740SN/A # clone already done & memoized 5552740SN/A return memo_dict[self] 5562740SN/A return self.__class__(_ancestor = self, **kwargs) 5571343SN/A 5583105Sstever@eecs.umich.edu def _get_port_ref(self, attr): 5593105Sstever@eecs.umich.edu # Return reference that can be assigned to another port 5603105Sstever@eecs.umich.edu # via __setattr__. There is only ever one reference 5613105Sstever@eecs.umich.edu # object per port, but we create them lazily here. 5623105Sstever@eecs.umich.edu ref = self._port_refs.get(attr) 5633105Sstever@eecs.umich.edu if not ref: 5643105Sstever@eecs.umich.edu ref = self._ports[attr].makeRef(self) 5653105Sstever@eecs.umich.edu self._port_refs[attr] = ref 5663105Sstever@eecs.umich.edu return ref 5673105Sstever@eecs.umich.edu 5681692SN/A def __getattr__(self, attr): 5692738SN/A if self._ports.has_key(attr): 5703105Sstever@eecs.umich.edu return self._get_port_ref(attr) 5712738SN/A 5721692SN/A if self._values.has_key(attr): 5731692SN/A return self._values[attr] 5741427SN/A 5751692SN/A raise AttributeError, "object '%s' has no attribute '%s'" \ 5761692SN/A % (self.__class__.__name__, attr) 5771427SN/A 5781692SN/A # Set attribute (called on foo.attr = value when foo is an 5791692SN/A # instance of class cls). 5801692SN/A def __setattr__(self, attr, value): 5811692SN/A # normal processing for private attributes 5821692SN/A if attr.startswith('_'): 5831692SN/A object.__setattr__(self, attr, value) 5841692SN/A return 5851427SN/A 5862738SN/A if self._ports.has_key(attr): 5872738SN/A # set up port connection 5883105Sstever@eecs.umich.edu self._get_port_ref(attr).connect(value) 5892738SN/A return 5902738SN/A 5912740SN/A if isSimObjectOrSequence(value) and self._instantiated: 5922740SN/A raise RuntimeError, \ 5932740SN/A "cannot set SimObject parameter '%s' after\n" \ 5942740SN/A " instance been cloned %s" % (attr, `self`) 5952740SN/A 5961692SN/A # must be SimObject param 5973105Sstever@eecs.umich.edu param = self._params.get(attr) 5981692SN/A if param: 5991310SN/A try: 6001692SN/A value = param.convert(value) 6011587SN/A except Exception, e: 6021692SN/A msg = "%s\nError setting param %s.%s to %s\n" % \ 6031692SN/A (e, self.__class__.__name__, attr, value) 6041605SN/A e.args = (msg, ) 6051605SN/A raise 6063105Sstever@eecs.umich.edu self._set_child(attr, value) 6073105Sstever@eecs.umich.edu return 6081310SN/A 6093105Sstever@eecs.umich.edu if isSimObjectOrSequence(value): 6103105Sstever@eecs.umich.edu self._set_child(attr, value) 6113105Sstever@eecs.umich.edu return 6121693SN/A 6133105Sstever@eecs.umich.edu # no valid assignment... raise exception 6143105Sstever@eecs.umich.edu raise AttributeError, "Class %s has no parameter %s" \ 6153105Sstever@eecs.umich.edu % (self.__class__.__name__, attr) 6161310SN/A 6171310SN/A 6181692SN/A # this hack allows tacking a '[0]' onto parameters that may or may 6191692SN/A # not be vectors, and always getting the first element (e.g. cpus) 6201692SN/A def __getitem__(self, key): 6211692SN/A if key == 0: 6221692SN/A return self 6231692SN/A raise TypeError, "Non-zero index '%s' to SimObject" % key 6241310SN/A 6251693SN/A # clear out children with given name, even if it's a vector 6261693SN/A def clear_child(self, name): 6271693SN/A if not self._children.has_key(name): 6281693SN/A return 6291693SN/A child = self._children[name] 6301693SN/A if isinstance(child, SimObjVector): 6311693SN/A for i in xrange(len(child)): 6321693SN/A del self._children["s%d" % (name, i)] 6331693SN/A del self._children[name] 6341693SN/A 6351692SN/A def add_child(self, name, value): 6361692SN/A self._children[name] = value 6371310SN/A 6383105Sstever@eecs.umich.edu def _maybe_set_parent(self, parent, name): 6392740SN/A if not self._parent: 6401692SN/A self._parent = parent 6411692SN/A self._name = name 6421692SN/A parent.add_child(name, self) 6431310SN/A 6443105Sstever@eecs.umich.edu def _set_child(self, attr, value): 6453105Sstever@eecs.umich.edu # if RHS is a SimObject, it's an implicit child assignment 6463105Sstever@eecs.umich.edu # clear out old child with this name, if any 6473105Sstever@eecs.umich.edu self.clear_child(attr) 6483105Sstever@eecs.umich.edu 6493105Sstever@eecs.umich.edu if isSimObject(value): 6503105Sstever@eecs.umich.edu value._maybe_set_parent(self, attr) 6513105Sstever@eecs.umich.edu elif isSimObjectSequence(value): 6523105Sstever@eecs.umich.edu value = SimObjVector(value) 6534762Snate@binkert.org if len(value) == 1: 6544762Snate@binkert.org value[0]._maybe_set_parent(self, attr) 6554762Snate@binkert.org else: 6564762Snate@binkert.org for i,v in enumerate(value): 6574762Snate@binkert.org v._maybe_set_parent(self, "%s%d" % (attr, i)) 6583105Sstever@eecs.umich.edu 6593105Sstever@eecs.umich.edu self._values[attr] = value 6603105Sstever@eecs.umich.edu 6611692SN/A def path(self): 6622740SN/A if not self._parent: 6631692SN/A return 'root' 6641692SN/A ppath = self._parent.path() 6651692SN/A if ppath == 'root': 6661692SN/A return self._name 6671692SN/A return ppath + "." + self._name 6681310SN/A 6691692SN/A def __str__(self): 6701692SN/A return self.path() 6711310SN/A 6721692SN/A def ini_str(self): 6731692SN/A return self.path() 6741310SN/A 6751692SN/A def find_any(self, ptype): 6761692SN/A if isinstance(self, ptype): 6771692SN/A return self, True 6781310SN/A 6791692SN/A found_obj = None 6801692SN/A for child in self._children.itervalues(): 6811692SN/A if isinstance(child, ptype): 6821692SN/A if found_obj != None and child != found_obj: 6831692SN/A raise AttributeError, \ 6841692SN/A 'parent.any matched more than one: %s %s' % \ 6851814SN/A (found_obj.path, child.path) 6861692SN/A found_obj = child 6871692SN/A # search param space 6881692SN/A for pname,pdesc in self._params.iteritems(): 6891692SN/A if issubclass(pdesc.ptype, ptype): 6901692SN/A match_obj = self._values[pname] 6911692SN/A if found_obj != None and found_obj != match_obj: 6921692SN/A raise AttributeError, \ 6931692SN/A 'parent.any matched more than one: %s' % obj.path 6941692SN/A found_obj = match_obj 6951692SN/A return found_obj, found_obj != None 6961692SN/A 6971815SN/A def unproxy(self, base): 6981815SN/A return self 6991815SN/A 7003105Sstever@eecs.umich.edu def unproxy_all(self): 7013105Sstever@eecs.umich.edu for param in self._params.iterkeys(): 7023105Sstever@eecs.umich.edu value = self._values.get(param) 7033105Sstever@eecs.umich.edu if value != None and proxy.isproxy(value): 7043105Sstever@eecs.umich.edu try: 7053105Sstever@eecs.umich.edu value = value.unproxy(self) 7063105Sstever@eecs.umich.edu except: 7073105Sstever@eecs.umich.edu print "Error in unproxying param '%s' of %s" % \ 7083105Sstever@eecs.umich.edu (param, self.path()) 7093105Sstever@eecs.umich.edu raise 7103105Sstever@eecs.umich.edu setattr(self, param, value) 7113105Sstever@eecs.umich.edu 7123107Sstever@eecs.umich.edu # Unproxy ports in sorted order so that 'append' operations on 7133107Sstever@eecs.umich.edu # vector ports are done in a deterministic fashion. 7143107Sstever@eecs.umich.edu port_names = self._ports.keys() 7153107Sstever@eecs.umich.edu port_names.sort() 7163107Sstever@eecs.umich.edu for port_name in port_names: 7173105Sstever@eecs.umich.edu port = self._port_refs.get(port_name) 7183105Sstever@eecs.umich.edu if port != None: 7193105Sstever@eecs.umich.edu port.unproxy(self) 7203105Sstever@eecs.umich.edu 7213107Sstever@eecs.umich.edu # Unproxy children in sorted order for determinism also. 7223107Sstever@eecs.umich.edu child_names = self._children.keys() 7233107Sstever@eecs.umich.edu child_names.sort() 7243107Sstever@eecs.umich.edu for child in child_names: 7253107Sstever@eecs.umich.edu self._children[child].unproxy_all() 7263105Sstever@eecs.umich.edu 7275037Smilesck@eecs.umich.edu def print_ini(self, ini_file): 7285037Smilesck@eecs.umich.edu print >>ini_file, '[' + self.path() + ']' # .ini section header 7291692SN/A 7302738SN/A instanceDict[self.path()] = self 7312738SN/A 7324081Sbinkertn@umich.edu if hasattr(self, 'type'): 7335037Smilesck@eecs.umich.edu print >>ini_file, 'type=%s' % self.type 7341692SN/A 7351692SN/A child_names = self._children.keys() 7361692SN/A child_names.sort() 7374081Sbinkertn@umich.edu if len(child_names): 7385037Smilesck@eecs.umich.edu print >>ini_file, 'children=%s' % ' '.join(child_names) 7391692SN/A 7401692SN/A param_names = self._params.keys() 7411692SN/A param_names.sort() 7421692SN/A for param in param_names: 7433105Sstever@eecs.umich.edu value = self._values.get(param) 7441692SN/A if value != None: 7455037Smilesck@eecs.umich.edu print >>ini_file, '%s=%s' % (param, 7465037Smilesck@eecs.umich.edu self._values[param].ini_str()) 7471692SN/A 7483103Sstever@eecs.umich.edu port_names = self._ports.keys() 7493103Sstever@eecs.umich.edu port_names.sort() 7503103Sstever@eecs.umich.edu for port_name in port_names: 7513105Sstever@eecs.umich.edu port = self._port_refs.get(port_name, None) 7523105Sstever@eecs.umich.edu if port != None: 7535037Smilesck@eecs.umich.edu print >>ini_file, '%s=%s' % (port_name, port.ini_str()) 7543103Sstever@eecs.umich.edu 7555037Smilesck@eecs.umich.edu print >>ini_file # blank line between objects 7561692SN/A 7571692SN/A for child in child_names: 7585037Smilesck@eecs.umich.edu self._children[child].print_ini(ini_file) 7591692SN/A 7604762Snate@binkert.org def getCCParams(self): 7614762Snate@binkert.org if self._ccParams: 7624762Snate@binkert.org return self._ccParams 7634762Snate@binkert.org 7645033Smilesck@eecs.umich.edu cc_params_struct = getattr(m5.objects.params, '%sParams' % self.type) 7654762Snate@binkert.org cc_params = cc_params_struct() 7664762Snate@binkert.org cc_params.object = self 7674762Snate@binkert.org cc_params.name = str(self) 7684762Snate@binkert.org 7694762Snate@binkert.org param_names = self._params.keys() 7704762Snate@binkert.org param_names.sort() 7714762Snate@binkert.org for param in param_names: 7724762Snate@binkert.org value = self._values.get(param) 7734762Snate@binkert.org if value is None: 7744762Snate@binkert.org continue 7754762Snate@binkert.org 7764762Snate@binkert.org value = value.getValue() 7774762Snate@binkert.org if isinstance(self._params[param], VectorParamDesc): 7784762Snate@binkert.org assert isinstance(value, list) 7794762Snate@binkert.org vec = getattr(cc_params, param) 7804762Snate@binkert.org assert not len(vec) 7814762Snate@binkert.org for v in value: 7824762Snate@binkert.org vec.append(v) 7834762Snate@binkert.org else: 7844762Snate@binkert.org setattr(cc_params, param, value) 7854762Snate@binkert.org 7864762Snate@binkert.org port_names = self._ports.keys() 7874762Snate@binkert.org port_names.sort() 7884762Snate@binkert.org for port_name in port_names: 7894762Snate@binkert.org port = self._port_refs.get(port_name, None) 7904762Snate@binkert.org if port != None: 7914762Snate@binkert.org setattr(cc_params, port_name, port) 7924762Snate@binkert.org self._ccParams = cc_params 7934762Snate@binkert.org return self._ccParams 7942738SN/A 7952740SN/A # Get C++ object corresponding to this object, calling C++ if 7962740SN/A # necessary to construct it. Does *not* recursively create 7972740SN/A # children. 7982740SN/A def getCCObject(self): 7992740SN/A if not self._ccObject: 8005244Sgblack@eecs.umich.edu # Cycles in the configuration heirarchy are not supported. This 8015244Sgblack@eecs.umich.edu # will catch the resulting recursion and stop. 8025244Sgblack@eecs.umich.edu self._ccObject = -1 8035244Sgblack@eecs.umich.edu params = self.getCCParams() 8044762Snate@binkert.org self._ccObject = params.create() 8052740SN/A elif self._ccObject == -1: 8065244Sgblack@eecs.umich.edu raise RuntimeError, "%s: Cycle found in configuration heirarchy." \ 8072740SN/A % self.path() 8082740SN/A return self._ccObject 8092740SN/A 8104762Snate@binkert.org # Call C++ to create C++ object corresponding to this object and 8114762Snate@binkert.org # (recursively) all its children 8124762Snate@binkert.org def createCCObject(self): 8134762Snate@binkert.org self.getCCParams() 8144762Snate@binkert.org self.getCCObject() # force creation 8154762Snate@binkert.org for child in self._children.itervalues(): 8164762Snate@binkert.org child.createCCObject() 8174762Snate@binkert.org 8184762Snate@binkert.org def getValue(self): 8194762Snate@binkert.org return self.getCCObject() 8204762Snate@binkert.org 8212738SN/A # Create C++ port connections corresponding to the connections in 8223105Sstever@eecs.umich.edu # _port_refs (& recursively for all children) 8232738SN/A def connectPorts(self): 8243105Sstever@eecs.umich.edu for portRef in self._port_refs.itervalues(): 8253105Sstever@eecs.umich.edu portRef.ccConnect() 8262738SN/A for child in self._children.itervalues(): 8272738SN/A child.connectPorts() 8282738SN/A 8292839SN/A def startDrain(self, drain_event, recursive): 8302797SN/A count = 0 8314081Sbinkertn@umich.edu if isinstance(self, SimObject): 8322901SN/A count += self._ccObject.drain(drain_event) 8332797SN/A if recursive: 8342797SN/A for child in self._children.itervalues(): 8352839SN/A count += child.startDrain(drain_event, True) 8362797SN/A return count 8372797SN/A 8382797SN/A def resume(self): 8394081Sbinkertn@umich.edu if isinstance(self, SimObject): 8402797SN/A self._ccObject.resume() 8412797SN/A for child in self._children.itervalues(): 8422797SN/A child.resume() 8432797SN/A 8444553Sbinkertn@umich.edu def getMemoryMode(self): 8454553Sbinkertn@umich.edu if not isinstance(self, m5.objects.System): 8464553Sbinkertn@umich.edu return None 8474553Sbinkertn@umich.edu 8484859Snate@binkert.org return self._ccObject.getMemoryMode() 8494553Sbinkertn@umich.edu 8502797SN/A def changeTiming(self, mode): 8513202Shsul@eecs.umich.edu if isinstance(self, m5.objects.System): 8523202Shsul@eecs.umich.edu # i don't know if there's a better way to do this - calling 8533202Shsul@eecs.umich.edu # setMemoryMode directly from self._ccObject results in calling 8543202Shsul@eecs.umich.edu # SimObject::setMemoryMode, not the System::setMemoryMode 8554859Snate@binkert.org self._ccObject.setMemoryMode(mode) 8562797SN/A for child in self._children.itervalues(): 8572797SN/A child.changeTiming(mode) 8582797SN/A 8592797SN/A def takeOverFrom(self, old_cpu): 8604859Snate@binkert.org self._ccObject.takeOverFrom(old_cpu._ccObject) 8612797SN/A 8621692SN/A # generate output file for 'dot' to display as a pretty graph. 8631692SN/A # this code is currently broken. 8641342SN/A def outputDot(self, dot): 8651342SN/A label = "{%s|" % self.path 8661342SN/A if isSimObject(self.realtype): 8671342SN/A label += '%s|' % self.type 8681342SN/A 8691342SN/A if self.children: 8701342SN/A # instantiate children in same order they were added for 8711342SN/A # backward compatibility (else we can end up with cpu1 8721342SN/A # before cpu0). 8731342SN/A for c in self.children: 8741342SN/A dot.add_edge(pydot.Edge(self.path,c.path, style="bold")) 8751342SN/A 8761342SN/A simobjs = [] 8771342SN/A for param in self.params: 8781342SN/A try: 8791342SN/A if param.value is None: 8801342SN/A raise AttributeError, 'Parameter with no value' 8811342SN/A 8821692SN/A value = param.value 8831342SN/A string = param.string(value) 8841587SN/A except Exception, e: 8851605SN/A msg = 'exception in %s:%s\n%s' % (self.name, param.name, e) 8861605SN/A e.args = (msg, ) 8871342SN/A raise 8881605SN/A 8891692SN/A if isSimObject(param.ptype) and string != "Null": 8901342SN/A simobjs.append(string) 8911342SN/A else: 8921342SN/A label += '%s = %s\\n' % (param.name, string) 8931342SN/A 8941342SN/A for so in simobjs: 8951342SN/A label += "|<%s> %s" % (so, so) 8961587SN/A dot.add_edge(pydot.Edge("%s:%s" % (self.path, so), so, 8971587SN/A tailport="w")) 8981342SN/A label += '}' 8991342SN/A dot.add_node(pydot.Node(self.path,shape="Mrecord",label=label)) 9001342SN/A 9011342SN/A # recursively dump out children 9021342SN/A for c in self.children: 9031342SN/A c.outputDot(dot) 9041342SN/A 9053101Sstever@eecs.umich.edu# Function to provide to C++ so it can look up instances based on paths 9063101Sstever@eecs.umich.edudef resolveSimObject(name): 9073101Sstever@eecs.umich.edu obj = instanceDict[name] 9083101Sstever@eecs.umich.edu return obj.getCCObject() 909679SN/A 9101528SN/A# __all__ defines the list of symbols that get exported when 9111528SN/A# 'from config import *' is invoked. Try to keep this reasonably 9121528SN/A# short to avoid polluting other namespaces. 9134762Snate@binkert.org__all__ = [ 'SimObject' ] 914