From e5f93719aed2ce629c2b7051918b17a85fa65e5c Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 30 Mar 2020 17:08:02 +0100 Subject: [PATCH] add formats --- openpower/isa/fixedlogical.mdwn | 190 ++++++++++++++++++++------------ openpower/isa/stringldst.mdwn | 14 +-- 2 files changed, 125 insertions(+), 79 deletions(-) diff --git a/openpower/isa/fixedlogical.mdwn b/openpower/isa/fixedlogical.mdwn index 85e3a71a8..b701b57ba 100644 --- a/openpower/isa/fixedlogical.mdwn +++ b/openpower/isa/fixedlogical.mdwn @@ -1,176 +1,207 @@ # AND Immediate -andi. RA,RS,UI +D-Form + +* andi. RA,RS,UI RA <- (RS) & ([0]*48 || UI) # OR Immediate -ori RA,RS,UI +D-Form + +* ori RA,RS,UI RA <- (RS) | ([0]*48 || UI) -# AND Immediate Shifted +# AND Immediate Shifted -andis. RA,RS,UI +D-Form + +* andis. RA,RS,UI RA <- (RS) & ([0]*32 || UI || [0]*16) -# OR Immediate Shifted +# OR Immediate Shifted + +D-Form -oris RA,RS,UI +* oris RA,RS,UI RA <- (RS) | ([0]*32 || UI || [0]*16) -# XOR Immediate Shifted +# XOR Immediate Shifted -xoris RA,RS,UI +D-Form + +* xoris RA,RS,UI RA <- (RS) ^ ([0]*32 || UI || [0]*16) -# XOR Immediate +# XOR Immediate + +D-Form -xori RA,RS,UI +* xori RA,RS,UI RA <- (RS) XOR ([0]*48 || UI) -# AND +# AND -and RA,RS,RB (Rc=0) +X-Form -and. RA,RS,RB (Rc=1) +* and RA,RS,RB (Rc=0) +* and. RA,RS,RB (Rc=1) RA <- (RS) & (RB) -# OR +# OR -or RA,RS,RB (Rc=0) +X-Form -or. RA,RS,RB (Rc=1) +* or RA,RS,RB (Rc=0) +* or. RA,RS,RB (Rc=1) RA <- (RS) | (RB) # XOR -xor RA,RS,RB (Rc=0) +X-Form -xor. RA,RS,RB (Rc=1) +* xor RA,RS,RB (Rc=0) +* xor. RA,RS,RB (Rc=1) RA <- (RS) ^ (RB) -# NAND +# NAND -nand RA,RS,RB (Rc=0) +X-Form -nand. RA,RS,RB (Rc=1) +* nand RA,RS,RB (Rc=0) +* nand. RA,RS,RB (Rc=1) RA <- ¬((RS) & (RB)) # NOR -nor RA,RS,RB (Rc=0) +X-Form -nor. RA,RS,RB (Rc=1) +* nor RA,RS,RB (Rc=0) +* nor. RA,RS,RB (Rc=1) RA <- ¬((RS) | (RB)) # Equivalent -eqv RA,RS,RB (Rc=0) +X-Form -eqv. RA,RS,RB (Rc=1) +* eqv RA,RS,RB (Rc=0) +* eqv. RA,RS,RB (Rc=1) RA <- (RS) => (RB) # AND with Complement -andc RA,RS,RB (Rc=0) +X-Form -andc. RA,RS,RB (Rc=1) +* andc RA,RS,RB (Rc=0) +* andc. RA,RS,RB (Rc=1) RA <- (RS) & ¬(RB) -# OR with Complement +# OR with Complement -orc RA,RS,RB (Rc=0) +X-Form -orc. RA,RS,RB (Rc=1) +* orc RA,RS,RB (Rc=0) +* orc. RA,RS,RB (Rc=1) RA <- (RS) | ¬(RB) -# Extend Sign Byte +# Extend Sign Byte -extsb RA,RS (Rc=0) +X-Form -extsb. RA,RS (Rc=1) +* extsb RA,RS (Rc=0) +* extsb. RA,RS (Rc=1) s <- (RS)[56] RA[56:63] <- (RS)[56:63] RA[0:55] <- [s]*56 +# Extend Sign Halfword -# Extend Sign Halfword - -extsh RA,RS (Rc=0) +X-Form -extsh. RA,RS (Rc=1) +* extsh RA,RS (Rc=0) +* extsh. RA,RS (Rc=1) s <- (RS)[48] RA[48:63] <- (RS)[48:63] RA[0:47] <- [s]*48 -# Count Leading Zeros Word +# Count Leading Zeros Word -cntlzw RA,RS (Rc=0) +X-Form -cntlzw. RA,RS (Rc=1) +* cntlzw RA,RS (Rc=0) +* cntlzw. RA,RS (Rc=1) n <- 32 do while n < 64 - if (RS)[n] = 1 then leave + if (RS)[n] = 1 then + leave n <- n + 1 RA <- n - 32 # Count Trailing Zeros Word -cnttzw RA,RS (Rc=0) +X-Form -cnttzw. RA,RS (Rc=1) +* cnttzw RA,RS (Rc=0) +* cnttzw. RA,RS (Rc=1) n <- 0 do while n < 32 - if (RS)[63-n=] = 0b1 then leave + if (RS)[63-n=] = 0b1 then + leave n <- n + 1 RA <- EXTZ64(n) # Compare Bytes -cmpb RA,RS,RB +X-Form - do n = 0 to 7 +* cmpb RA,RS,RB + + do n = 0 to 7 if RS[8*n:8* n+7] = (RB)[8*n:8*n+7] then RA[8*n:8* n+7] <- [1]*8 - else + else RA[8*n:8* n+7] <- [0]*8 # Population Count Bytes -popcntb RA, RS +X-Form + +* popcntb RA, RS do i = 0 to 7 n <- 0 do j = 0 to 7 if (RS)[(i*8)+j] = 1 then n <- n+1 - RA[(i*8):(i*8)+7] <- n + RA[(i*8):(i*8)+7] <- n # Population Count Words -popcntw RA, RS +X-Form + +* popcntw RA, RS do i = 0 to 1 n <- 0 @@ -181,16 +212,20 @@ popcntw RA, RS # Parity Doubleword -prtyd RA,RS +X-Form + +* prtyd RA,RS s <- 0 do i = 0 to 7 s <- s / (RS)[i%8+7] RA <- [0] * 63 || s -# Parity Word +# Parity Word -prtyw RA,RS +X-Form + +* prtyw RA,RS s <- 0 t <- 0 @@ -198,14 +233,15 @@ prtyw RA,RS s <- s / (RS)i%8+7 do i = 4 to 7 t <- t / (RS)i%8+7 - RA[0:31] <- [0]*31 || s + RA[0:31] <- [0]*31 || s RA[32:63] <- [0]*31 || t # Extend Sign Word -extsw RA,RS (Rc=0) +X-Form -extsw. RA,RS (Rc=1) +* extsw RA,RS (Rc=0) +* extsw. RA,RS (Rc=1) s <- (RS)[32] RA[32:63] <- (RS)[32:63] @@ -213,46 +249,56 @@ extsw. RA,RS (Rc=1) # Population Count Doubleword -popcntd RA, RS +X-Form + +* popcntd RA, RS n <- 0 do i = 0 to 63 if (RS)[i] = 1 then - n <- n+1 + n <- n+1 RA <- n -# Count Leading Zeros Doubleword +# Count Leading Zeros Doubleword -cntlzd RA,RS (Rc=0) +X-Form -cntlzd. RA,RS (Rc=1) +* cntlzd RA,RS (Rc=0) +* cntlzd. RA,RS (Rc=1) n <- 0 do while n < 64 - if (RS)[n] = 1 then leave + if (RS)[n] = 1 then + leave n <- n + 1 RA <- n -# Count Trailing Zeros Doubleword +# Count Trailing Zeros Doubleword -cnttzd RA,RS (Rc=0) +X-Form -cnttzd. RA,RS (Rc=1) +* cnttzd RA,RS (Rc=0) +* cnttzd. RA,RS (Rc=1) n <- 0 do while n < 64 - if (RS)[63-n] = 0b1 then leave + if (RS)[63-n] = 0b1 then + leave n <- n + 1 RA <- EXTZ64(n) # Bit Permute Doubleword -bpermd RA,RS,RB] +X-Form + +* bpermd RA,RS,RB] - For i = 0 to 7 + perm <- [0] * 8 + For i = 0 to 7 index <- (RS)[8*i:8*i+7] - If index < 64 - then permi <- (RB)[index] - else permi <- 0 - RA <- [0]*56|| perm[0:7] + if index < 64 then + perm[i] <- (RB)[index] + else + perm[i] <- 0 + RA <- [0]*56 || perm[0:7] diff --git a/openpower/isa/stringldst.mdwn b/openpower/isa/stringldst.mdwn index 734476670..0c60cf352 100644 --- a/openpower/isa/stringldst.mdwn +++ b/openpower/isa/stringldst.mdwn @@ -1,6 +1,6 @@ -# Load String Word Immediate +# Load String Word Immediate -lswi RT,RA,NB +* lswi RT,RA,NB if RA = 0 then EA <- 0 else EA <- (RA) @@ -18,9 +18,9 @@ lswi RT,RA,NB EA <- EA + 1 n <- n - 1 -# Load String Word Indexed +# Load String Word Indexed -lswx RT,RA,RB +* lswx RT,RA,RB if RA = 0 then b <- 0 else b <- (RA) @@ -42,7 +42,7 @@ lswx RT,RA,RB # Store String Word Immediate -stswi RS,RA,NB +* stswi RS,RA,NB if RA = 0 then EA <- 0 else EA <- (RA) @@ -58,9 +58,9 @@ stswi RS,RA,NB EA <- EA + 1 n <- n - 1 -# Store String Word Indexed +# Store String Word Indexed -stswx RS,RA,RB +* stswx RS,RA,RB if RA = 0 then b <- 0 else b <- (RA) -- 2.30.2