Deleted Added
sdiff udiff text old ( 9430:a113f27b68bd ) new ( 9521:1cd02decbfd3 )
full compact
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

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

55from m5.internal.stats import updateEvents as updateStatEvents
56
57from util import fatal
58from util import attrdict
59
60# define a MaxTick parameter
61MaxTick = 2**63 - 1
62
63# The final hook to generate .ini files. Called from the user script
64# once the config is built.
65def instantiate(ckpt_dir=None):
66 from m5 import options
67
68 root = objects.Root.getInstance()
69
70 if not root:

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

197 if not isinstance(root, objects.Root):
198 raise TypeError, "Checkpoint must be called on a root object."
199 drain(root)
200 memWriteback(root)
201 print "Writing checkpoint"
202 internal.core.serializeAll(dir)
203 resume(root)
204
205def changeMemoryMode(system, mode):
206 if not isinstance(system, (objects.Root, objects.System)):
207 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
208 (type(system), objects.Root, objects.System)
209 if system.getMemoryMode() != mode:
210 drain(system)
211 system.setMemoryMode(mode)
212 else:
213 print "System already in target mode. Memory mode unchanged."
214
215def changeToAtomic(system, **kwargs):
216 print "Changing memory mode to atomic"
217 changeMemoryMode(system, objects.params.atomic, **kwargs)
218
219def changeToTiming(system, **kwargs):
220 print "Changing memory mode to timing"
221 changeMemoryMode(system, objects.params.timing, **kwargs)
222
223def switchCpus(cpuList):
224 print "switching cpus"
225 if not isinstance(cpuList, list):
226 raise RuntimeError, "Must pass a list to this function"
227 for item in cpuList:
228 if not isinstance(item, tuple) or len(item) != 2:
229 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"
230
231 old_cpu_set = set([old_cpu for old_cpu, new_cpu in cpuList])
232 for old_cpu, new_cpu in cpuList:
233 if not isinstance(old_cpu, objects.BaseCPU):
234 raise TypeError, "%s is not of type BaseCPU" % old_cpu
235 if not isinstance(new_cpu, objects.BaseCPU):
236 raise TypeError, "%s is not of type BaseCPU" % new_cpu
237 if new_cpu in old_cpu_set:
238 raise RuntimeError, \
239 "New CPU (%s) is in the list of old CPUs." % (old_cpu,)
240 if not new_cpu.switchedOut():
241 raise RuntimeError, \
242 "New CPU (%s) is already active." % (new_cpu,)
243 if old_cpu.switchedOut():
244 raise RuntimeError, \
245 "Old CPU (%s) is inactive." % (new_cpu,)
246
247 # Now all of the CPUs are ready to be switched out
248 for old_cpu, new_cpu in cpuList:
249 old_cpu.switchOut()
250
251 for old_cpu, new_cpu in cpuList:
252 new_cpu.takeOverFrom(old_cpu)
253
254from internal.core import disableAllListeners