Meatboy 106 has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/53424 )

Change subject: python: Do not convert bandwidth parameters to int
......................................................................

python: Do not convert bandwidth parameters to int

NetworkBandwidth and MemoryBandwidth parameters do not convert to int and back
to float anymore to avoid rounding errors for high bandwidth values. C++
parameter type now is double to enable higher precision.

Related Jira: https://gem5.atlassian.net/browse/GEM5-1118

Change-Id: I99c86be81d5c10094d3f015669cef0144b2e51e0
---
M src/python/m5/params.py
1 file changed, 21 insertions(+), 6 deletions(-)



diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 9a8e041..1c19123 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -1760,7 +1760,7 @@
         code('%s _ret;' % ret)

 class NetworkBandwidth(float,ParamValue):
-    cxx_type = 'float'
+    cxx_type = 'double'
     ex_str = "1Gbps"
     cmd_line_settable = True

@@ -1781,8 +1781,8 @@
         # convert to seconds per byte
         value = 8.0 / float(self)
         # convert to ticks per byte
-        value = toint(ticks.fromSeconds(value))
-        return float(value)
+        value = ticks.fromSeconds(value)
+        return value

     def ini_str(self):
         return '%f' % self.getValue()
@@ -1799,7 +1799,7 @@
         code('%s (std::istringstream(%s) >> %s).eof();' % (ret, src, dest))

 class MemoryBandwidth(float,ParamValue):
-    cxx_type = 'float'
+    cxx_type = 'double'
     ex_str = "1GiB/s"
     cmd_line_settable = True

@@ -1819,8 +1819,8 @@
         if value:
             value = 1.0 / float(self)
         # convert to ticks per byte
-        value = toint(ticks.fromSeconds(value))
-        return float(value)
+        value = ticks.fromSeconds(value)
+        return value

     def ini_str(self):
         return '%f' % self.getValue()

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

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I99c86be81d5c10094d3f015669cef0144b2e51e0
Gerrit-Change-Number: 53424
Gerrit-PatchSet: 1
Gerrit-Owner: Meatboy 106 <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to