simulate.py (9811:52567889c9fc) simulate.py (9980:cc02ad629b36)
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

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

213 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
214 (type(system), objects.Root, objects.System)
215 if system.getMemoryMode() != mode:
216 drain(system)
217 system.setMemoryMode(mode)
218 else:
219 print "System already in target mode. Memory mode unchanged."
220
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

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

213 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \
214 (type(system), objects.Root, objects.System)
215 if system.getMemoryMode() != mode:
216 drain(system)
217 system.setMemoryMode(mode)
218 else:
219 print "System already in target mode. Memory mode unchanged."
220
221def switchCpus(system, cpuList, do_drain=True):
221def switchCpus(system, cpuList, do_drain=True, verbose=True):
222 """Switch CPUs in a system.
223
224 By default, this method drains and resumes the system. This
225 behavior can be disabled by setting the keyword argument
226 'do_drain' to false, which might be desirable if multiple
227 operations requiring a drained system are going to be performed in
228 sequence.
229
230 Note: This method may switch the memory mode of the system if that
231 is required by the CPUs. It may also flush all caches in the
232 system.
233
234 Arguments:
235 system -- Simulated system.
236 cpuList -- (old_cpu, new_cpu) tuples
237
238 Keyword Arguments:
239 do_drain -- Perform a drain/resume of the system when switching.
240 """
222 """Switch CPUs in a system.
223
224 By default, this method drains and resumes the system. This
225 behavior can be disabled by setting the keyword argument
226 'do_drain' to false, which might be desirable if multiple
227 operations requiring a drained system are going to be performed in
228 sequence.
229
230 Note: This method may switch the memory mode of the system if that
231 is required by the CPUs. It may also flush all caches in the
232 system.
233
234 Arguments:
235 system -- Simulated system.
236 cpuList -- (old_cpu, new_cpu) tuples
237
238 Keyword Arguments:
239 do_drain -- Perform a drain/resume of the system when switching.
240 """
241 print "switching cpus"
241
242 if verbose:
243 print "switching cpus"
244
242 if not isinstance(cpuList, list):
243 raise RuntimeError, "Must pass a list to this function"
244 for item in cpuList:
245 if not isinstance(item, tuple) or len(item) != 2:
246 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"
247
248 old_cpus = [old_cpu for old_cpu, new_cpu in cpuList]
249 new_cpus = [new_cpu for old_cpu, new_cpu in cpuList]

--- 58 unchanged lines hidden ---
245 if not isinstance(cpuList, list):
246 raise RuntimeError, "Must pass a list to this function"
247 for item in cpuList:
248 if not isinstance(item, tuple) or len(item) != 2:
249 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"
250
251 old_cpus = [old_cpu for old_cpu, new_cpu in cpuList]
252 new_cpus = [new_cpu for old_cpu, new_cpu in cpuList]

--- 58 unchanged lines hidden ---