Andreas Sandberg has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/16000 )

Change subject: python: Fix param -> int conversion issues
......................................................................

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 <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/16000
Reviewed-by: Nikos Nikoleris <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
---
M src/cpu/BaseCPU.py
M src/python/m5/params.py
2 files changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved



diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py
index 60c86a4..93cb6e0 100644
--- a/src/cpu/BaseCPU.py
+++ b/src/cpu/BaseCPU.py
@@ -365,7 +365,7 @@
                 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 729fc12..1470765 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -606,6 +606,9 @@
         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

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16000
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: I2de6c9906d3bb7616f12ada6728b9e4b1928511c
Gerrit-Change-Number: 16000
Gerrit-PatchSet: 9
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Ciro Santilli <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Juha Jäykkä <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to