pysvp64dis: consult the instruction database
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 17 Aug 2022 11:55:26 +0000 (14:55 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 29 Aug 2022 19:38:11 +0000 (20:38 +0100)
src/openpower/sv/trans/pysvp64dis.py

index dbbdce9459b03bf95cfb35f4f51e035f36a36cac..5d11a79612395cda64ba37c593ed5ab0e5faa858 100644 (file)
@@ -48,6 +48,13 @@ class Instruction(_SelectableInt):
     def major(self):
         return self[0:6]
 
+    @property
+    def dbrecord(self):
+        try:
+            return DATABASE[int(self)]
+        except KeyError:
+            return None
+
 
 class PrefixedInstruction(_SelectableInt):
     def __init__(self, prefix, suffix, byteorder=ByteOrder.LITTLE):
@@ -70,6 +77,10 @@ class PrefixedInstruction(_SelectableInt):
     def suffix(self):
         return Instruction(self[32:64])
 
+    @cached_property
+    def dbrecord(self):
+        return self.suffix.dbrecord
+
 
 class SVP64Instruction(PrefixedInstruction):
     class PrefixError(ValueError):