From 8484514f2517783b6875da66cb720fbc42d811f5 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 18 May 2022 12:02:49 +0100 Subject: [PATCH] explore alternative grevlut in a bit more depth --- openpower/sv/grevlut_grev_gorc.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/openpower/sv/grevlut_grev_gorc.py b/openpower/sv/grevlut_grev_gorc.py index 329da7784..ec96c979f 100644 --- a/openpower/sv/grevlut_grev_gorc.py +++ b/openpower/sv/grevlut_grev_gorc.py @@ -55,9 +55,28 @@ def grevlut_grev_gorc(a, sh, imm_lut, inv_in, inv_out): def case(a, sh, imm_lut, inv_in, inv_out): v = grevlut_grev_gorc(a, sh, imm_lut, inv_in, inv_out) - print(f"grevlut_grev_gorc({hex(a)}, {hex(sh)}, {bin(imm_lut)}, " - f"{inv_in}, {inv_out}) = {hex(v)}") + print(" gl(%x, %x, %s, %d, %d = %x" % (a, sh, bin(imm_lut), + inv_in, inv_out, v)) +if __name__ == '__main__': + # quick experiment + imms = [0b101_0010, 0b101_0110, 0b1110_0110, 0b1001_0011] + for imm in imms: + print ("imm", bin(imm)) + for i in range(64): + case(0x5555_5555_5555_5555, i, imm, True, False) + print() -for i in range(64): - case(0x5555_5555_5555_5555, i, 0b1010010, True, False) + print() + print() + + # explore all possible constants, 16 at a time, here. edit the OR + # to try different combinations | 0b0101_0000 | 0b1000_0000 etc. + imms = [] + for i in range(16): + imms.append(i | 0b0101_0000) + for imm in imms: + print ("imm", bin(imm)) + for i in range(64): + case(0x5555_5555_5555_5555, i, imm, True, False) + print() -- 2.30.2