Simulation.py (9129:b57966a6c512) Simulation.py (9139:ee038fbbe5d2)
1# Copyright (c) 2006-2008 The Regents of The University of Michigan
2# Copyright (c) 2010 Advanced Micro Devices, Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

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

33import m5
34from m5.defines import buildEnv
35from m5.objects import *
36from m5.util import *
37from O3_ARM_v7a import *
38
39addToPath('../common')
40
1# Copyright (c) 2006-2008 The Regents of The University of Michigan
2# Copyright (c) 2010 Advanced Micro Devices, Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

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

33import m5
34from m5.defines import buildEnv
35from m5.objects import *
36from m5.util import *
37from O3_ARM_v7a import *
38
39addToPath('../common')
40
41def getCPUClass(cpu_type):
42 """Returns the required cpu class and the mode of operation.
43 """
44
45 if cpu_type == "timing":
46 return TimingSimpleCPU, 'timing'
47 elif cpu_type == "detailed":
48 return DerivO3CPU, 'timing'
49 elif cpu_type == "arm_detailed":
50 return O3_ARM_v7a_3, 'timing'
51 elif cpu_type == "inorder":
52 return InOrderCPU, 'timing'
53 else:
54 return AtomicSimpleCPU, 'atomic'
55
41def setCPUClass(options):
56def setCPUClass(options):
57 """Returns two cpu classes and the initial mode of operation.
42
58
43 atomic = False
44 if options.cpu_type == "timing":
45 class TmpClass(TimingSimpleCPU): pass
46 elif options.cpu_type == "detailed" or options.cpu_type == "arm_detailed":
59 Restoring from a checkpoint or fast forwarding through a benchmark
60 can be done using one type of cpu, and then the actual
61 simulation can be carried out using another type. This function
62 returns these two types of cpus and the initial mode of operation
63 depending on the options provided.
64 """
65
66 if options.cpu_type == "detailed" or \
67 options.cpu_type == "arm_detailed" or \
68 options.cpu_type == "inorder" :
47 if not options.caches and not options.ruby:
69 if not options.caches and not options.ruby:
48 print "O3 CPU must be used with caches"
49 sys.exit(1)
50 if options.cpu_type == "arm_detailed":
51 class TmpClass(O3_ARM_v7a_3): pass
52 else:
53 class TmpClass(DerivO3CPU): pass
54 elif options.cpu_type == "inorder":
55 if not options.caches:
56 print "InOrder CPU must be used with caches"
57 sys.exit(1)
58 class TmpClass(InOrderCPU): pass
59 else:
60 class TmpClass(AtomicSimpleCPU): pass
61 atomic = True
70 fatal("O3/Inorder CPU must be used with caches")
62
71
72 TmpClass, test_mem_mode = getCPUClass(options.cpu_type)
63 CPUClass = None
73 CPUClass = None
64 test_mem_mode = 'atomic'
65
74
66 if not atomic:
67 if options.checkpoint_restore != None:
68 if options.restore_with_cpu != options.cpu_type:
69 CPUClass = TmpClass
70 class TmpClass(AtomicSimpleCPU): pass
71 else:
72 if options.restore_with_cpu != "atomic":
73 test_mem_mode = 'timing'
74
75 elif options.fast_forward:
75 if options.checkpoint_restore != None:
76 if options.restore_with_cpu != options.cpu_type:
76 CPUClass = TmpClass
77 CPUClass = TmpClass
77 class TmpClass(AtomicSimpleCPU): pass
78 else:
79 test_mem_mode = 'timing'
78 TmpClass, test_mem_mode = getCPUClass(options.restore_with_cpu)
79 elif options.fast_forward:
80 CPUClass = TmpClass
81 TmpClass = AtomicSimpleCPU
82 test_mem_mode = 'atomic'
80
81 return (TmpClass, test_mem_mode, CPUClass)
82
83def setWorkCountOptions(system, options):
84 if options.work_item_id != None:
85 system.work_item_id = options.work_item_id
86 if options.work_begin_cpu_id_exit != None:
87 system.work_begin_cpu_id_exit = options.work_begin_cpu_id_exit

--- 320 unchanged lines hidden ---
83
84 return (TmpClass, test_mem_mode, CPUClass)
85
86def setWorkCountOptions(system, options):
87 if options.work_item_id != None:
88 system.work_item_id = options.work_item_id
89 if options.work_begin_cpu_id_exit != None:
90 system.work_begin_cpu_id_exit = options.work_begin_cpu_id_exit

--- 320 unchanged lines hidden ---