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

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

756 self._ccParams = cc_params
757 return self._ccParams
758
759 # Get C++ object corresponding to this object, calling C++ if
760 # necessary to construct it. Does *not* recursively create
761 # children.
762 def getCCObject(self):
763 if not self._ccObject:
764 # Cycles in the configuration heirarchy are not supported. This
764 # Make sure this object is in the configuration hierarchy
765 if not self._parent and not isRoot(self):
766 raise RuntimeError, "Attempt to instantiate orphan node"
767 # Cycles in the configuration hierarchy are not supported. This
768 # will catch the resulting recursion and stop.
769 self._ccObject = -1
770 params = self.getCCParams()
771 self._ccObject = params.create()
772 elif self._ccObject == -1:
770 raise RuntimeError, "%s: Cycle found in configuration heirarchy." \
773 raise RuntimeError, "%s: Cycle found in configuration hierarchy." \
774 % self.path()
775 return self._ccObject
776
777 # Call C++ to create C++ object corresponding to this object and
778 # (recursively) all its children
779 def createCCObject(self):
780 self.getCCParams()
781 self.getCCObject() # force creation

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

888 if not isNullPointer(val) and not isSimObject(val):
889 return False
890
891 return True
892
893def isSimObjectOrSequence(value):
894 return isSimObject(value) or isSimObjectSequence(value)
895
896def isRoot(obj):
897 from m5.objects import Root
898 return obj and obj is Root.getInstance()
899
900baseClasses = allClasses.copy()
901baseInstances = instanceDict.copy()
902
903def clear():
904 global allClasses, instanceDict
905
906 allClasses = baseClasses.copy()
907 instanceDict = baseInstances.copy()
908
909# __all__ defines the list of symbols that get exported when
910# 'from config import *' is invoked. Try to keep this reasonably
911# short to avoid polluting other namespaces.
912__all__ = [ 'SimObject' ]