From: Dmitry Selyutin Date: Thu, 27 Apr 2023 19:08:39 +0000 (+0300) Subject: power_insn: support int and index opcode methods X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=142f74af83a9933323958f2bb8fd5fe09926f79b;p=openpower-isa.git power_insn: support int and index opcode methods --- diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index 483b7ac5..b27fdb9f 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -155,6 +155,12 @@ class Opcode: return NotImplemented return ((self.value, self.mask) < (other.value, other.mask)) + def __int__(self): + return (self.value & self.mask) + + def __index__(self): + return int(self).__index__() + def __repr__(self): def pattern(value, mask, bit_length): for bit in range(bit_length):