separate out DQ and DS to separate custom_immediates
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 8 Oct 2022 12:14:13 +0000 (13:14 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 8 Oct 2022 12:14:13 +0000 (13:14 +0100)
D was unhappy about being a custom_field as an immediate.
better: create SignedImmediate class deriving from ImmediateOperand

src/openpower/decoder/power_insn.py

index 8b68e02e74b82adfd9414edcb6131718f5710a8d..26fc759103a75c787533c5470e4fa0cc9890c490 100644 (file)
@@ -872,9 +872,7 @@ class Operands(tuple):
             "SVyd": NonZeroOperand,
             "SVzd": NonZeroOperand,
             "BD": SignedOperand,
-            "D": SignedOperand,
-            "DQ": EXTSOperandDQ,
-            "DS": EXTSOperandDS,
+            "D": SignedOperand, # TODO, make a SignedImmediate class?
             "SI": SignedOperand,
             "IB": SignedOperand,
             "LI": SignedOperand,
@@ -882,6 +880,10 @@ class Operands(tuple):
             "SVD": SignedOperand,
             "SVDS": SignedOperand,
         }
+        custom_immediates = {
+            "DQ": EXTSOperandDQ,
+            "DS": EXTSOperandDS,
+        }
 
         operands = []
         for operand in iterable:
@@ -900,8 +902,8 @@ class Operands(tuple):
                     immediate = None
 
                 if immediate is not None:
-                    if immediate in custom_fields:
-                        dynamic_cls = custom_fields[immediate]
+                    if immediate in custom_immediates:
+                        dynamic_cls = custom_immediates[immediate]
                         operands.append(dynamic_cls(name=immediate))
                     else:
                         operands.append(ImmediateOperand(name=immediate))