From: Jacob Lifshay Date: Mon, 7 Aug 2023 23:04:00 +0000 (-0700) Subject: split out instructions from openpower/isa/maddsubrs.mdwn X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0196b5e3571bafdef4382b28f8b6c3cd12d9e6a3;p=openpower-isa.git split out instructions from openpower/isa/maddsubrs.mdwn --- diff --git a/openpower/isa/maddsubrs.mdwn b/openpower/isa/maddsubrs.mdwn index 96efe5a5..9369b72c 100644 --- a/openpower/isa/maddsubrs.mdwn +++ b/openpower/isa/maddsubrs.mdwn @@ -2,34 +2,4 @@ -# [DRAFT] Integer Butterfly Multiply Add/Sub Round Shift for FFT/DCT - -A-Form - -* maddsubrs RT,RA,RB,SH - -Pseudo-code: - - n <- SH - sum <- (RT[0] || RT) + (RA[0] || RA) - diff <- (RT[0] || RT) - (RA[0] || RA) - prod1 <- MULS(RB, sum) - prod2 <- MULS(RB, diff) - if n = 0 then - prod1_lo <- prod1[XLEN+1:(XLEN*2)] - prod2_lo <- prod2[XLEN+1:(XLEN*2)] - RT <- prod1_lo - RS <- prod2_lo - else - round <- [0]*(XLEN*2 + 1) - round[XLEN*2 - n + 1] <- 1 - prod1 <- prod1 + round - prod2 <- prod2 + round - res1 <- prod1[XLEN - n + 1:XLEN*2 - n] - res2 <- prod2[XLEN - n + 1:XLEN*2 - n] - RT <- res1 - RS <- res2 - -Special Registers Altered: - - None +[[!inline pagenames="openpower/isa/maddsubrs/maddsubrs" raw="yes"]] diff --git a/openpower/isa/maddsubrs/maddsubrs.mdwn b/openpower/isa/maddsubrs/maddsubrs.mdwn new file mode 100644 index 00000000..92a05f37 --- /dev/null +++ b/openpower/isa/maddsubrs/maddsubrs.mdwn @@ -0,0 +1,13 @@ +# [DRAFT] Integer Butterfly Multiply Add/Sub Round Shift for FFT/DCT + +A-Form + +* maddsubrs RT,RA,RB,SH + +Pseudo-code: + +[[!inline pagenames="openpower/isa/maddsubrs/maddsubrs_code" raw="yes"]] + +Special Registers Altered: + + None diff --git a/openpower/isa/maddsubrs/maddsubrs_code.mdwn b/openpower/isa/maddsubrs/maddsubrs_code.mdwn new file mode 100644 index 00000000..80c996dc --- /dev/null +++ b/openpower/isa/maddsubrs/maddsubrs_code.mdwn @@ -0,0 +1,19 @@ + n <- SH + sum <- (RT[0] || RT) + (RA[0] || RA) + diff <- (RT[0] || RT) - (RA[0] || RA) + prod1 <- MULS(RB, sum) + prod2 <- MULS(RB, diff) + if n = 0 then + prod1_lo <- prod1[XLEN+1:(XLEN*2)] + prod2_lo <- prod2[XLEN+1:(XLEN*2)] + RT <- prod1_lo + RS <- prod2_lo + else + round <- [0]*(XLEN*2 + 1) + round[XLEN*2 - n + 1] <- 1 + prod1 <- prod1 + round + prod2 <- prod2 + round + res1 <- prod1[XLEN - n + 1:XLEN*2 - n] + res2 <- prod2[XLEN - n + 1:XLEN*2 - n] + RT <- res1 + RS <- res2