From: Dmitry Selyutin Date: Sun, 30 Apr 2023 18:50:19 +0000 (+0300) Subject: power_insn: forbid zero for non-zero operands X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=818dbccfa3da487734e3685a04b59a3d5bbe40ed;p=openpower-isa.git power_insn: forbid zero for non-zero operands --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 486d1d65..b9d92508 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -1148,6 +1148,8 @@ class NonZeroOperand(DynamicOperand): value = int(value, 0) if not isinstance(value, int): raise ValueError("non-integer operand") + if value == 0: + raise ValueError("non-zero operand") value -= 1 return super().assemble(value=value, insn=insn)