SimObject.py (3321:d9080c4da915) SimObject.py (3624:aaba7e06ece4)
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

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

690 child.createCCObject()
691
692 # Get C++ object corresponding to this object, calling C++ if
693 # necessary to construct it. Does *not* recursively create
694 # children.
695 def getCCObject(self):
696 if not self._ccObject:
697 self._ccObject = -1 # flag to catch cycles in recursion
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

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

690 child.createCCObject()
691
692 # Get C++ object corresponding to this object, calling C++ if
693 # necessary to construct it. Does *not* recursively create
694 # children.
695 def getCCObject(self):
696 if not self._ccObject:
697 self._ccObject = -1 # flag to catch cycles in recursion
698 self._ccObject = cc_main.createSimObject(self.path())
698 self._ccObject = internal.main.createSimObject(self.path())
699 elif self._ccObject == -1:
700 raise RuntimeError, "%s: recursive call to getCCObject()" \
701 % self.path()
702 return self._ccObject
703
704 # Create C++ port connections corresponding to the connections in
705 # _port_refs (& recursively for all children)
706 def connectPorts(self):

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

725 for child in self._children.itervalues():
726 child.resume()
727
728 def changeTiming(self, mode):
729 if isinstance(self, m5.objects.System):
730 # i don't know if there's a better way to do this - calling
731 # setMemoryMode directly from self._ccObject results in calling
732 # SimObject::setMemoryMode, not the System::setMemoryMode
699 elif self._ccObject == -1:
700 raise RuntimeError, "%s: recursive call to getCCObject()" \
701 % self.path()
702 return self._ccObject
703
704 # Create C++ port connections corresponding to the connections in
705 # _port_refs (& recursively for all children)
706 def connectPorts(self):

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

725 for child in self._children.itervalues():
726 child.resume()
727
728 def changeTiming(self, mode):
729 if isinstance(self, m5.objects.System):
730 # i don't know if there's a better way to do this - calling
731 # setMemoryMode directly from self._ccObject results in calling
732 # SimObject::setMemoryMode, not the System::setMemoryMode
733 system_ptr = cc_main.convertToSystemPtr(self._ccObject)
733 system_ptr = internal.main.convertToSystemPtr(self._ccObject)
734 system_ptr.setMemoryMode(mode)
735 for child in self._children.itervalues():
736 child.changeTiming(mode)
737
738 def takeOverFrom(self, old_cpu):
734 system_ptr.setMemoryMode(mode)
735 for child in self._children.itervalues():
736 child.changeTiming(mode)
737
738 def takeOverFrom(self, old_cpu):
739 cpu_ptr = cc_main.convertToBaseCPUPtr(old_cpu._ccObject)
739 cpu_ptr = internal.main.convertToBaseCPUPtr(old_cpu._ccObject)
740 self._ccObject.takeOverFrom(cpu_ptr)
741
742 # generate output file for 'dot' to display as a pretty graph.
743 # this code is currently broken.
744 def outputDot(self, dot):
745 label = "{%s|" % self.path
746 if isSimObject(self.realtype):
747 label += '%s|' % self.type

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

790 obj = instanceDict[name]
791 return obj.getCCObject()
792
793# __all__ defines the list of symbols that get exported when
794# 'from config import *' is invoked. Try to keep this reasonably
795# short to avoid polluting other namespaces.
796__all__ = ['SimObject', 'ParamContext']
797
740 self._ccObject.takeOverFrom(cpu_ptr)
741
742 # generate output file for 'dot' to display as a pretty graph.
743 # this code is currently broken.
744 def outputDot(self, dot):
745 label = "{%s|" % self.path
746 if isSimObject(self.realtype):
747 label += '%s|' % self.type

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

790 obj = instanceDict[name]
791 return obj.getCCObject()
792
793# __all__ defines the list of symbols that get exported when
794# 'from config import *' is invoked. Try to keep this reasonably
795# short to avoid polluting other namespaces.
796__all__ = ['SimObject', 'ParamContext']
797
798
799# see comment on imports at end of __init__.py.
800import proxy
798# see comment on imports at end of __init__.py.
799import proxy
801import cc_main
800import internal
802import m5
801import m5