From 142f74af83a9933323958f2bb8fd5fe09926f79b Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 27 Apr 2023 22:08:39 +0300 Subject: [PATCH] power_insn: support int and index opcode methods --- src/openpower/decoder/power_insn.py | 6 ++++++ 1 file changed, 6 insertions(+) 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): -- 2.30.2