From: Dmitry Selyutin Date: Sun, 6 Nov 2022 09:29:55 +0000 (+0300) Subject: power_insn: support non-zero operands X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76244a6b491d020af3be4e4623ccb84592d8c59b;p=openpower-isa.git power_insn: support non-zero operands --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 2f187a6f..9d77cbdb 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -615,6 +615,14 @@ class ImmediateOperand(DynamicOperand): class NonZeroOperand(DynamicOperand): + def assemble(self, value, insn, record): + if isinstance(value, str): + value = int(value, 0) + if not isinstance(value, int): + raise ValueError("non-integer operand") + value -= 1 + return super().assemble(value=value, insn=insn, record=record) + def disassemble(self, insn, record, verbosity=Verbosity.NORMAL, indent=""): span = self.span(record=record)