SimObject.py (3624:aaba7e06ece4) SimObject.py (4081:80f1e833d118)
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

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

648 for child in child_names:
649 self._children[child].unproxy_all()
650
651 def print_ini(self):
652 print '[' + self.path() + ']' # .ini section header
653
654 instanceDict[self.path()] = self
655
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

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

648 for child in child_names:
649 self._children[child].unproxy_all()
650
651 def print_ini(self):
652 print '[' + self.path() + ']' # .ini section header
653
654 instanceDict[self.path()] = self
655
656 if hasattr(self, 'type') and not isinstance(self, ParamContext):
656 if hasattr(self, 'type'):
657 print 'type=%s' % self.type
658
659 child_names = self._children.keys()
660 child_names.sort()
657 print 'type=%s' % self.type
658
659 child_names = self._children.keys()
660 child_names.sort()
661 np_child_names = [c for c in child_names \
662 if not isinstance(self._children[c], ParamContext)]
663 if len(np_child_names):
664 print 'children=%s' % ' '.join(np_child_names)
661 if len(child_names):
662 print 'children=%s' % ' '.join(child_names)
665
666 param_names = self._params.keys()
667 param_names.sort()
668 for param in param_names:
669 value = self._values.get(param)
670 if value != None:
671 print '%s=%s' % (param, self._values[param].ini_str())
672

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

706 def connectPorts(self):
707 for portRef in self._port_refs.itervalues():
708 portRef.ccConnect()
709 for child in self._children.itervalues():
710 child.connectPorts()
711
712 def startDrain(self, drain_event, recursive):
713 count = 0
663
664 param_names = self._params.keys()
665 param_names.sort()
666 for param in param_names:
667 value = self._values.get(param)
668 if value != None:
669 print '%s=%s' % (param, self._values[param].ini_str())
670

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

704 def connectPorts(self):
705 for portRef in self._port_refs.itervalues():
706 portRef.ccConnect()
707 for child in self._children.itervalues():
708 child.connectPorts()
709
710 def startDrain(self, drain_event, recursive):
711 count = 0
714 # ParamContexts don't serialize
715 if isinstance(self, SimObject) and not isinstance(self, ParamContext):
712 if isinstance(self, SimObject):
716 count += self._ccObject.drain(drain_event)
717 if recursive:
718 for child in self._children.itervalues():
719 count += child.startDrain(drain_event, True)
720 return count
721
722 def resume(self):
713 count += self._ccObject.drain(drain_event)
714 if recursive:
715 for child in self._children.itervalues():
716 count += child.startDrain(drain_event, True)
717 return count
718
719 def resume(self):
723 if isinstance(self, SimObject) and not isinstance(self, ParamContext):
720 if isinstance(self, SimObject):
724 self._ccObject.resume()
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

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

777 tailport="w"))
778 label += '}'
779 dot.add_node(pydot.Node(self.path,shape="Mrecord",label=label))
780
781 # recursively dump out children
782 for c in self.children:
783 c.outputDot(dot)
784
721 self._ccObject.resume()
722 for child in self._children.itervalues():
723 child.resume()
724
725 def changeTiming(self, mode):
726 if isinstance(self, m5.objects.System):
727 # i don't know if there's a better way to do this - calling
728 # setMemoryMode directly from self._ccObject results in calling

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

774 tailport="w"))
775 label += '}'
776 dot.add_node(pydot.Node(self.path,shape="Mrecord",label=label))
777
778 # recursively dump out children
779 for c in self.children:
780 c.outputDot(dot)
781
785class ParamContext(SimObject):
786 pass
787
788# Function to provide to C++ so it can look up instances based on paths
789def resolveSimObject(name):
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.
782# Function to provide to C++ so it can look up instances based on paths
783def resolveSimObject(name):
784 obj = instanceDict[name]
785 return obj.getCCObject()
786
787# __all__ defines the list of symbols that get exported when
788# 'from config import *' is invoked. Try to keep this reasonably
789# short to avoid polluting other namespaces.
796__all__ = ['SimObject', 'ParamContext']
790__all__ = ['SimObject']
797
798# see comment on imports at end of __init__.py.
799import proxy
800import internal
801import m5
791
792# see comment on imports at end of __init__.py.
793import proxy
794import internal
795import m5