sim: Fix Temperature class

* Adding __str__ method: To fix its printing on config.ini
(Replacing <m5.params.Temperature> with the Temperature value)

* Replacing "fromKelvin" with from_kelvin
(that's how pybind exports it)

* Fixing config_value to allow JSON serialization
(JIRA: https://gem5.atlassian.net/browse/GEM5-951)

Change-Id: I1aaea9c9df6466a5cbed0a29c5937243796948d2
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44167
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2021-04-07 11:36:38 +01:00
parent 291bc67ef1
commit 6cb9c3e87f

View File

@@ -1707,12 +1707,15 @@ class Temperature(ParamValue):
self.__init__(value)
return value
def __str__(self):
return str(self.value)
def getValue(self):
from _m5.core import Temperature
return Temperature.fromKelvin(self.value)
return Temperature.from_kelvin(self.value)
def config_value(self):
return self
return self.value
@classmethod
def cxx_predecls(cls, code):