From: lkcl Date: Fri, 25 Dec 2020 22:25:41 +0000 (+0000) Subject: (no commit message) X-Git-Tag: convert-csv-opcode-to-binary~875 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d82196e5b61827456d69e94319f57f406b24878f;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 4b75b5d05..947c856a2 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -111,3 +111,20 @@ based on RV bitmanip uint_xlen_t cmix(uint_xlen_t rs1, uint_xlen_t rs2, uint_xlen_t rs3) { return (rs1 & rs2) | (rs3 & ~rs2); } ``` + +# carryless mul + +``` +uint_xlen_t clmul(uint_xlen_t rs1, uint_xlen_t rs2) { uint_xlen_t x = 0; +} +for (int i = 0; i < XLEN; i++) if ((rs2 >> i) & 1) +x ^= rs1 << i; return x; +uint_xlen_t clmulh(uint_xlen_t rs1, uint_xlen_t rs2) { uint_xlen_t x = 0; +} +for (int i = 1; i < XLEN; i++) if ((rs2 >> i) & 1) +x ^= rs1 >> (XLEN-i); return x; +uint_xlen_t clmulr(uint_xlen_t rs1, uint_xlen_t rs2) { uint_xlen_t x = 0; +} +for (int i = 0; i < XLEN; i++) if ((rs2 >> i) & 1) +x ^= rs1 >> (XLEN-i-1); return x; +```