for (cls, kwargs) in self.mdwn.operands.static:
operand = cls(record=self, **kwargs)
- for (src, dst) in enumerate(reversed(operand.span(record=self))):
+ for (src, dst) in enumerate(reversed(operand.span)):
value[dst] = int((operand.value & (1 << src)) != 0)
mask[dst] = 1
record: Record
name: str
- def span(self, record):
- return record.fields[self.name]
+ @cached_property
+ def span(self):
+ return self.record.fields[self.name]
def assemble(self, value, insn, record):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
if isinstance(value, str):
class DynamicOperand(Operand):
def disassemble(self, insn, record,
verbosity=Verbosity.NORMAL, indent=""):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
def disassemble(self, insn, record,
verbosity=Verbosity.NORMAL, indent=""):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
def disassemble(self, insn, record,
verbosity=Verbosity.NORMAL, indent=""):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
def disassemble(self, insn, record,
verbosity=Verbosity.NORMAL, indent=""):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
def spec(self, insn, record):
vector = False
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
if not self.field:
object.__setattr__(self, "field", self.name)
- def span(self, record):
- return record.fields[self.field]
+ @cached_property
+ def span(self):
+ return self.record.fields[self.field]
def disassemble(self, insn, record, verbosity=Verbosity.NORMAL, indent=""):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
@_dataclasses.dataclass(eq=True, frozen=True)
class DOperandDX(SignedOperand):
- def span(self, record):
- operands = map(DynamicOperand, ("d0", "d1", "d2"))
- spans = map(lambda operand: operand.span(record=record), operands)
+ @cached_property
+ def span(self):
+ cls = lambda name: DynamicOperand(name=name)
+ operands = map(cls, ("d0", "d1", "d2"))
+ spans = map(lambda operand: operand.span, operands)
return sum(spans, tuple())
def disassemble(self, insn, record,
verbosity=Verbosity.NORMAL, indent=""):
- span = self.span(record=record)
+ span = self.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
}
for (subname, subspan) in mapping.items():
operand = DynamicOperand(name=subname)
- span = operand.span(record=record)
+ span = operand.span
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
value = insn[span]
@_dataclasses.dataclass(eq=True, frozen=True)
class POStaticOperand(_StaticOperand):
- def span(self, record):
+ @property
+ def span(self):
return tuple(range(0, 6))
@_dataclasses.dataclass(eq=True, frozen=True)
class XOStaticOperand(_StaticOperand):
- def span(self, record):
- return tuple(record.section.bitsel)
+ @property
+ def span(self):
+ return tuple(self.record.section.bitsel)
static_operands = [(POStaticOperand, {
"name": "PO",
(cls, kwargs) = operand
operand = cls(record=record, **kwargs)
return StaticOperand(name=operand.name,
- value=operand.value, span=operand.span(record=record))
+ value=operand.value, span=operand.span)
def dynamic_operand(operand):
(cls, kwargs) = operand
operand = cls(record=record, **kwargs)
return DynamicOperand(name=operand.name,
- span=operand.span(record=record))
+ span=operand.span)
static_operands = tuple(map(static_operand, static_operands))
dynamic_operands = tuple(map(dynamic_operand, dynamic_operands))