From: Andrey Miroshnikov Date: Thu, 20 Oct 2022 14:51:03 +0000 (+0100) Subject: doc(ls003): Added first draft rfc ls003 (only maddedu and divmod2du) X-Git-Tag: opf_rfc_ls005_v1~75 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b0494a8ececd6717804385202b342908d6b6ec59;p=libreriscv.git doc(ls003): Added first draft rfc ls003 (only maddedu and divmod2du) --- diff --git a/openpower/sv/rfc/ls003.mdwn b/openpower/sv/rfc/ls003.mdwn new file mode 100644 index 000000000..d0b8b4079 --- /dev/null +++ b/openpower/sv/rfc/ls003.mdwn @@ -0,0 +1,205 @@ +# RFC ls003 Big Integer + +**URLs**: + +* +* +* +* + +**Severity**: Major + +**Status**: New + +**Date**: -- Oct 2022 **(UPDATE)** + +**Target**: v3.2B + +**Source**: v3.0B + +**Books and Section affected**: **UPDATE** + +``` + Book I Scalar Floating-Point 4.6.2.1 + Appendix E Power ISA sorted by opcode + Appendix F Power ISA sorted by version + Appendix G Power ISA sorted by Compliancy Subset + Appendix H Power ISA sorted by mnemonic +``` + +**Summary** + +``` + Instructions added + maddedu - Multiply-Add Extended Double Unsigned + divmod2du - Divide/Modulo Quad-Double Unsigned +``` + +**Submitter**: Luke Leighton (Libre-SOC) + +**Requester**: Libre-SOC + +**Impact on processor**: + +``` + Addition of two new GPR-based instructions +``` + +**Impact on software**: + +``` + Requires support for new instructions in assembler, debuggers, + and related tools. +``` + +**Keywords**: + +``` + GPR, Big-integer, Double-word +``` + +**Motivation** + +Similar to `maddhdu` and `maddld`, but allow for a big-integer rolling +accumulation affect. As the second result location is implicitly defined as the register after the first result (RS=RT+1), the Scalar Register set can be used +for vector computation. +Similar to `divdeu`, and has similar advantages to `maddedu`. Modulo result is +available with the quotient. + +**Notes and Observations**: + +1. There is no need for an Rc=1 variant as VA-Form is being used. +2. There is no need for Special Registers as VA-Form is being used. + +**Changes** + +Add the following entries to: + +* the Appendices of Book I +* Instructions of Book I added to Section 3.3.9.1 + +---------------- + +\newpage{} + +# Multiply-Add Extended Double Unsigned + +`maddedu RT, RA, RB, RC` + +| 0-5 | 6-10 | 11-15 | 16-20 | 21-25 | 26-31 | Form | +|-------|------|-------|-------|-------|-------|---------| +| EXT04 | RT | RA | RB | RC | XO | VA-Form | + +Pseudocode: + +``` + prod[0:127] <- (RA) * (RB) # Multiply RA and RB, result 128-bit + sum[0:127] <- EXTZ(RC) + prod # Zero extend RC, add product + RT <- sum[64:127] # Store low half in RT + RS <- sum[0:63] # RS implicit register, see below +``` + +Special registers altered: + + None + +RC is zero-extended (not shifted, not sign-extended), the 128-bit product added +to it; the lower half of that result stored in RT and the upper half +in RS. + +The differences here to `maddhdu` are that `maddhdu` stores the upper +half in RT, where `maddedu` stores the upper half in RS. There is **no +equivalent to `maddld`** because `maddld` performs sign-extension on RC. + +RS is implictly defined as the register following RT (RS=RT+1). + +*Programmer's Note: +As a Scalar Power ISA operation, like `lq` and `stq`, RS=RT+1. +To achieve a big-integer rolling-accumulation effect: +assuming the scalar to multiply is in r0, +the vector to multiply by starts at r4 and the result vector +in r20, instructions may be issued `maddedu r20,r4,r0,r20 +maddedu r21,r5,r0,r21` etc. where the first `maddedu` will have +stored the upper half of the 128-bit multiply into r21, such +that it may be picked up by the second `maddedu`. Repeat inline +to construct a larger bigint scalar-vector multiply, +as Scalar GPR register file space permits.* + +Examples: + +``` + maddedu r4, r0, r1, r2 # ((r0)*(r1))+(r2), store lower in r4, upper in r5 +``` + +# Divide/Modulo Quad-Double Unsigned + +**Should name be Divide/Module Double Extended Unsigned?** +**Check the pseudo-code comments** + +`divmod2du RT,RA,RB,RC` + +| 0-5 | 6-10 | 11-15 | 16-20 | 21-25 | 26-31 | Form | +|-------|------|-------|-------|-------|-------|---------| +| EXT04 | RT | RA | RB | RC | XO | VA-Form | + +Pseudo-code: + + if ((RA)