Ciro Santilli has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12985

Change subject: main: add --param to set SimObject params on CLI
......................................................................

main: add --param to set SimObject params on CLI

The existing config scripts have a large number of options that simply set
a single SimObject parameter, and many still are not exposed.

This commit allows users to pass arbitrary parameters from the command
line to prevent the need for this kind of trivial option.

Change-Id: Ic4bd36948aca4998d2eaf6369c85d3668efa3944
---
M src/python/m5/main.py
M src/python/m5/simulate.py
2 files changed, 10 insertions(+), 1 deletion(-)



diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index 9d46d43..7686ee9 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -117,6 +117,13 @@
     option("--dot-dvfs-config", metavar="FILE", default=None,
         help="Create DOT & pdf outputs of the DVFS configuration" + \
              " [Default: %default]")
+    option("-P", "--param", action="append", default=[],
+        help="Set a SimObject parameter. Python slicing can be used for " \
+             "arrays. Example: " \
+             "'system.cpu[0,1,3:8:2].max_insts_all_threads = 42' " \
+             "sets max_insts_all_threads for cpus 0, 1, 3, 5 and 7 " \
+             "Direct parameters of the root object are not accessible, "
+             "only parameters of its children.")

     # Debugging options
     group("Debugging Options")
diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py
index 0e1a67e..9f6f2c5 100644
--- a/src/python/m5/simulate.py
+++ b/src/python/m5/simulate.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2012 ARM Limited
+# Copyright (c) 2012, 2018 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -81,6 +81,8 @@
     if not root:
         fatal("Need to instantiate Root() before calling instantiate()")

+    root.apply_config(options.param)
+
     # we need to fix the global frequency
     ticks.fixGlobalFrequency()


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12985
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ic4bd36948aca4998d2eaf6369c85d3668efa3944
Gerrit-Change-Number: 12985
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli <ciro.santi...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to