From: lkcl Date: Wed, 22 Jun 2022 16:58:52 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~1590 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ce44bc6dc14113acad60d2fe0009feb7781a7fc;p=libreriscv.git --- diff --git a/openpower/sv/vector_ops/discussion.mdwn b/openpower/sv/vector_ops/discussion.mdwn index 3f8765b66..3b6c6fd74 100644 --- a/openpower/sv/vector_ops/discussion.mdwn +++ b/openpower/sv/vector_ops/discussion.mdwn @@ -6,6 +6,35 @@ These all it turns out can be done as bitmanip of the form x/~x &/|/^ (x / -x / x+1 / x-1) so are being superceded. needs some work though +``` +def bmask(mode, RA, RB=None, zero=False): + mask = [1] * XLEN + mask = RB if RB is not None else 0xffffffffffffffff + ra <- RA & mask + if mode[0] then a1 <- ra else a1 <-~ra + mode2 = (mode >> 1) & 0b11 + if mode2 = 0 then a2 <- -ra + if mode2 = 1 then a2 <- ra-1 + if mode2 = 2 then a2 <- ra+1 + if mode2 = 3 then a2 <- ~(ra+1) + a1 <- a1 & mask + a2 <- a2 & mask + mode3 <- mode[3:4] + if mode3 = 0 then result <- a1 | a2 + if mode3 = 1 then result <- a1 & a2 + if mode3 = 2 result <- a1 ^ a2 + if mode3 = 3 result <- UNDEFINED + result <- result & mask + if L = 1 then + result <- result | (RA & ~mask) + RT <- result + +SBF = 0b01010 # set before first +SOF = 0b01001 # set only first +SIF = 0b10000 # set including first 10011 also works no idea why yet +``` + + ## OBSOLETE sbfm sbfm RT, RA, RB!=0