params.py (12200:d805bc7859b2) params.py (12250:d69d0f27049d)
1# Copyright (c) 2012-2014, 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 1527 unchanged lines hidden (view full) ---

1536 return self.period.getValue()
1537
1538 def config_value(self):
1539 return self.period.config_value()
1540
1541 def ini_str(self):
1542 return self.period.ini_str()
1543
1# Copyright (c) 2012-2014, 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 1527 unchanged lines hidden (view full) ---

1536 return self.period.getValue()
1537
1538 def config_value(self):
1539 return self.period.config_value()
1540
1541 def ini_str(self):
1542 return self.period.ini_str()
1543
1544class Voltage(float,ParamValue):
1545 cxx_type = 'double'
1544class Voltage(Float):
1546 ex_str = "1V"
1545 ex_str = "1V"
1547 cmd_line_settable = True
1548
1549 def __new__(cls, value):
1546
1547 def __new__(cls, value):
1550 # convert to voltage
1551 val = convert.toVoltage(value)
1552 return super(cls, Voltage).__new__(cls, val)
1548 value = convert.toVoltage(value)
1549 return super(cls, Voltage).__new__(cls, value)
1553
1550
1554 def __call__(self, value):
1555 val = convert.toVoltage(value)
1556 self.__init__(val)
1557 return value
1551 def __init__(self, value):
1552 value = convert.toVoltage(value)
1553 super(Voltage, self).__init__(value)
1558
1554
1559 def __str__(self):
1560 return str(self.getValue())
1561
1562 def getValue(self):
1563 value = float(self)
1564 return value
1565
1566 def ini_str(self):
1567 return '%f' % self.getValue()
1568
1569 @classmethod
1570 def cxx_ini_predecls(cls, code):
1571 code('#include <sstream>')
1572
1573 @classmethod
1574 def cxx_ini_parse(self, code, src, dest, ret):
1575 code('%s (std::istringstream(%s) >> %s).eof();' % (ret, src, dest))
1576
1577class Current(float, ParamValue):
1578 cxx_type = 'double'
1555class Current(Float):
1579 ex_str = "1mA"
1556 ex_str = "1mA"
1580 cmd_line_settable = False
1581
1582 def __new__(cls, value):
1557
1558 def __new__(cls, value):
1583 # convert to current
1584 val = convert.toCurrent(value)
1585 return super(cls, Current).__new__(cls, val)
1559 value = convert.toCurrent(value)
1560 return super(cls, Current).__new__(cls, value)
1586
1561
1587 def __call__(self, value):
1588 val = convert.toCurrent(value)
1589 self.__init__(val)
1590 return value
1562 def __init__(self, value):
1563 value = convert.toCurrent(value)
1564 super(Current, self).__init__(value)
1591
1565
1592 def __str__(self):
1593 return str(self.getValue())
1594
1595 def getValue(self):
1596 value = float(self)
1597 return value
1598
1599 def ini_str(self):
1600 return '%f' % self.getValue()
1601
1602 @classmethod
1603 def cxx_ini_predecls(cls, code):
1604 code('#include <sstream>')
1605
1606 @classmethod
1607 def cxx_ini_parse(self, code, src, dest, ret):
1608 code('%s (std::istringstream(%s) >> %s).eof();' % (ret, src, dest))
1609
1610class NetworkBandwidth(float,ParamValue):
1611 cxx_type = 'float'
1612 ex_str = "1Gbps"
1613 cmd_line_settable = True
1614
1615 def __new__(cls, value):
1616 # convert to bits per second
1617 val = convert.toNetworkBandwidth(value)

--- 474 unchanged lines hidden ---
1566class NetworkBandwidth(float,ParamValue):
1567 cxx_type = 'float'
1568 ex_str = "1Gbps"
1569 cmd_line_settable = True
1570
1571 def __new__(cls, value):
1572 # convert to bits per second
1573 val = convert.toNetworkBandwidth(value)

--- 474 unchanged lines hidden ---