diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-08-06 18:14:31 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-08-06 18:14:31 -0500 |
commit | d81a51a4c8ee0eb081f87865970426524e89111e (patch) | |
tree | a226ae1d49e4aff978e8e321aec3a254c52b72e1 /configs | |
parent | 6721b3e325139fb4ace99d858f0bdec44ec6af1b (diff) | |
download | gem5-d81a51a4c8ee0eb081f87865970426524e89111e.tar.xz |
Config: change how cpu class is set
This changes the way in which the cpu class while restoring from a checkpoint
is set. Earlier it was assumed if cpu type with which to restore is not same
as the cpu type with the which to run the simulation, then the checkpoint
should be restored with the atomic cpu. This assumption is being dropped. The
checkpoint can now be restored with any cpu type, the default being atomic cpu.
Diffstat (limited to 'configs')
-rw-r--r-- | configs/common/Simulation.py | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py index 2ba691ed0..7d2ba6735 100644 --- a/configs/common/Simulation.py +++ b/configs/common/Simulation.py @@ -38,45 +38,48 @@ from O3_ARM_v7a import * addToPath('../common') -def setCPUClass(options): +def getCPUClass(cpu_type): + """Returns the required cpu class and the mode of operation. + """ + + if cpu_type == "timing": + return TimingSimpleCPU, 'timing' + elif cpu_type == "detailed": + return DerivO3CPU, 'timing' + elif cpu_type == "arm_detailed": + return O3_ARM_v7a_3, 'timing' + elif cpu_type == "inorder": + return InOrderCPU, 'timing' + else: + return AtomicSimpleCPU, 'atomic' - atomic = False - if options.cpu_type == "timing": - class TmpClass(TimingSimpleCPU): pass - elif options.cpu_type == "detailed" or options.cpu_type == "arm_detailed": +def setCPUClass(options): + """Returns two cpu classes and the initial mode of operation. + + Restoring from a checkpoint or fast forwarding through a benchmark + can be done using one type of cpu, and then the actual + simulation can be carried out using another type. This function + returns these two types of cpus and the initial mode of operation + depending on the options provided. + """ + + if options.cpu_type == "detailed" or \ + options.cpu_type == "arm_detailed" or \ + options.cpu_type == "inorder" : if not options.caches and not options.ruby: - print "O3 CPU must be used with caches" - sys.exit(1) - if options.cpu_type == "arm_detailed": - class TmpClass(O3_ARM_v7a_3): pass - else: - class TmpClass(DerivO3CPU): pass - elif options.cpu_type == "inorder": - if not options.caches: - print "InOrder CPU must be used with caches" - sys.exit(1) - class TmpClass(InOrderCPU): pass - else: - class TmpClass(AtomicSimpleCPU): pass - atomic = True + fatal("O3/Inorder CPU must be used with caches") + TmpClass, test_mem_mode = getCPUClass(options.cpu_type) CPUClass = None - test_mem_mode = 'atomic' - - if not atomic: - if options.checkpoint_restore != None: - if options.restore_with_cpu != options.cpu_type: - CPUClass = TmpClass - class TmpClass(AtomicSimpleCPU): pass - else: - if options.restore_with_cpu != "atomic": - test_mem_mode = 'timing' - elif options.fast_forward: + if options.checkpoint_restore != None: + if options.restore_with_cpu != options.cpu_type: CPUClass = TmpClass - class TmpClass(AtomicSimpleCPU): pass - else: - test_mem_mode = 'timing' + TmpClass, test_mem_mode = getCPUClass(options.restore_with_cpu) + elif options.fast_forward: + CPUClass = TmpClass + TmpClass = AtomicSimpleCPU + test_mem_mode = 'atomic' return (TmpClass, test_mem_mode, CPUClass) |