From: Luke Kenneth Casson Leighton Date: Sun, 13 Mar 2022 15:26:14 +0000 (+0000) Subject: add grevlut.py demo code X-Git-Tag: opf_rfc_ls005_v1~3072 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=efc946018bf3a368d82500c36407a7f4cce7c37b;p=libreriscv.git add grevlut.py demo code --- diff --git a/openpower/sv/grevlut.py b/openpower/sv/grevlut.py new file mode 100644 index 000000000..3c4cd9279 --- /dev/null +++ b/openpower/sv/grevlut.py @@ -0,0 +1,71 @@ +def lut2(imm, a, b): + idx = b << 1 | a + return (imm>>idx) & 1 + +def dorow(imm8, step_i, chunk_size): + step_o = 0 + for j in range(64): + if (j&chunk_size) == 0: + imm = (imm8 & 0b1111) + else: + imm = (imm8>>4) + a = (step_i>>j)&1 + b = (step_i>>(j ^ chunk_size))&1 + res = lut2(imm, a, b) + #print(j, bin(imm), a, b, res) + step_o |= (res<