From 21dc4093104bc77a6b61a35997a3f85169115b3d Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 19 Apr 2023 21:00:51 -0700 Subject: [PATCH] fix EXTSXL/XLCASTU/XLCASTS when inputs are python ints --- src/openpower/decoder/helpers.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 -- 2.30.2