summaryrefslogtreecommitdiff
path: root/src/python/m5/params.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/m5/params.py')
-rw-r--r--src/python/m5/params.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 6c4a61d6a..f16cabaff 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -1485,6 +1485,31 @@ class Voltage(float,ParamValue):
def ini_str(self):
return '%f' % self.getValue()
+class Current(float, ParamValue):
+ cxx_type = 'double'
+ ex_str = "1mA"
+ cmd_line_settable = False
+
+ def __new__(cls, value):
+ # convert to current
+ val = convert.toCurrent(value)
+ return super(cls, Current).__new__(cls, val)
+
+ def __call__(self, value):
+ val = convert.toCurrent(value)
+ self.__init__(val)
+ return value
+
+ def __str__(self):
+ return str(self.getValue())
+
+ def getValue(self):
+ value = float(self)
+ return value
+
+ def ini_str(self):
+ return '%f' % self.getValue()
+
class NetworkBandwidth(float,ParamValue):
cxx_type = 'float'
ex_str = "1Gbps"