From: Luke Kenneth Casson Leighton Date: Fri, 23 Apr 2021 16:47:24 +0000 (+0100) Subject: add a MASK32 function which offsets by 32 on the inputs X-Git-Tag: 0.0.1~18 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c80ed2c209a8c89d94be2077d21a427e921c09a;p=openpower-isa.git add a MASK32 function which offsets by 32 on the inputs also fix ROTL32 so it selects value from its input --- diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index c8d0044d..70e05d97 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -78,10 +78,18 @@ def ROTL64(value, bits): def ROTL32(value, bits): + if isinstance(bits, SelectableInt): + bits = bits.value if isinstance(value, SelectableInt): value = SelectableInt(value.value, 64) return rotl(value | (value << 32), bits, 64) +def MASK32(x, y): + if isinstance(x, SelectableInt): + x = x.value + if isinstance(y, SelectableInt): + y = y.value + return MASK(x+32, y+32) def MASK(x, y): if isinstance(x, SelectableInt): diff --git a/src/openpower/decoder/pseudo/pywriter.py b/src/openpower/decoder/pseudo/pywriter.py index d2b6882a..b61d7bf2 100644 --- a/src/openpower/decoder/pseudo/pywriter.py +++ b/src/openpower/decoder/pseudo/pywriter.py @@ -21,7 +21,8 @@ header = """\ from openpower.decoder.isa.caller import inject, instruction_info from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32, - MASK, ne, eq, gt, ge, lt, le, ltu, gtu, length, + MASK, MASK32, + ne, eq, gt, ge, lt, le, ltu, gtu, length, trunc_divs, trunc_rems, MULS, DIVS, MODS, EXTS128, undefined) from openpower.decoder.selectable_int import SelectableInt