summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2017-11-10 03:37:37 -0800
committerGabe Black <gabeblack@google.com>2017-11-13 17:13:09 +0000
commit981ee9807966fc1a0ba7d0fb9e9b2368ddeeae24 (patch)
tree377af8e75cba460f14e19d863061d78326af89f5
parentc53dced690f597a2c243febff1e518e4e5208b70 (diff)
downloadgem5-981ee9807966fc1a0ba7d0fb9e9b2368ddeeae24.tar.xz
config: Add an Energy param type.
This type expects values in joules (J). Change-Id: I77a3a4f1c19443f573d5fe7a84d5abd954ce1603 Reviewed-on: https://gem5-review.googlesource.com/5625 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
-rw-r--r--src/python/m5/params.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index c241b054d..11a55e558 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -1563,6 +1563,17 @@ class Current(Float):
value = convert.toCurrent(value)
super(Current, self).__init__(value)
+class Energy(Float):
+ ex_str = "1pJ"
+
+ def __new__(cls, value):
+ value = convert.toEnergy(value)
+ return super(cls, Energy).__new__(cls, value)
+
+ def __init__(self, value):
+ value = convert.toEnergy(value)
+ super(Energy, self).__init__(value)
+
class NetworkBandwidth(float,ParamValue):
cxx_type = 'float'
ex_str = "1Gbps"
@@ -2035,7 +2046,7 @@ __all__ = ['Param', 'VectorParam',
'TcpPort', 'UdpPort', 'EthernetAddr',
'IpAddress', 'IpNetmask', 'IpWithPort',
'MemorySize', 'MemorySize32',
- 'Latency', 'Frequency', 'Clock', 'Voltage', 'Current',
+ 'Latency', 'Frequency', 'Clock', 'Voltage', 'Current', 'Energy',
'NetworkBandwidth', 'MemoryBandwidth',
'AddrRange',
'MaxAddr', 'MaxTick', 'AllMemory',