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 --- 153 unchanged lines hidden (view full) --- 162 doDrain(system) 163 print "Changing memory mode to timing" 164 system.changeTiming(objects.params.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 item in cpuList: 171 if not isinstance(item, tuple) or len(item) != 2: |
172 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)" 173 |
174 for old_cpu, new_cpu in cpuList: 175 if not isinstance(old_cpu, objects.BaseCPU): 176 raise TypeError, "%s is not of type BaseCPU" % old_cpu 177 if not isinstance(new_cpu, objects.BaseCPU): 178 raise TypeError, "%s is not of type BaseCPU" % new_cpu |
179 |
180 # Now all of the CPUs are ready to be switched out |
181 for old_cpu, new_cpu in cpuList: |
182 old_cpu._ccObject.switchOut() |
183 184 for old_cpu, new_cpu in cpuList: 185 new_cpu.takeOverFrom(old_cpu) |