From eeca4d40e448fda84836736536e6025167f507f5 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 6 Nov 2022 12:29:55 +0300 Subject: [PATCH] power_insn: support non-zero operands --- src/openpower/decoder/power_insn.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- 2.30.2