From: Luke Kenneth Casson Leighton Date: Wed, 23 Jun 2021 15:29:54 +0000 (+0100) Subject: add SHL64 helper function X-Git-Tag: xlen-bcd~410 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=796d46c1d594fe406ae649aab11de8b36ead0340;p=openpower-isa.git add SHL64 helper function --- diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index 4e0a1c16..dfbd0d1f 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -77,6 +77,14 @@ def rotl(value, bits, wordlen): return ((value << bits) | (value >> (wordlen-bits))) & mask +def SHL64(value, bits, wordlen=64): + if isinstance(bits, SelectableInt): + bits = bits.value + mask = (1 << wordlen) - 1 + bits = bits & (wordlen - 1) + return (value << bits) & mask + + def ROTL64(value, bits): return rotl(value, bits, 64) diff --git a/src/openpower/decoder/pseudo/pywriter.py b/src/openpower/decoder/pseudo/pywriter.py index 58b29052..67a4cbc6 100644 --- a/src/openpower/decoder/pseudo/pywriter.py +++ b/src/openpower/decoder/pseudo/pywriter.py @@ -25,7 +25,7 @@ from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32, ne, eq, gt, ge, lt, le, ltu, gtu, length, trunc_divs, trunc_rems, MULS, DIVS, MODS, EXTS128, undefined, - bitrev, + bitrev, SHL64, ) from openpower.decoder.selectable_int import SelectableInt from openpower.decoder.selectable_int import selectconcat as concat