From: Jacob Lifshay Date: Fri, 21 Apr 2023 03:23:48 +0000 (-0700) Subject: rename/convert/merge XLCASTU/XLCASTS to EXTZXL/EXTSXL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1fe49c1774a37d801ca8541456f31f381105c255;p=openpower-isa.git rename/convert/merge XLCASTU/XLCASTS to EXTZXL/EXTSXL --- diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index 76dad8a2..3f8845bf 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -818,21 +818,21 @@ class ISACallerHelper: def XLEN(self): return self.__XLEN - def XLCASTS(self, value): - if isinstance(value, SelectableInt): - value = value.value - return SelectableInt(exts(value, self.XLEN), self.XLEN) - - def XLCASTU(self, value): + def EXTZXL(self, value, bits=None): + if bits is None: + bits = self.XLEN + elif isinstance(bits, SelectableInt): + bits = bits.value if isinstance(value, SelectableInt): value = value.value - # SelectableInt already takes care of masking out the bits - return SelectableInt(value, self.XLEN) + return SelectableInt(value & ((1 << bits) - 1), self.XLEN) - def EXTSXL(self, value, bits): + def EXTSXL(self, value, bits=None): if isinstance(value, SelectableInt): value = value.value - if isinstance(bits, SelectableInt): + if bits is None: + bits = self.XLEN + elif isinstance(bits, SelectableInt): bits = bits.value return SelectableInt(exts(value, bits), self.XLEN)