From c81517c293cdd3f612efae94d1143fb0cf002287 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 9 Oct 2014 17:52:00 -0400 Subject: config: Add Current as a parameter type This patch adds the Python parameter type Current, which is used for the DRAM power modelling (to start with). With this addition we avoid implicit unit assumptions. --- src/python/m5/util/convert.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/python/m5/util') diff --git a/src/python/m5/util/convert.py b/src/python/m5/util/convert.py index 26f351e99..351ee1ee0 100644 --- a/src/python/m5/util/convert.py +++ b/src/python/m5/util/convert.py @@ -311,3 +311,11 @@ def toVoltage(value): raise ValueError, "cannot convert '%s' to voltage" % value +def toCurrent(value): + if not isinstance(value, str): + raise TypeError, "wrong type '%s' should be str" % type(value) + + if value.endswith('A'): + return toFloat(value[:-1]) + + raise ValueError, "cannot convert '%s' to current" % value -- cgit v1.2.3