simulate.py (4851:af527e8042bd) simulate.py (4859:97c7749896a6)
1# Copyright (c) 2005 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

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

54 # Initialize the global statistics
55 internal.stats.initSimStats()
56
57 # Create the C++ sim objects and connect ports
58 root.createCCObject()
59 root.connectPorts()
60
61 # Do a second pass to finish initializing the sim objects
1# Copyright (c) 2005 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

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

54 # Initialize the global statistics
55 internal.stats.initSimStats()
56
57 # Create the C++ sim objects and connect ports
58 root.createCCObject()
59 root.connectPorts()
60
61 # Do a second pass to finish initializing the sim objects
62 internal.sim_object.initAll()
62 internal.core.initAll()
63
64 # Do a third pass to initialize statistics
63
64 # Do a third pass to initialize statistics
65 internal.sim_object.regAllStats()
65 internal.core.regAllStats()
66
67 # Check to make sure that the stats package is properly initialized
68 internal.stats.check()
69
70 # Reset to put the stats in a consistent state.
71 internal.stats.reset()
72
73def doDot(root):

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

131def resume(root):
132 root.resume()
133
134def checkpoint(root, dir):
135 if not isinstance(root, objects.Root):
136 raise TypeError, "Checkpoint must be called on a root object."
137 doDrain(root)
138 print "Writing checkpoint"
66
67 # Check to make sure that the stats package is properly initialized
68 internal.stats.check()
69
70 # Reset to put the stats in a consistent state.
71 internal.stats.reset()
72
73def doDot(root):

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

131def resume(root):
132 root.resume()
133
134def checkpoint(root, dir):
135 if not isinstance(root, objects.Root):
136 raise TypeError, "Checkpoint must be called on a root object."
137 doDrain(root)
138 print "Writing checkpoint"
139 internal.sim_object.serializeAll(dir)
139 internal.core.serializeAll(dir)
140 resume(root)
141
142def restoreCheckpoint(root, dir):
143 print "Restoring from checkpoint"
140 resume(root)
141
142def restoreCheckpoint(root, dir):
143 print "Restoring from checkpoint"
144 internal.sim_object.unserializeAll(dir)
144 internal.core.unserializeAll(dir)
145 need_resume.append(root)
146
147def changeToAtomic(system):
148 if not isinstance(system, (objects.Root, objects.System)):
149 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
150 (type(system), objects.Root, objects.System)
145 need_resume.append(root)
146
147def changeToAtomic(system):
148 if not isinstance(system, (objects.Root, objects.System)):
149 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
150 (type(system), objects.Root, objects.System)
151 if system.getMemoryMode() != internal.sim_object.SimObject.Atomic:
151 if system.getMemoryMode() != objects.params.SimObject.Atomic:
152 doDrain(system)
153 print "Changing memory mode to atomic"
152 doDrain(system)
153 print "Changing memory mode to atomic"
154 system.changeTiming(internal.sim_object.SimObject.Atomic)
154 system.changeTiming(objects.params.SimObject.Atomic)
155
156def changeToTiming(system):
157 if not isinstance(system, (objects.Root, objects.System)):
158 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
159 (type(system), objects.Root, objects.System)
160
155
156def changeToTiming(system):
157 if not isinstance(system, (objects.Root, objects.System)):
158 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
159 (type(system), objects.Root, objects.System)
160
161 if system.getMemoryMode() != internal.sim_object.SimObject.Timing:
161 if system.getMemoryMode() != objects.params.SimObject.Timing:
162 doDrain(system)
163 print "Changing memory mode to timing"
162 doDrain(system)
163 print "Changing memory mode to timing"
164 system.changeTiming(internal.sim_object.SimObject.Timing)
164 system.changeTiming(objects.params.SimObject.Timing)
165
166def switchCpus(cpuList):
167 print "switching cpus"
168 if not isinstance(cpuList, list):
169 raise RuntimeError, "Must pass a list to this function"
170 for i in cpuList:
171 if not isinstance(i, tuple):
172 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"

--- 28 unchanged lines hidden ---
165
166def switchCpus(cpuList):
167 print "switching cpus"
168 if not isinstance(cpuList, list):
169 raise RuntimeError, "Must pass a list to this function"
170 for i in cpuList:
171 if not isinstance(i, tuple):
172 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"

--- 28 unchanged lines hidden ---