fix EXTSXL/XLCASTU/XLCASTS when inputs are python ints
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 20 Apr 2023 04:00:51 +0000 (21:00 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 20 Apr 2023 04:00:51 +0000 (21:00 -0700)
src/openpower/decoder/helpers.py

index 71d305dfd7f14ba760e795d49cf50b91381190f3..c009431d7e3125245a0b3c5b466fd6a80a5a61d8 100644 (file)
@@ -811,14 +811,22 @@ class ISACallerHelper:
         return self.__XLEN
 
     def XLCASTS(self, value):
-        return SelectableInt(exts(value.value, self.XLEN), self.XLEN)
+        if isinstance(value, SelectableInt):
+            value = value.value
+        return SelectableInt(exts(value, self.XLEN), self.XLEN)
 
     def XLCASTU(self, value):
+        if isinstance(value, SelectableInt):
+            value = value.value
         # SelectableInt already takes care of masking out the bits
-        return SelectableInt(value.value, self.XLEN)
+        return SelectableInt(value, self.XLEN)
 
     def EXTSXL(self, value, bits):
-        return SelectableInt(exts(value.value, bits), self.XLEN)
+        if isinstance(value, SelectableInt):
+            value = value.value
+        if isinstance(bits, SelectableInt):
+            bits = bits.value
+        return SelectableInt(exts(value, bits), self.XLEN)
 
     def DOUBLE2SINGLE(self, FRS):
         """ DOUBLE2SINGLE has been renamed to FRSP since it is the