From: lkcl Date: Sun, 6 Mar 2022 08:22:17 +0000 (+0000) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~3147 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef9473c2ead115e3c3d031c7579d11e8c2751d8b;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 898692464..e19dcfef6 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -620,7 +620,15 @@ if __name__ == "__main__": ## GF div and mod ``` -def FullDivision(self, f, v, fDegree, vDegree): +def gf_degree(a) : + res = 0 + a >>= 1 + while (a != 0) : + a >>= 1; + res += 1; + return res + +def FullDivision(self, f, v, vDegree): """ Takes four arguments, f, v, fDegree, and vDegree where fDegree and vDegree are the degrees of the field elements @@ -633,6 +641,7 @@ def FullDivision(self, f, v, fDegree, vDegree): other words a is like floor(f/v) and b is like f modulo v. """ + fDegree = gf_degree(f) res, rem = 0, f i = fDegree mask = 1 << i