SimObject.py revision 3102
1# Copyright (c) 2004-2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution;
11# neither the name of the copyright holders nor the names of its
12# contributors may be used to endorse or promote products derived from
13# this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Steve Reinhardt
28#          Nathan Binkert
29
30import sys, types
31
32from util import *
33from multidict import multidict
34
35# These utility functions have to come first because they're
36# referenced in params.py... otherwise they won't be defined when we
37# import params below, and the recursive import of this file from
38# params.py will not find these names.
39def isSimObject(value):
40    return isinstance(value, SimObject)
41
42def isSimObjectClass(value):
43    return issubclass(value, SimObject)
44
45def isSimObjectSequence(value):
46    if not isinstance(value, (list, tuple)) or len(value) == 0:
47        return False
48
49    for val in value:
50        if not isNullPointer(val) and not isSimObject(val):
51            return False
52
53    return True
54
55def isSimObjectOrSequence(value):
56    return isSimObject(value) or isSimObjectSequence(value)
57
58# Have to import params up top since Param is referenced on initial
59# load (when SimObject class references Param to create a class
60# variable, the 'name' param)...
61from params import *
62# There are a few things we need that aren't in params.__all__ since
63# normal users don't need them
64from params import ParamDesc, isNullPointer, SimObjVector
65
66noDot = False
67try:
68    import pydot
69except:
70    noDot = True
71
72#####################################################################
73#
74# M5 Python Configuration Utility
75#
76# The basic idea is to write simple Python programs that build Python
77# objects corresponding to M5 SimObjects for the desired simulation
78# configuration.  For now, the Python emits a .ini file that can be
79# parsed by M5.  In the future, some tighter integration between M5
80# and the Python interpreter may allow bypassing the .ini file.
81#
82# Each SimObject class in M5 is represented by a Python class with the
83# same name.  The Python inheritance tree mirrors the M5 C++ tree
84# (e.g., SimpleCPU derives from BaseCPU in both cases, and all
85# SimObjects inherit from a single SimObject base class).  To specify
86# an instance of an M5 SimObject in a configuration, the user simply
87# instantiates the corresponding Python object.  The parameters for
88# that SimObject are given by assigning to attributes of the Python
89# object, either using keyword assignment in the constructor or in
90# separate assignment statements.  For example:
91#
92# cache = BaseCache(size='64KB')
93# cache.hit_latency = 3
94# cache.assoc = 8
95#
96# The magic lies in the mapping of the Python attributes for SimObject
97# classes to the actual SimObject parameter specifications.  This
98# allows parameter validity checking in the Python code.  Continuing
99# the example above, the statements "cache.blurfl=3" or
100# "cache.assoc='hello'" would both result in runtime errors in Python,
101# since the BaseCache object has no 'blurfl' parameter and the 'assoc'
102# parameter requires an integer, respectively.  This magic is done
103# primarily by overriding the special __setattr__ method that controls
104# assignment to object attributes.
105#
106# Once a set of Python objects have been instantiated in a hierarchy,
107# calling 'instantiate(obj)' (where obj is the root of the hierarchy)
108# will generate a .ini file.
109#
110#####################################################################
111
112# dict to look up SimObjects based on path
113instanceDict = {}
114
115# The metaclass for SimObject.  This class controls how new classes
116# that derive from SimObject are instantiated, and provides inherited
117# class behavior (just like a class controls how instances of that
118# class are instantiated, and provides inherited instance behavior).
119class MetaSimObject(type):
120    # Attributes that can be set only at initialization time
121    init_keywords = { 'abstract' : types.BooleanType,
122                      'type' : types.StringType }
123    # Attributes that can be set any time
124    keywords = { 'check' : types.FunctionType,
125                 'cxx_type' : types.StringType,
126                 'cxx_predecls' : types.ListType,
127                 'swig_predecls' : types.ListType }
128
129    # __new__ is called before __init__, and is where the statements
130    # in the body of the class definition get loaded into the class's
131    # __dict__.  We intercept this to filter out parameter & port assignments
132    # and only allow "private" attributes to be passed to the base
133    # __new__ (starting with underscore).
134    def __new__(mcls, name, bases, dict):
135        # Copy "private" attributes, functions, and classes to the
136        # official dict.  Everything else goes in _init_dict to be
137        # filtered in __init__.
138        cls_dict = {}
139        value_dict = {}
140        for key,val in dict.items():
141            if key.startswith('_') or isinstance(val, (types.FunctionType,
142                                                       types.TypeType)):
143                cls_dict[key] = val
144            else:
145                # must be a param/port setting
146                value_dict[key] = val
147        cls_dict['_value_dict'] = value_dict
148        return super(MetaSimObject, mcls).__new__(mcls, name, bases, cls_dict)
149
150    # subclass initialization
151    def __init__(cls, name, bases, dict):
152        # calls type.__init__()... I think that's a no-op, but leave
153        # it here just in case it's not.
154        super(MetaSimObject, cls).__init__(name, bases, dict)
155
156        # initialize required attributes
157
158        # class-only attributes
159        cls._params = multidict() # param descriptions
160        cls._ports = multidict()  # port descriptions
161
162        # class or instance attributes
163        cls._values = multidict()   # param values
164        cls._port_map = multidict() # port bindings
165        cls._instantiated = False # really instantiated, cloned, or subclassed
166
167        # We don't support multiple inheritance.  If you want to, you
168        # must fix multidict to deal with it properly.
169        if len(bases) > 1:
170            raise TypeError, "SimObjects do not support multiple inheritance"
171
172        base = bases[0]
173
174        # Set up general inheritance via multidicts.  A subclass will
175        # inherit all its settings from the base class.  The only time
176        # the following is not true is when we define the SimObject
177        # class itself (in which case the multidicts have no parent).
178        if isinstance(base, MetaSimObject):
179            cls._params.parent = base._params
180            cls._ports.parent = base._ports
181            cls._values.parent = base._values
182            cls._port_map.parent = base._port_map
183            # mark base as having been subclassed
184            base._instantiated = True
185
186        # Now process the _value_dict items.  They could be defining
187        # new (or overriding existing) parameters or ports, setting
188        # class keywords (e.g., 'abstract'), or setting parameter
189        # values or port bindings.  The first 3 can only be set when
190        # the class is defined, so we handle them here.  The others
191        # can be set later too, so just emulate that by calling
192        # setattr().
193        for key,val in cls._value_dict.items():
194            # param descriptions
195            if isinstance(val, ParamDesc):
196                cls._new_param(key, val)
197
198            # port objects
199            elif isinstance(val, Port):
200                cls._ports[key] = val
201
202            # init-time-only keywords
203            elif cls.init_keywords.has_key(key):
204                cls._set_keyword(key, val, cls.init_keywords[key])
205
206            # default: use normal path (ends up in __setattr__)
207            else:
208                setattr(cls, key, val)
209
210        cls.cxx_type = cls.type + '*'
211        # A forward class declaration is sufficient since we are just
212        # declaring a pointer.
213        cls.cxx_predecls = ['class %s;' % cls.type]
214        cls.swig_predecls = cls.cxx_predecls
215
216    def _set_keyword(cls, keyword, val, kwtype):
217        if not isinstance(val, kwtype):
218            raise TypeError, 'keyword %s has bad type %s (expecting %s)' % \
219                  (keyword, type(val), kwtype)
220        if isinstance(val, types.FunctionType):
221            val = classmethod(val)
222        type.__setattr__(cls, keyword, val)
223
224    def _new_param(cls, name, pdesc):
225        # each param desc should be uniquely assigned to one variable
226        assert(not hasattr(pdesc, 'name'))
227        pdesc.name = name
228        cls._params[name] = pdesc
229        if hasattr(pdesc, 'default'):
230            setattr(cls, name, pdesc.default)
231
232    # Set attribute (called on foo.attr = value when foo is an
233    # instance of class cls).
234    def __setattr__(cls, attr, value):
235        # normal processing for private attributes
236        if attr.startswith('_'):
237            type.__setattr__(cls, attr, value)
238            return
239
240        if cls.keywords.has_key(attr):
241            cls._set_keyword(attr, value, cls.keywords[attr])
242            return
243
244        if cls._ports.has_key(attr):
245            self._ports[attr].connect(self, attr, value)
246            return
247
248        if isSimObjectOrSequence(value) and cls._instantiated:
249            raise RuntimeError, \
250                  "cannot set SimObject parameter '%s' after\n" \
251                  "    class %s has been instantiated or subclassed" \
252                  % (attr, cls.__name__)
253
254        # check for param
255        param = cls._params.get(attr, None)
256        if param:
257            try:
258                cls._values[attr] = param.convert(value)
259            except Exception, e:
260                msg = "%s\nError setting param %s.%s to %s\n" % \
261                      (e, cls.__name__, attr, value)
262                e.args = (msg, )
263                raise
264        elif isSimObjectOrSequence(value):
265            # if RHS is a SimObject, it's an implicit child assignment
266            cls._values[attr] = value
267        else:
268            raise AttributeError, \
269                  "Class %s has no parameter \'%s\'" % (cls.__name__, attr)
270
271    def __getattr__(cls, attr):
272        if cls._values.has_key(attr):
273            return cls._values[attr]
274
275        raise AttributeError, \
276              "object '%s' has no attribute '%s'" % (cls.__name__, attr)
277
278    def __str__(cls):
279        return cls.__name__
280
281    def cxx_decl(cls):
282        code = "#ifndef __PARAMS__%s\n#define __PARAMS__%s\n\n" % (cls, cls)
283
284        if str(cls) != 'SimObject':
285            base = cls.__bases__[0].type
286        else:
287            base = None
288
289        # The 'dict' attribute restricts us to the params declared in
290        # the object itself, not including inherited params (which
291        # will also be inherited from the base class's param struct
292        # here).
293        params = cls._params.dict.values()
294        try:
295            ptypes = [p.ptype for p in params]
296        except:
297            print cls, p, p.ptype_str
298            print params
299            raise
300
301        # get a list of lists of predeclaration lines
302        predecls = [p.cxx_predecls() for p in params]
303        # flatten
304        predecls = reduce(lambda x,y:x+y, predecls, [])
305        # remove redundant lines
306        predecls2 = []
307        for pd in predecls:
308            if pd not in predecls2:
309                predecls2.append(pd)
310        predecls2.sort()
311        code += "\n".join(predecls2)
312        code += "\n\n";
313
314        if base:
315            code += '#include "params/%s.hh"\n\n' % base
316
317        # Generate declarations for locally defined enumerations.
318        enum_ptypes = [t for t in ptypes if issubclass(t, Enum)]
319        if enum_ptypes:
320            code += "\n".join([t.cxx_decl() for t in enum_ptypes])
321            code += "\n\n"
322
323        # now generate the actual param struct
324        code += "struct %sParams" % cls
325        if base:
326            code += " : public %sParams" % base
327        code += " {\n"
328        decls = [p.cxx_decl() for p in params]
329        decls.sort()
330        code += "".join(["    %s\n" % d for d in decls])
331        code += "};\n"
332
333        # close #ifndef __PARAMS__* guard
334        code += "\n#endif\n"
335        return code
336
337    def swig_decl(cls):
338
339        code = '%%module %sParams\n' % cls
340
341        if str(cls) != 'SimObject':
342            base = cls.__bases__[0].type
343        else:
344            base = None
345
346        # The 'dict' attribute restricts us to the params declared in
347        # the object itself, not including inherited params (which
348        # will also be inherited from the base class's param struct
349        # here).
350        params = cls._params.dict.values()
351        ptypes = [p.ptype for p in params]
352
353        # get a list of lists of predeclaration lines
354        predecls = [p.swig_predecls() for p in params]
355        # flatten
356        predecls = reduce(lambda x,y:x+y, predecls, [])
357        # remove redundant lines
358        predecls2 = []
359        for pd in predecls:
360            if pd not in predecls2:
361                predecls2.append(pd)
362        predecls2.sort()
363        code += "\n".join(predecls2)
364        code += "\n\n";
365
366        if base:
367            code += '%%import "python/m5/swig/%sParams.i"\n\n' % base
368
369        code += '%{\n'
370        code += '#include "params/%s.hh"\n' % cls
371        code += '%}\n\n'
372        code += '%%include "params/%s.hh"\n\n' % cls
373
374        return code
375
376# The SimObject class is the root of the special hierarchy.  Most of
377# the code in this class deals with the configuration hierarchy itself
378# (parent/child node relationships).
379class SimObject(object):
380    # Specify metaclass.  Any class inheriting from SimObject will
381    # get this metaclass.
382    __metaclass__ = MetaSimObject
383    type = 'SimObject'
384
385    name = Param.String("Object name")
386
387    # Initialize new instance.  For objects with SimObject-valued
388    # children, we need to recursively clone the classes represented
389    # by those param values as well in a consistent "deep copy"-style
390    # fashion.  That is, we want to make sure that each instance is
391    # cloned only once, and that if there are multiple references to
392    # the same original object, we end up with the corresponding
393    # cloned references all pointing to the same cloned instance.
394    def __init__(self, **kwargs):
395        ancestor = kwargs.get('_ancestor')
396        memo_dict = kwargs.get('_memo')
397        if memo_dict is None:
398            # prepare to memoize any recursively instantiated objects
399            memo_dict = {}
400        elif ancestor:
401            # memoize me now to avoid problems with recursive calls
402            memo_dict[ancestor] = self
403
404        if not ancestor:
405            ancestor = self.__class__
406        ancestor._instantiated = True
407
408        # initialize required attributes
409        self._parent = None
410        self._children = {}
411        self._ccObject = None  # pointer to C++ object
412        self._instantiated = False # really "cloned"
413
414        # Inherit parameter values from class using multidict so
415        # individual value settings can be overridden.
416        self._values = multidict(ancestor._values)
417        # clone SimObject-valued parameters
418        for key,val in ancestor._values.iteritems():
419            if isSimObject(val):
420                setattr(self, key, val(_memo=memo_dict))
421            elif isSimObjectSequence(val) and len(val):
422                setattr(self, key, [ v(_memo=memo_dict) for v in val ])
423        # clone port references.  no need to use a multidict here
424        # since we will be creating new references for all ports.
425        self._port_map = {}
426        for key,val in ancestor._port_map.iteritems():
427            self._port_map[key] = applyOrMap(val, 'clone', memo_dict)
428        # apply attribute assignments from keyword args, if any
429        for key,val in kwargs.iteritems():
430            setattr(self, key, val)
431
432    # "Clone" the current instance by creating another instance of
433    # this instance's class, but that inherits its parameter values
434    # and port mappings from the current instance.  If we're in a
435    # "deep copy" recursive clone, check the _memo dict to see if
436    # we've already cloned this instance.
437    def __call__(self, **kwargs):
438        memo_dict = kwargs.get('_memo')
439        if memo_dict is None:
440            # no memo_dict: must be top-level clone operation.
441            # this is only allowed at the root of a hierarchy
442            if self._parent:
443                raise RuntimeError, "attempt to clone object %s " \
444                      "not at the root of a tree (parent = %s)" \
445                      % (self, self._parent)
446            # create a new dict and use that.
447            memo_dict = {}
448            kwargs['_memo'] = memo_dict
449        elif memo_dict.has_key(self):
450            # clone already done & memoized
451            return memo_dict[self]
452        return self.__class__(_ancestor = self, **kwargs)
453
454    def __getattr__(self, attr):
455        if self._ports.has_key(attr):
456            # return reference that can be assigned to another port
457            # via __setattr__
458            return self._ports[attr].makeRef(self, attr)
459
460        if self._values.has_key(attr):
461            return self._values[attr]
462
463        raise AttributeError, "object '%s' has no attribute '%s'" \
464              % (self.__class__.__name__, attr)
465
466    # Set attribute (called on foo.attr = value when foo is an
467    # instance of class cls).
468    def __setattr__(self, attr, value):
469        # normal processing for private attributes
470        if attr.startswith('_'):
471            object.__setattr__(self, attr, value)
472            return
473
474        if self._ports.has_key(attr):
475            # set up port connection
476            self._ports[attr].connect(self, attr, value)
477            return
478
479        if isSimObjectOrSequence(value) and self._instantiated:
480            raise RuntimeError, \
481                  "cannot set SimObject parameter '%s' after\n" \
482                  "    instance been cloned %s" % (attr, `self`)
483
484        # must be SimObject param
485        param = self._params.get(attr, None)
486        if param:
487            try:
488                value = param.convert(value)
489            except Exception, e:
490                msg = "%s\nError setting param %s.%s to %s\n" % \
491                      (e, self.__class__.__name__, attr, value)
492                e.args = (msg, )
493                raise
494        elif isSimObjectOrSequence(value):
495            pass
496        else:
497            raise AttributeError, "Class %s has no parameter %s" \
498                  % (self.__class__.__name__, attr)
499
500        # clear out old child with this name, if any
501        self.clear_child(attr)
502
503        if isSimObject(value):
504            value.set_path(self, attr)
505        elif isSimObjectSequence(value):
506            value = SimObjVector(value)
507            [v.set_path(self, "%s%d" % (attr, i)) for i,v in enumerate(value)]
508
509        self._values[attr] = value
510
511    # this hack allows tacking a '[0]' onto parameters that may or may
512    # not be vectors, and always getting the first element (e.g. cpus)
513    def __getitem__(self, key):
514        if key == 0:
515            return self
516        raise TypeError, "Non-zero index '%s' to SimObject" % key
517
518    # clear out children with given name, even if it's a vector
519    def clear_child(self, name):
520        if not self._children.has_key(name):
521            return
522        child = self._children[name]
523        if isinstance(child, SimObjVector):
524            for i in xrange(len(child)):
525                del self._children["s%d" % (name, i)]
526        del self._children[name]
527
528    def add_child(self, name, value):
529        self._children[name] = value
530
531    def set_path(self, parent, name):
532        if not self._parent:
533            self._parent = parent
534            self._name = name
535            parent.add_child(name, self)
536
537    def path(self):
538        if not self._parent:
539            return 'root'
540        ppath = self._parent.path()
541        if ppath == 'root':
542            return self._name
543        return ppath + "." + self._name
544
545    def __str__(self):
546        return self.path()
547
548    def ini_str(self):
549        return self.path()
550
551    def find_any(self, ptype):
552        if isinstance(self, ptype):
553            return self, True
554
555        found_obj = None
556        for child in self._children.itervalues():
557            if isinstance(child, ptype):
558                if found_obj != None and child != found_obj:
559                    raise AttributeError, \
560                          'parent.any matched more than one: %s %s' % \
561                          (found_obj.path, child.path)
562                found_obj = child
563        # search param space
564        for pname,pdesc in self._params.iteritems():
565            if issubclass(pdesc.ptype, ptype):
566                match_obj = self._values[pname]
567                if found_obj != None and found_obj != match_obj:
568                    raise AttributeError, \
569                          'parent.any matched more than one: %s' % obj.path
570                found_obj = match_obj
571        return found_obj, found_obj != None
572
573    def unproxy(self, base):
574        return self
575
576    def print_ini(self):
577        print '[' + self.path() + ']'	# .ini section header
578
579        instanceDict[self.path()] = self
580
581        if hasattr(self, 'type') and not isinstance(self, ParamContext):
582            print 'type=%s' % self.type
583
584        child_names = self._children.keys()
585        child_names.sort()
586        np_child_names = [c for c in child_names \
587                          if not isinstance(self._children[c], ParamContext)]
588        if len(np_child_names):
589            print 'children=%s' % ' '.join(np_child_names)
590
591        param_names = self._params.keys()
592        param_names.sort()
593        for param in param_names:
594            value = self._values.get(param, None)
595            if value != None:
596                if proxy.isproxy(value):
597                    try:
598                        value = value.unproxy(self)
599                    except:
600                        print >> sys.stderr, \
601                              "Error in unproxying param '%s' of %s" % \
602                              (param, self.path())
603                        raise
604                    setattr(self, param, value)
605                print '%s=%s' % (param, self._values[param].ini_str())
606
607        print	# blank line between objects
608
609        for child in child_names:
610            self._children[child].print_ini()
611
612    # Call C++ to create C++ object corresponding to this object and
613    # (recursively) all its children
614    def createCCObject(self):
615        self.getCCObject() # force creation
616        for child in self._children.itervalues():
617            child.createCCObject()
618
619    # Get C++ object corresponding to this object, calling C++ if
620    # necessary to construct it.  Does *not* recursively create
621    # children.
622    def getCCObject(self):
623        if not self._ccObject:
624            self._ccObject = -1 # flag to catch cycles in recursion
625            self._ccObject = cc_main.createSimObject(self.path())
626        elif self._ccObject == -1:
627            raise RuntimeError, "%s: recursive call to getCCObject()" \
628                  % self.path()
629        return self._ccObject
630
631    # Create C++ port connections corresponding to the connections in
632    # _port_map (& recursively for all children)
633    def connectPorts(self):
634        for portRef in self._port_map.itervalues():
635            applyOrMap(portRef, 'ccConnect')
636        for child in self._children.itervalues():
637            child.connectPorts()
638
639    def startDrain(self, drain_event, recursive):
640        count = 0
641        # ParamContexts don't serialize
642        if isinstance(self, SimObject) and not isinstance(self, ParamContext):
643            count += self._ccObject.drain(drain_event)
644        if recursive:
645            for child in self._children.itervalues():
646                count += child.startDrain(drain_event, True)
647        return count
648
649    def resume(self):
650        if isinstance(self, SimObject) and not isinstance(self, ParamContext):
651            self._ccObject.resume()
652        for child in self._children.itervalues():
653            child.resume()
654
655    def changeTiming(self, mode):
656        if isinstance(self, System):
657            self._ccObject.setMemoryMode(mode)
658        for child in self._children.itervalues():
659            child.changeTiming(mode)
660
661    def takeOverFrom(self, old_cpu):
662        cpu_ptr = cc_main.convertToBaseCPUPtr(old_cpu._ccObject)
663        self._ccObject.takeOverFrom(cpu_ptr)
664
665    # generate output file for 'dot' to display as a pretty graph.
666    # this code is currently broken.
667    def outputDot(self, dot):
668        label = "{%s|" % self.path
669        if isSimObject(self.realtype):
670            label +=  '%s|' % self.type
671
672        if self.children:
673            # instantiate children in same order they were added for
674            # backward compatibility (else we can end up with cpu1
675            # before cpu0).
676            for c in self.children:
677                dot.add_edge(pydot.Edge(self.path,c.path, style="bold"))
678
679        simobjs = []
680        for param in self.params:
681            try:
682                if param.value is None:
683                    raise AttributeError, 'Parameter with no value'
684
685                value = param.value
686                string = param.string(value)
687            except Exception, e:
688                msg = 'exception in %s:%s\n%s' % (self.name, param.name, e)
689                e.args = (msg, )
690                raise
691
692            if isSimObject(param.ptype) and string != "Null":
693                simobjs.append(string)
694            else:
695                label += '%s = %s\\n' % (param.name, string)
696
697        for so in simobjs:
698            label += "|<%s> %s" % (so, so)
699            dot.add_edge(pydot.Edge("%s:%s" % (self.path, so), so,
700                                    tailport="w"))
701        label += '}'
702        dot.add_node(pydot.Node(self.path,shape="Mrecord",label=label))
703
704        # recursively dump out children
705        for c in self.children:
706            c.outputDot(dot)
707
708class ParamContext(SimObject):
709    pass
710
711# Function to provide to C++ so it can look up instances based on paths
712def resolveSimObject(name):
713    obj = instanceDict[name]
714    return obj.getCCObject()
715
716# __all__ defines the list of symbols that get exported when
717# 'from config import *' is invoked.  Try to keep this reasonably
718# short to avoid polluting other namespaces.
719__all__ = ['SimObject', 'ParamContext']
720
721
722# see comment on imports at end of __init__.py.
723import proxy
724import cc_main
725