power_insn: introduce signed immediate operand class
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 6 Nov 2022 09:29:55 +0000 (12:29 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 15 Jan 2023 19:47:22 +0000 (22:47 +0300)
src/openpower/decoder/power_insn.py

index 4e12ccd12a535803030f89af9ec81195f853763c..08db95298b174f0e2cca32e2a537af096336f71e 100644 (file)
@@ -614,6 +614,10 @@ class ImmediateOperand(DynamicOperand):
     pass
 
 
+class SignedImmediateOperand(SignedOperand, ImmediateOperand):
+    pass
+
+
 class NonZeroOperand(DynamicOperand):
     def assemble(self, value, insn, record):
         if isinstance(value, str):
@@ -907,7 +911,7 @@ class Operands(tuple):
             "SVyd": NonZeroOperand,
             "SVzd": NonZeroOperand,
             "BD": SignedOperand,
-            "D": SignedOperand, # TODO, make a SignedImmediate class?
+            "D": SignedImmediateOperand,
             "SI": SignedOperand,
             "IB": SignedOperand,
             "LI": SignedOperand,