From e7e17f92db8b249aaf99eb93a2447937d78270d5 Mon Sep 17 00:00:00 2001 From: Akash Bagdia Date: Mon, 19 Aug 2013 03:52:28 -0400 Subject: power: Add voltage domains to the clock domains This patch adds the notion of voltage domains, and groups clock domains that operate under the same voltage (i.e. power supply) into domains. Each clock domain is required to be associated with a voltage domain, and the latter requires the voltage to be explicitly set. A voltage domain is an independently controllable voltage supply being provided to section of the design. Thus, if you wish to perform dynamic voltage scaling on a CPU, its clock domain should be associated with a separate voltage domain. The current implementation of the voltage domain does not take into consideration cases where there are derived voltage domains running at ratio of native voltage domains, as with the case where there can be on-chip buck/boost (charge pumps) voltage regulation logic. The regression and configuration scripts are updated with a generic voltage domain for the system, and one for the CPUs. --- src/python/m5/params.py | 19 ++++++++++++++++++- src/python/m5/util/convert.py | 12 ++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src/python/m5') diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 995c66de5..1e8c24584 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -1250,6 +1250,23 @@ class Clock(ParamValue): def ini_str(self): return self.period.ini_str() +class Voltage(float,ParamValue): + cxx_type = 'double' + def __new__(cls, value): + # convert to voltage + val = convert.toVoltage(value) + return super(cls, Voltage).__new__(cls, val) + + def __str__(self): + return str(self.val) + + def getValue(self): + value = float(self) + return value + + def ini_str(self): + return '%f' % self.getValue() + class NetworkBandwidth(float,ParamValue): cxx_type = 'float' def __new__(cls, value): @@ -1637,7 +1654,7 @@ __all__ = ['Param', 'VectorParam', 'TcpPort', 'UdpPort', 'EthernetAddr', 'IpAddress', 'IpNetmask', 'IpWithPort', 'MemorySize', 'MemorySize32', - 'Latency', 'Frequency', 'Clock', + 'Latency', 'Frequency', 'Clock', 'Voltage', 'NetworkBandwidth', 'MemoryBandwidth', 'AddrRange', 'MaxAddr', 'MaxTick', 'AllMemory', diff --git a/src/python/m5/util/convert.py b/src/python/m5/util/convert.py index 79f3f985e..26f351e99 100644 --- a/src/python/m5/util/convert.py +++ b/src/python/m5/util/convert.py @@ -299,3 +299,15 @@ def toIpWithPort(value): if not 0 <= int(port) <= 0xffff: raise ValueError, 'invalid port %s' % port return (ip, int(port)) + +def toVoltage(value): + if not isinstance(value, str): + raise TypeError, "wrong type '%s' should be str" % type(value) + + if value.endswith('mV'): + return float(value[:-2]) * milli + elif value.endswith('V'): + return float(value[:-1]) + + raise ValueError, "cannot convert '%s' to voltage" % value + -- cgit v1.2.3