From: Konstantinos Margaritis Date: Fri, 28 Apr 2023 16:03:44 +0000 (+0000) Subject: almost working, negative values differ by 1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6f7c2e004ec8f6a91e82c737f9e5f28c8e18d73;p=libreriscv.git almost working, negative values differ by 1 --- diff --git a/openpower/sv/twin_butterfly.mdwn b/openpower/sv/twin_butterfly.mdwn index c70a48c6b..c2014930b 100644 --- a/openpower/sv/twin_butterfly.mdwn +++ b/openpower/sv/twin_butterfly.mdwn @@ -36,19 +36,25 @@ The instruction will run in accumulate mode, so in order to calculate the 2-coef A-Form -* maddsubrs RT,RA,RB,SH +* maddsubrs RT,RA,SH,RB Pseudo-code: ``` - sum <- (RT) + (RA) # RT = a, RA = b + n <- SH + sum <- (RT) + (RA) diff <- (RT) - (RA) - prod1 <- MUL(RB, sum) # RB = c - prod2 <- MUL(RB, diff) # TODO: Pick high half? - res1 <- ROTL64(prod1, XLEN-SH) - res2 <- ROTL64(prod2, XLEN-SH) - RT <- (RT) + res1 - RS <- (RS) + res2 + prod1 <- MULS(RB, sum)[XLEN:(XLEN*2)-1] + prod2 <- MULS(RB, diff)[XLEN:(XLEN*2)-1] + res1 <- ROTL64(prod1, XLEN-n) + res2 <- ROTL64(prod2, XLEN-n) + m <- MASK(n, (XLEN-1)) + s1 <- res1[0] + s2 <- res2[0] + smask1 <- ([s1]*XLEN) & ¬m + smask2 <- ([s2]*XLEN) & ¬m + RT <- res1 & m | smask1 + RS <- res2 & m | smask2 ``` Special Registers Altered: