params.py (10267:ed97f6f2ed7a) | params.py (10317:19f5df7ac6a1) |
---|---|
1# Copyright (c) 2012-2013 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 --- 612 unchanged lines hidden (view full) --- 621 cxx_type = 'Addr' 622 size = 64 623 unsigned = True 624 def __init__(self, value): 625 if isinstance(value, Addr): 626 self.value = value.value 627 else: 628 try: | 1# Copyright (c) 2012-2013 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 --- 612 unchanged lines hidden (view full) --- 621 cxx_type = 'Addr' 622 size = 64 623 unsigned = True 624 def __init__(self, value): 625 if isinstance(value, Addr): 626 self.value = value.value 627 else: 628 try: |
629 # Often addresses are referred to with sizes. Ex: A device 630 # base address is at "512MB". Use toMemorySize() to convert 631 # these into addresses. If the address is not specified with a 632 # "size", an exception will occur and numeric translation will 633 # proceed below. |
|
629 self.value = convert.toMemorySize(value) | 634 self.value = convert.toMemorySize(value) |
630 except TypeError: 631 self.value = long(value) | 635 except (TypeError, ValueError): 636 # Convert number to string and use long() to do automatic 637 # base conversion (requires base=0 for auto-conversion) 638 self.value = long(str(value), base=0) 639 |
632 self._check() 633 def __add__(self, other): 634 if isinstance(other, Addr): 635 return self.value + other.value 636 else: 637 return self.value + other 638 def pretty_print(self, value): 639 try: --- 1217 unchanged lines hidden --- | 640 self._check() 641 def __add__(self, other): 642 if isinstance(other, Addr): 643 return self.value + other.value 644 else: 645 return self.value + other 646 def pretty_print(self, value): 647 try: --- 1217 unchanged lines hidden --- |