From: lkcl Date: Mon, 16 May 2022 07:53:30 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~2205 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa44abdbe03cd8f1ae033b0469f3983ba564fe49;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index ee625e23e..10098a7b8 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -670,7 +670,23 @@ uint64_t bmator(uint64_t RA, uint64_t RB) } return x; } - +uint64_t bmatand(uint64_t RA, uint64_t RB) +{ + // transpose of RB + uint64_t RBt = bmatflip(RB); + uint8_t u[8]; // rows of RA + uint8_t v[8]; // cols of RB + for (int i = 0; i < 8; i++) { + u[i] = RA >> (i*8); + v[i] = RBt >> (i*8); + } + uint64_t x = 0; + for (int i = 0; i < 64; i++) { + if ((u[i / 8] & v[i % 8]) == 0xff) + x |= 1LL << i; + } + return x; +} ``` # Introduction to Carry-less and GF arithmetic