From 45bf4930aec86ac11b2773421a315ec3e560f68e Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 13 Mar 2023 16:40:35 -0700 Subject: [PATCH] add binlog to ls007 --- openpower/sv/rfc/ls007.mdwn | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/openpower/sv/rfc/ls007.mdwn b/openpower/sv/rfc/ls007.mdwn index b35d4cbf0..1c1113318 100644 --- a/openpower/sv/rfc/ls007.mdwn +++ b/openpower/sv/rfc/ls007.mdwn @@ -103,6 +103,15 @@ Add the following section to Book I 1.6.1 | PO | RT | RA | RB | TLI | XO | Rc | ``` +# VA-FORM + +Add the following entry to VA-FORM in Book I 1.6.1.12 + +``` +|0 |6 |11 |16 |21|22 |26|27 | +| PO | RT | RA | RB | RC |nh| XO | +``` + # Word Instruction Fields Add the following to Book I 1.6.2 @@ -113,6 +122,13 @@ msk (18:20, 31) Formats: CRB ``` +``` +nh (26) + Nibble High. Field used by binlog to decide if the look-up-table should + be taken from bits 60:63 or 56:59 of RC. + Formats: VA +``` + ``` TLI (21:28) Field used by the ternlogi instruction as the @@ -128,6 +144,11 @@ XO (29:30) Add `TLI` to the `Formats:` list of all of `RA`, `RB`, `RT`, and `Rc`. Add `CRB` to the `Formats:` list of all of `BF`, `BFA`, `BFB`, and `BFC`. +Add `VA` to the `Formats:` list of `XO (27:31)`. + +---------- + +\newpage{} # Ternary Logic Immediate TLI-form @@ -158,6 +179,51 @@ CR0 (if Rc=1) \newpage{} +# Dynamic Binary Logic VA-form + +* `binlog RT, RA, RB, RC, nh` + +| 0-5 | 6-10 | 11-15 | 16-20 | 21-25 | 26 | 27-31 | Form | +|-----|------|-------|-------|-------|----|-------|---------| +| PO | RT | RA | RB | RC | nh | XO | VA-Form | + +Pseudocode: + +``` +if nh = 1 then + lut <- (RC)[56:59] +else + lut <- (RC)[60:63] +do i = 0 to 63 + idx <- (RB)[i] || (RA)[i] # compute index from current bits + result[i] <- lut[3 - idx] # subtract from 3 to index in LSB0 order +RT <- result +``` + +Special registers altered: + +``` +None +``` + +**Programming Note**: + +Dynamic Ternary Logic may be emulated by appropriate combination of `binlog` and `ternlogi`: + +``` +# compute r3 = ternlog(r4, r5, r6, table=r7) +# compute the values for when r6[i] = 0: +binlog r3, r4, r5, r7, 0 # takes look-up-table from LSB 4 bits +# compute the values for when r6[i] = 1: +binlog r4, r4, r5, r7, 1 # takes look-up-table from second-to-LSB 4 bits +# mux the two results together: r3 = (r3 & ~r6) | (r4 & r6) +ternlogi r3, r4, r6, 0b11011000 +``` + +---------- + +\newpage{} + ---------- -- 2.30.2