Config: Add an option of type 'choice' for cpu type
authorNilay Vaish <nilay@cs.wisc.edu>
Thu, 5 Jan 2012 17:04:25 +0000 (11:04 -0600)
committerNilay Vaish <nilay@cs.wisc.edu>
Thu, 5 Jan 2012 17:04:25 +0000 (11:04 -0600)
This patch adds a new option for cpu type. This option is of type 'choice'
which is similar to a C++ enum, except that it takes string values as
possible choices. Following options are being removed -- detailed, timing,
inorder.

--HG--
extra : rebase_source : 58885e2e8a88b6af8e6ff884a5922059dbb1a6cb

configs/common/Options.py
configs/common/Simulation.py
configs/example/se.py

index e69f3a52783cf199af2eae1aface0e1e16cfa998..d5ea85090e32bd5b89a0810297d01e017b6a747a 100644 (file)
@@ -27,9 +27,9 @@
 # Authors: Lisa Hsu
 
 # system options
-parser.add_option("-d", "--detailed", action="store_true")
-parser.add_option("-t", "--timing", action="store_true")
-parser.add_option("--inorder", action="store_true")
+parser.add_option("-c", "--cpu-type", type="choice", default="atomic",
+                  choices = ["atomic", "timing", "detailed", "inorder"],
+                  help = "type of cpu to run with")
 parser.add_option("-n", "--num-cpus", type="int", default=1)
 parser.add_option("--caches", action="store_true")
 parser.add_option("--l2cache", action="store_true")
index 7abf478da3cd1faef8e2962b135e82d0b903d2c2..1897fa8cbc3185eac77807e2ffc9fdc29437e8e3 100644 (file)
@@ -40,14 +40,14 @@ addToPath('../common')
 def setCPUClass(options):
 
     atomic = False
-    if options.timing:
+    if options.cpu_type == "timing":
         class TmpClass(TimingSimpleCPU): pass
-    elif options.detailed:
+    elif options.cpu_type == "detailed":
         if not options.caches:
             print "O3 CPU must be used with caches"
             sys.exit(1)
         class TmpClass(DerivO3CPU): pass
-    elif options.inorder:
+    elif options.cpu_type == "inorder":
         if not options.caches:
             print "InOrder CPU must be used with caches"
             sys.exit(1)
index a34a03b29fe919ab5ed7cc249d764ba0a6473c75..56737d6d57a1c1e094af23adeeaa363c4db90f79 100644 (file)
@@ -122,7 +122,7 @@ if options.errout != "":
 workloads = options.cmd
 numThreads = 1
 
-if options.detailed or options.inorder:
+if options.cpu_type == "detailed" or options.cpu_type == "inorder":
     #check for SMT workload
     workloads = options.cmd.split(';')
     if len(workloads) > 1:
@@ -154,10 +154,10 @@ if options.detailed or options.inorder:
     numThreads = len(workloads)
     
 if options.ruby:
-    if options.detailed:
+    if options.cpu_type == "detailed":
         print >> sys.stderr, "Ruby only works with TimingSimpleCPU!!"
         sys.exit(1)
-    elif not options.timing:
+    elif not options.cpu_type == "timing":
         print >> sys.stderr, "****WARN:  using Timing CPU since it's needed by Ruby"
 
     class CPUClass(TimingSimpleCPU): pass