From: lkcl Date: Wed, 9 Mar 2022 09:13:27 +0000 (+0000) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~3110 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=636bee73c587e49e7724460b44f24110525e97ef;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index b8eb5922a..95da908e7 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -649,23 +649,18 @@ def FullDivision(self, f, v): fDegree, vDegree = gf_degree(f), gf_degree(v) res, rem = 0, f - i = fDegree - mask = 1 << i - while (i >= vDegree): - if (mask & rem): # check MSB + for i in reversed(range(vDegree, fDegree+1): + if ((rem >> i) & 1): # check bit res ^= (1 << (i - vDegree)) rem ^= ( v << (i - vDegree))) - i -= 1 - mask >>= 1 return (res, rem) ``` + | 0.5|6.10|11.15|16.20| 21 | 22.23 | 24....30 |31| name | | -- | -- | --- | --- | -- | ----- | -------- |--| ---- | | NN | RT | RA | RB | 1 | 00 | 0001 110 |Rc| cldiv | | NN | RT | RA | RB | 1 | 01 | 0001 110 |Rc| clmod | -GFMOD is a pseudo-op where RA=0 - ## carryless mul based on RV bitmanip