From: Jacob Lifshay Date: Thu, 20 Apr 2023 04:00:51 +0000 (-0700) Subject: fix EXTSXL/XLCASTU/XLCASTS when inputs are python ints X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21dc4093104bc77a6b61a35997a3f85169115b3d;p=openpower-isa.git fix EXTSXL/XLCASTU/XLCASTS when inputs are python ints --- diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index 71d305df..c009431d 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -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