Deleted Added
sdiff udiff text old ( 3101:6cce868ddaa6 ) new ( 3102:225b76c8ac68 )
full compact
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

--- 15 unchanged lines hidden (view full) ---

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
32import m5
33from m5 import panic, cc_main
34from convert import *
35from multidict import multidict
36
37noDot = False
38try:
39 import pydot
40except:
41 noDot = True
42
43#####################################################################
44#

--- 514 unchanged lines hidden (view full) ---

559 if len(np_child_names):
560 print 'children=%s' % ' '.join(np_child_names)
561
562 param_names = self._params.keys()
563 param_names.sort()
564 for param in param_names:
565 value = self._values.get(param, None)
566 if value != None:
567 if isproxy(value):
568 try:
569 value = value.unproxy(self)
570 except:
571 print >> sys.stderr, \
572 "Error in unproxying param '%s' of %s" % \
573 (param, self.path())
574 raise
575 setattr(self, param, value)

--- 98 unchanged lines hidden (view full) ---

674
675 # recursively dump out children
676 for c in self.children:
677 c.outputDot(dot)
678
679class ParamContext(SimObject):
680 pass
681
682# Special class for NULL pointers. Note the special check in
683# make_param_value() above that lets these be assigned where a
684# SimObject is required.
685# only one copy of a particular node
686class NullSimObject(object):
687 __metaclass__ = Singleton
688
689 def __call__(cls):
690 return cls
691
692 def _instantiate(self, parent = None, path = ''):
693 pass
694
695 def ini_str(self):
696 return 'Null'
697
698 def unproxy(self, base):
699 return self
700
701 def set_path(self, parent, name):
702 pass
703 def __str__(self):
704 return 'Null'
705
706# The only instance you'll ever need...
707Null = NULL = NullSimObject()
708
709def isSimObject(value):
710 return isinstance(value, SimObject)
711
712def isNullPointer(value):
713 return isinstance(value, NullSimObject)
714
715def isSimObjectSequence(value):
716 if not isinstance(value, (list, tuple)) or len(value) == 0:
717 return False
718
719 for val in value:
720 if not isNullPointer(val) and not isSimObject(val):
721 return False
722
723 return True
724
725def isSimObjectOrSequence(value):
726 return isSimObject(value) or isSimObjectSequence(value)
727
728# Function to provide to C++ so it can look up instances based on paths
729def resolveSimObject(name):
730 obj = instanceDict[name]
731 return obj.getCCObject()
732
733# __all__ defines the list of symbols that get exported when
734# 'from config import *' is invoked. Try to keep this reasonably
735# short to avoid polluting other namespaces.
736__all__ = ['SimObject', 'ParamContext']
737