insndb/core: walk over record opcodes
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 2 Sep 2023 18:33:02 +0000 (21:33 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 10 Sep 2023 20:29:53 +0000 (23:29 +0300)
src/openpower/insndb/core.py

index 403bacabf9b9f1b3e144cd3393f7dc36cb5e6e91..903f55bd4c8f3d5489369d70afbb7b4170223e37 100644 (file)
@@ -807,6 +807,9 @@ class Record(Dataclass):
     mdwn: MarkdownRecord
     svp64: SVP64Record = None
 
+    class Opcodes(tuple):
+        pass
+
     @property
     def extras(self):
         if self.svp64 is not None:
@@ -893,7 +896,7 @@ class Record(Dataclass):
             mask = Opcode.Mask(binary(mask))
             result.append(Opcode(value=value, mask=mask))
 
-        return tuple(result)
+        return self.__class__.Opcodes(result)
 
     @cached_property
     def PO(self):
@@ -3740,6 +3743,8 @@ class Walker(mdis.walker.Walker):
             value = getattr(node, key)
             yield (value, node, key, mdis.walker.AttributePath)
 
+        yield (node.opcodes, node, "opcodes", mdis.walker.AttributePath)
+
     @mdis.dispatcher.Hook(Operands)
     def dispatch_operands(self, node):
         def hook(cls_kwargs):