summaryrefslogtreecommitdiff
path: root/src/python/m5/SimObject.py
diff options
context:
space:
mode:
authorAndrew Bardsley <Andrew.Bardsley@arm.com>2014-09-20 17:17:42 -0400
committerAndrew Bardsley <Andrew.Bardsley@arm.com>2014-09-20 17:17:42 -0400
commit7329c0e20ba2c78f57dd53e90246ccbe3efa158d (patch)
tree06dbea7c6630c57b1884131316b9b69204345c16 /src/python/m5/SimObject.py
parent41fc8a573ea61b2463606a0714a9e563494da329 (diff)
downloadgem5-7329c0e20ba2c78f57dd53e90246ccbe3efa158d.tar.xz
config: Cleanup .json config file generation
This patch 'completes' .json config files generation by adding in the SimObject references and String-valued parameters not currently printed. TickParamValues are also changed to print in the same tick-value format as in .ini files. This allows .json files to describe a system as fully as the .ini files currently do. This patch adds a new function config_value (which mirrors ini_str) to each ParamValue and to SimObject. This function can then be explicitly changed to give different .json and .ini printing behaviour rather than being written in terms of ini_str.
Diffstat (limited to 'src/python/m5/SimObject.py')
-rw-r--r--src/python/m5/SimObject.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 81923ac7c..9f4c2c155 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -955,6 +955,9 @@ class SimObject(object):
def __str__(self):
return self.path()
+ def config_value(self):
+ return self.path()
+
def ini_str(self):
return self.path()
@@ -1077,18 +1080,7 @@ class SimObject(object):
for param in sorted(self._params.keys()):
value = self._values.get(param)
if value != None:
- try:
- # Use native type for those supported by JSON and
- # strings for everything else. skipkeys=True seems
- # to not work as well as one would hope
- if type(self._values[param].value) in \
- [str, unicode, int, long, float, bool, None]:
- d[param] = self._values[param].value
- else:
- d[param] = str(self._values[param])
-
- except AttributeError:
- pass
+ d[param] = value.config_value()
for n in sorted(self._children.keys()):
child = self._children[n]