Lines Matching refs:bitset
89 def __init__(self, bitset, case, name): argument
90 self.bitset = bitset # leaf bitset
94 def fields(self, bitset=None): argument
95 if bitset is None:
96 bitset = self.bitset
100 for case in bitset.cases:
102 expr = bitset.isa.expressions[case.expr]
116 expr = bitset.isa.expressions[field.expr]
124 if bitset.extends is not None:
125 yield from self.fields(isa.bitsets[bitset.extends])
130 def __init__(self, bitset, case): argument
131 self.bitset = bitset # leaf bitset
137 self.append_forced(bitset)
141 def append_forced(self, bitset): argument
142 if bitset.encode is not None:
143 for name, val in bitset.encode.forced.items():
145 if bitset.extends is not None:
146 self.append_forced(isa.bitsets[bitset.extends])
165 yield DisplayField(self.bitset, self, fieldname)
167 def assert_cases(self, bitset=None): argument
168 if bitset is None:
169 bitset = self.bitset
170 for case in bitset.cases:
174 if bitset.extends is not None:
175 yield from self.assert_cases(isa.bitsets[bitset.extends])
183 def bitset_cases(self, bitset, leaf_bitset=None): argument
185 leaf_bitset = bitset;
186 for case in bitset.cases:
190 if case.expr is None and bitset.extends is not None:
191 parent_bitset = isa.bitsets[bitset.extends]
212 def case_name(self, bitset, name): argument
213 …return bitset.encode.case_prefix + name.upper().replace('.', '_').replace('-', '_').replace('#', '…
235 def bitset_used_exprs(self, bitset): argument
236 for case in bitset.cases:
242 if bitset.extends is not None:
243 yield from self.bitset_used_exprs(self.isa.bitsets[bitset.extends])
245 def extractor_impl(self, bitset, name): argument
246 if bitset.encode is not None:
247 if name in bitset.encode.maps:
248 return bitset.encode.maps[name]
249 if bitset.extends is not None:
250 return self.extractor_impl(self.isa.bitsets[bitset.extends], name)
256 def extractor_fallback(self, bitset, name): argument
257 extr_name = bitset.name + '.' + name
259 print('WARNING: no encode mapping for {}.{}'.format(bitset.name, name))
263 def extractor(self, bitset, name): argument
264 extr = self.extractor_impl(bitset, name)
267 return self.extractor_fallback(bitset, name)
273 def expr_extractor(self, bitset, name, p): argument
274 extr = self.extractor_impl(bitset, name)
275 field = self.resolve_simple_field(bitset, name)
278 return self.expr_name(bitset.get_root(), expr) + '(s, p, src)'
283 extr = self.extractor_fallback(bitset, name)
294 def resolve_simple_field(self, bitset, name): argument
296 for case in bitset.cases:
301 if bitset.extends is not None:
302 return self.resolve_simple_field(isa.bitsets[bitset.extends], name)
305 def encode_type(self, bitset): argument
306 if bitset.encode is not None:
307 if bitset.encode.type is not None:
308 return bitset.encode.type
309 if bitset.extends is not None:
310 return self.encode_type(isa.bitsets[bitset.extends])