From b94b04d748729ea8cce3c61e527ced9d3835cff9 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 20 Apr 2023 20:23:48 -0700 Subject: [PATCH] rename/convert/merge XLCASTU/XLCASTS to EXTZXL/EXTSXL --- src/openpower/decoder/helpers.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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) -- 2.30.2