From 0bcf55f5907f608429174eb206d471cb666f52c5 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 23 Jun 2021 16:26:02 +0100 Subject: [PATCH] add bitrev to pywriter autogenerator --- src/openpower/decoder/helpers.py | 10 +++++----- src/openpower/decoder/pseudo/pywriter.py | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index ed8679d6..4e0a1c16 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -369,12 +369,12 @@ def bitrev(val, VL): """Returns the integer whose value is the reverse of the lowest 'width' bits of the integer 'val' """ - result = 0 + result = 0 width = VL.bit_length() - for _ in range(width): - result = (result << 1) | (val & 1) - val >>= 1 - return result + for _ in range(width): + result = (result << 1) | (val & 1) + val >>= 1 + return result # For these tests I tried to find power instructions that would let me diff --git a/src/openpower/decoder/pseudo/pywriter.py b/src/openpower/decoder/pseudo/pywriter.py index 766f7929..58b29052 100644 --- a/src/openpower/decoder/pseudo/pywriter.py +++ b/src/openpower/decoder/pseudo/pywriter.py @@ -25,9 +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, - DOUBLE, SINGLE, - FPADD32, FPSUB32, FPMUL32, FPDIV32, - FPADD64, FPSUB64, FPMUL64, FPDIV64, + bitrev, ) from openpower.decoder.selectable_int import SelectableInt from openpower.decoder.selectable_int import selectconcat as concat -- 2.30.2