summaryrefslogtreecommitdiff
path: root/src/python/m5/params.py
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2006-12-15 13:27:53 -0500
committerLisa Hsu <hsul@eecs.umich.edu>2006-12-15 13:27:53 -0500
commit991146218de5c0019fa6f97ef0f9742f1105ccb3 (patch)
tree194d336cdf736a7972c7fe4b36803a45d48a9a62 /src/python/m5/params.py
parent573d59441e420f02fd7cf3e31158258f5eee3ab1 (diff)
parenta10eff03a529ef79ac9481188cdaf01b269efe16 (diff)
downloadgem5-991146218de5c0019fa6f97ef0f9742f1105ccb3.tar.xz
Merge zizzer:/bk/sparcfs
into zed.eecs.umich.edu:/z/hsul/work/sparc/m5 --HG-- extra : convert_revision : 2f11b5f9fa6356cbf9f98c8cd7d4f6fbfaf9d24d
Diffstat (limited to 'src/python/m5/params.py')
-rw-r--r--src/python/m5/params.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 9e5f985c3..d83d5f73f 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -237,6 +237,12 @@ class NumericParamValue(ParamValue):
def __float__(self):
return float(self.value)
+ def __long__(self):
+ return long(self.value)
+
+ def __int__(self):
+ return int(self.value)
+
# hook for bounds checking
def _check(self):
return
@@ -308,8 +314,11 @@ class CheckedInt(NumericParamValue):
def __init__(self, value):
if isinstance(value, str):
self.value = convert.toInteger(value)
- elif isinstance(value, (int, long, float)):
+ elif isinstance(value, (int, long, float, NumericParamValue)):
self.value = long(value)
+ else:
+ raise TypeError, "Can't convert object of type %s to CheckedInt" \
+ % type(value).__name__
self._check()
class Int(CheckedInt): cxx_type = 'int'; size = 32; unsigned = False