diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2019-01-27 09:31:31 +0000 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2019-02-22 15:26:41 +0000 |
commit | 5de8626abc9aca4dbae5b81b819475945a2736c8 (patch) | |
tree | 968a645aae1501dafeb50b110477b1d85974e9e4 | |
parent | 397d322b9952d264a99f025b026936aa7c2ed9cc (diff) | |
download | gem5-5de8626abc9aca4dbae5b81b819475945a2736c8.tar.xz |
python: Fix param -> int conversion issues
Python 3 doesn't convert params to integers automatically in
range(). Add __index__ to CheckedInt to enable implicit conversions
again. Add explicit conversions where necessary.
Change-Id: I2de6c9906d3bb7616f12ada6728b9e4b1928511c
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/16000
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
-rw-r--r-- | src/cpu/BaseCPU.py | 2 | ||||
-rw-r--r-- | src/python/m5/params.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py index 60c86a44f..93cb6e071 100644 --- a/src/cpu/BaseCPU.py +++ b/src/cpu/BaseCPU.py @@ -365,7 +365,7 @@ class BaseCPU(MemObject): warn("Platform not found for device tree generation; " \ "system or multiple CPUs may not start") - freq = round(self.clk_domain.unproxy(self).clock[0].frequency) + freq = int(self.clk_domain.unproxy(self).clock[0].frequency) node.append(FdtPropertyWords("clock-frequency", freq)) # Unique key for this CPU diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 729fc1242..1470765bb 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -606,6 +606,9 @@ class CheckedInt(NumericParamValue): self.__init__(value) return value + def __index__(self): + return int(self.value) + @classmethod def cxx_predecls(cls, code): # most derived types require this, so we just do it here once |