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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user