From: lkcl Date: Mon, 18 Apr 2022 21:06:05 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~2717 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b43442e8019f8a9e8cb4889b666f04deac83945e;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip/appendix.mdwn b/openpower/sv/bitmanip/appendix.mdwn index dc1f64c69..643d4e94f 100644 --- a/openpower/sv/bitmanip/appendix.mdwn +++ b/openpower/sv/bitmanip/appendix.mdwn @@ -6,7 +6,21 @@ links * * -Row-based multiply using temporary vector +Row-based multiply using temporary vector. Simple implementation +of Knuth M: + +``` + for (i = 0; i < m; i++) { + unsigned product = u[i]*v[j] + w[i + j]; + phi[i] = product>>16; + plo[i] = product; + } + for (i = 0; i < m; i++) { + t = (phi[i]<<16) | plo[i] + k; + w[i + j] = t; // (I.e., t & 0xFFFF). + k = t >> 16; + } +``` # big integer division