builtin_types = [ None, "a3xx_regid", "boolean", "uint", "hex", "int", "fixed", "ufixed", "float", "address", "waddress" ]
- if low < 0 or low > 31:
+ maxpos = parser.current_bitsize - 1;
+
+ if low < 0 or low > maxpos:
raise parser.error("low attribute out of range: %d" % low)
- if high < 0 or high > 31:
+ if high < 0 or high > maxpos:
raise parser.error("high attribute out of range: %d" % high)
if high < low:
raise parser.error("low is greater than high: low=%d, high=%d" % (low, high))
print(name + ('\t' * tab_count) + value)
def mask(low, high):
- return ((0xffffffff >> (32 - (high + 1 - low))) << low)
+ return ((0xffffffffffffffff >> (64 - (high + 1 - low))) << low)
class Bitset(object):
def __init__(self, name, template):
self.current_prefix = None
self.current_stripe = None
self.current_bitset = None
+ self.current_bitsize = 32
self.bitsets = {}
self.enums = {}
self.file = []
low = int(attrs["low"], 0)
else:
low = 0
- high = 31
+ high = self.current_bitsize - 1
if "type" in attrs:
type = attrs["type"]
self.do_parse(filename)
def parse_reg(self, attrs, bit_size):
+ self.current_bitsize = bit_size
if "type" in attrs and attrs["type"] in self.bitsets:
bitset = self.bitsets[attrs["type"]]
if bitset.inline:
elif name == "reg64":
self.parse_reg(attrs, 64)
elif name == "array":
+ self.current_bitsize = 32
self.current_array = Array(attrs, self.prefix())
if len(self.stack) == 1:
self.file.append(self.current_array)