Lines Matching refs:attrs

236 	def __init__(self, attrs, domain):
237 if "name" in attrs:
238 self.name = attrs["name"]
242 self.offset = int(attrs["offset"], 0)
243 self.stride = int(attrs["stride"], 0)
244 self.length = int(attrs["length"], 0)
253 def __init__(self, attrs, domain, array, bit_size):
254 self.name = attrs["name"]
257 self.offset = int(attrs["offset"], 0)
282 def parse_variants(attrs):
283 if not "variants" in attrs:
285 variant = attrs["variants"].split(",")[0]
314 def parse_field(self, name, attrs):
316 if "pos" in attrs:
317 high = low = int(attrs["pos"], 0)
318 elif "high" in attrs and "low" in attrs:
319 high = int(attrs["high"], 0)
320 low = int(attrs["low"], 0)
325 if "type" in attrs:
326 type = attrs["type"]
330 if "shr" in attrs:
331 shr = int(attrs["shr"], 0)
338 b.radix = int(attrs["radix"], 0)
359 def parse_reg(self, attrs, bit_size):
360 if "type" in attrs and attrs["type"] in self.bitsets:
361 bitset = self.bitsets[attrs["type"]]
363 self.current_bitset = Bitset(attrs["name"], bitset)
368 self.current_bitset = Bitset(attrs["name"], None)
370 if "type" in attrs:
371 self.parse_field(None, attrs)
373 self.current_reg = Reg(attrs, self.prefix(), self.current_array, bit_size)
379 def start_element(self, name, attrs):
381 filename = attrs["file"]
384 self.current_domain = attrs["name"]
385 if "prefix" in attrs and attrs["prefix"] == "chip":
386 self.current_prefix = parse_variants(attrs)
388 self.current_stripe = parse_variants(attrs)
391 self.current_enum = Enum(attrs["name"])
392 self.enums[attrs["name"]] = self.current_enum
396 if "value" in attrs:
397 value = int(attrs["value"], 0)
400 self.current_enum.values.append((attrs["name"], value))
403 self.parse_reg(attrs, 32)
405 self.parse_reg(attrs, 64)
407 self.current_array = Array(attrs, self.prefix())
411 self.current_bitset = Bitset(attrs["name"], None)
412 if "inline" in attrs and attrs["inline"] == "yes":
418 self.parse_field(attrs["name"], attrs)