diff options
author | Nathan Binkert <nate@binkert.org> | 2008-06-14 20:39:31 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2008-06-14 20:39:31 -0700 |
commit | 3d2e7797ccb554092a4140fc8e11407edd7eedc4 (patch) | |
tree | efb6c499914cf1cfe18529971d3fe75306dd2022 /src | |
parent | f82d4e2364e9df683b6891c04efaa861093a50ec (diff) | |
download | gem5-3d2e7797ccb554092a4140fc8e11407edd7eedc4.tar.xz |
params: Fix floating point parameters
Diffstat (limited to 'src')
-rw-r--r-- | src/python/m5/params.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py index a895549ca..c8d0d8f46 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -379,6 +379,13 @@ class Percent(CheckedInt): cxx_type = 'int'; min = 0; max = 100 class Float(ParamValue, float): cxx_type = 'double' + def __init__(self, value): + if isinstance(value, (int, long, float, NumericParamValue, Float)): + self.value = float(value) + else: + raise TypeError, "Can't convert object of type %s to Float" \ + % type(value).__name__ + def getValue(self): return float(self.value) @@ -895,7 +902,9 @@ class MemoryBandwidth(float,ParamValue): def getValue(self): # convert to seconds per byte - value = 1.0 / float(self) + value = float(self) + if value: + value = 1.0 / float(self) # convert to ticks per byte value = ticks.fromSeconds(value) return float(value) |