From c67d8245765f41379d2eced1092b71c4e230457e Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Thu, 20 Jul 2023 16:36:58 +0000 Subject: [PATCH] update pseudo-code --- openpower/sv/twin_butterfly.mdwn | 49 ++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/openpower/sv/twin_butterfly.mdwn b/openpower/sv/twin_butterfly.mdwn index f700e21a0..26b2484ef 100644 --- a/openpower/sv/twin_butterfly.mdwn +++ b/openpower/sv/twin_butterfly.mdwn @@ -106,22 +106,22 @@ Pseudo-code: sum <- (RT) + (RA) diff <- (RT) - (RA) prod1 <- MULS(RB, sum) - prod1_lo <- prod1[XLEN:(XLEN*2)-1] prod2 <- MULS(RB, diff) - prod2_lo <- prod2[XLEN:(XLEN*2)-1] if n = 0 then + prod1_lo <- prod1[XLEN:(XLEN*2) - 1] + prod2_lo <- prod2[XLEN:(XLEN*2) - 1] RT <- prod1_lo RS <- prod2_lo else - round <- [0]*XLEN - round[XLEN -n] <- 1 - prod1_lo <- prod1_lo + round - prod2_lo <- prod2_lo + round - m <- MASK(n, (XLEN-1)) - res1 <- ROTL64(prod1_lo, XLEN-n) & m - res2 <- ROTL64(prod2_lo, XLEN-n) & m - signbit1 <- prod1_lo[0] - signbit2 <- prod2_lo[0] + round <- [0]*(XLEN*2) + round[XLEN*2 - n] <- 1 + prod1 <- prod1 + round + prod2 <- prod2 + round + m <- MASK(XLEN - n - 2, XLEN - 1) + res1 <- prod1[XLEN - n:XLEN*2 - n - 1] + res2 <- prod2[XLEN - n:XLEN*2 - n - 1] + signbit1 <- prod1[0] + signbit2 <- prod2[0] smask1 <- ([signbit1]*XLEN) & ¬m smask2 <- ([signbit2]*XLEN) & ¬m RT <- (res1 | smask1) @@ -149,22 +149,29 @@ Pseudo-code: n <- SH prod <- MULS(RB, RA) - prod_lo <- prod[XLEN:(XLEN*2)-1] if n = 0 then + prod_lo <- prod[XLEN:(XLEN*2) - 1] RT <- (RT) + prod_lo - RS <- (RS) - prod_lo + n <- SH + sum <- (RT) + (RA) + diff <- (RT) - (RA) + prod1 <- MULS(RB, sum) + prod1_lo <- prod1[XLEN:(XLEN*2)-1] + prod2 <- MULS(RB, diff) + prod2_lo <- prod2[XLEN:(XLEN*2)-1] + if n = 0 then + RT <- prod1_lo + RS <- prod2_lo else - res1 <- (RT) + prod_lo - res2 <- (RS) - prod_lo round <- [0]*XLEN round[XLEN -n] <- 1 - res1 <- res1 + round - res2 <- res2 + round - signbit1 <- res1[0] - signbit2 <- res2[0] + prod1_lo <- prod1_lo + round + prod2_lo <- prod2_lo + round m <- MASK(n, (XLEN-1)) - res1 <- ROTL64(res1, XLEN-n) & m - res2 <- ROTL64(res2, XLEN-n) & m + res1 <- ROTL64(prod1_lo, XLEN-n) & m + res2 <- ROTL64(prod2_lo, XLEN-n) & m + signbit1 <- prod1_lo[0] + signbit2 <- prod2_lo[0] smask1 <- ([signbit1]*XLEN) & ¬m smask2 <- ([signbit2]*XLEN) & ¬m RT <- (res1 | smask1) -- 2.30.2