From d55ca21896083a8f202917609e4e218737c1cc16 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 17 Mar 2022 19:46:44 -0700 Subject: [PATCH] read all inputs before writing to any outputs in case an input overlaps with an output register. --- openpower/sv/bitmanip.mdwn | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 548d487bc..ab2c7e2a9 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -594,9 +594,13 @@ cltmadd RT, RA, RB, RC TODO: add link to explanation for where `RS` comes from. -``` -(RT) = RC ^ clmul((RA), (RB)) -(RS) = RA ^ RC +``` +a = (RA) +c = (RC) +# read all inputs before writing to any outputs in case +# an input overlaps with an output register. +(RT) = clmul(a, (RB)) ^ c +(RS) = a ^ c ``` ## `cldivrem` Carry-less Division and Remainder @@ -691,9 +695,13 @@ gfbtmadd RT, RA, RB, RC TODO: add link to explanation for where `RS` comes from. -``` -(RT) = gfbmadd((RA), (RB), (RC)) -(RS) = RA ^ RC +``` +a = (RA) +c = (RC) +# read all inputs before writing to any outputs in case +# an input overlaps with an output register. +(RT) = gfbmadd(a, (RB), c) +(RS) = a ^ c ``` ## `gfbinv` -- Binary Galois Field `GF(2^m)` Inverse -- 2.30.2