simulate.py (9342:6fec8f26e56d) simulate.py (9343:e63c6f279906)
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

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

187 root = objects.Root.getInstance()
188 if not isinstance(root, objects.Root):
189 raise TypeError, "Checkpoint must be called on a root object."
190 doDrain(root)
191 print "Writing checkpoint"
192 internal.core.serializeAll(dir)
193 resume(root)
194
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

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

187 root = objects.Root.getInstance()
188 if not isinstance(root, objects.Root):
189 raise TypeError, "Checkpoint must be called on a root object."
190 doDrain(root)
191 print "Writing checkpoint"
192 internal.core.serializeAll(dir)
193 resume(root)
194
195def changeToAtomic(system):
195def changeMemoryMode(system, mode):
196 if not isinstance(system, (objects.Root, objects.System)):
197 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
198 (type(system), objects.Root, objects.System)
196 if not isinstance(system, (objects.Root, objects.System)):
197 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
198 (type(system), objects.Root, objects.System)
199 if system.getMemoryMode() != objects.params.atomic:
199 if system.getMemoryMode() != mode:
200 doDrain(system)
200 doDrain(system)
201 print "Changing memory mode to atomic"
202 system.setMemoryMode(objects.params.atomic)
201 system.setMemoryMode(mode)
202 else:
203 print "System already in target mode. Memory mode unchanged."
203
204
204def changeToTiming(system):
205 if not isinstance(system, (objects.Root, objects.System)):
206 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
207 (type(system), objects.Root, objects.System)
205def changeToAtomic(system, **kwargs):
206 print "Changing memory mode to atomic"
207 changeMemoryMode(system, objects.params.atomic, **kwargs)
208
208
209 if system.getMemoryMode() != objects.params.timing:
210 doDrain(system)
211 print "Changing memory mode to timing"
212 system.setMemoryMode(objects.params.timing)
209def changeToTiming(system, **kwargs):
210 print "Changing memory mode to timing"
211 changeMemoryMode(system, objects.params.timing, **kwargs)
213
214def switchCpus(cpuList):
215 print "switching cpus"
216 if not isinstance(cpuList, list):
217 raise RuntimeError, "Must pass a list to this function"
218 for item in cpuList:
219 if not isinstance(item, tuple) or len(item) != 2:
220 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"

--- 15 unchanged lines hidden ---
212
213def switchCpus(cpuList):
214 print "switching cpus"
215 if not isinstance(cpuList, list):
216 raise RuntimeError, "Must pass a list to this function"
217 for item in cpuList:
218 if not isinstance(item, tuple) or len(item) != 2:
219 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"

--- 15 unchanged lines hidden ---