summaryrefslogtreecommitdiff
path: root/configs/common/Options.py
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-02-15 17:40:08 -0500
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-02-15 17:40:08 -0500
commite9f66dceac5ce2665001f9f74222964ef0aef74b (patch)
tree0c7ac355e9cfe1772676a76f2db8a8a61a59ec95 /configs/common/Options.py
parent7f1263f1446b789e9f88685ae763ba575e81e454 (diff)
downloadgem5-e9f66dceac5ce2665001f9f74222964ef0aef74b.tar.xz
config: Cleanup CPU configuration
The CPUs supported by the configuration scripts used to be hard-coded. This was not ideal for several reasons. For example, the configuration scripts depend on all CPU models even though only a subset might have been compiled. This changeset adds a new module to the configuration scripts that automatically discovers the available CPU models from the compiled SimObjects. As a nice bonus, the use of introspection allows us to automatically generate a list of available CPU models suitable for printing. This list is augmented with the Python doc string from the underlying class if available.
Diffstat (limited to 'configs/common/Options.py')
-rw-r--r--configs/common/Options.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/configs/common/Options.py b/configs/common/Options.py
index 794addb6a..63951950f 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -31,11 +31,19 @@ from m5.defines import buildEnv
from m5.objects import *
from Benchmarks import *
+import CpuConfig
+
+def _listCpuTypes(option, opt, value, parser):
+ CpuConfig.print_cpu_list()
+ sys.exit(0)
+
def addCommonOptions(parser):
# system options
+ parser.add_option("--list-cpu-types",
+ action="callback", callback=_listCpuTypes,
+ help="List available CPU types")
parser.add_option("--cpu-type", type="choice", default="atomic",
- choices = ["atomic", "timing", "detailed", "inorder",
- "arm_detailed"],
+ choices=CpuConfig.cpu_names(),
help = "type of cpu to run with")
parser.add_option("--checker", action="store_true");
parser.add_option("-n", "--num-cpus", type="int", default=1)