From: lkcl Date: Sun, 6 Mar 2022 07:57:00 +0000 (+0000) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~3148 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d3acc1feef06b246d89b72dd31c4454ebafdb65;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index b7a54c7ff..898692464 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -664,10 +664,12 @@ def gf_degree(a) : return res def gf_invert(a, mod=0x1B) : + + mod_degree = gf_degree(mod) v = mod g1 = 1 g2 = 0 - j = gf_degree(a) - 8 + j = gf_degree(a) - mod_degree while (a != 1) : if (j < 0) : @@ -678,8 +680,8 @@ def gf_invert(a, mod=0x1B) : a ^= v << j g1 ^= g2 << j - a %= 256 # Emulating 8-bit overflow - g1 %= 256 # Emulating 8-bit overflow + a %= (1<