plus the offsets (sub-fields) of bm were completely wrong
Pseudo-code:
if _RB = 0 then mask <- [1] * XLEN
Pseudo-code:
if _RB = 0 then mask <- [1] * XLEN
- if mode[1] then a1 <- ¬ra
- mode2 <- mode[2:3]
+ if bm[0] then a1 <- ¬ra
+ mode2 <- bm[1:2]
if mode2 = 0 then a2 <- (¬ra)+1
if mode2 = 1 then a2 <- ra-1
if mode2 = 2 then a2 <- ra+1
if mode2 = 0 then a2 <- (¬ra)+1
if mode2 = 1 then a2 <- ra-1
if mode2 = 2 then a2 <- ra+1
a1 <- a1 & mask
a2 <- a2 & mask
# select operator
a1 <- a1 & mask
a2 <- a2 & mask
# select operator
if mode3 = 0 then result <- a1 | a2
if mode3 = 1 then result <- a1 & a2
if mode3 = 2 then result <- a1 ^ a2
if mode3 = 0 then result <- a1 | a2
if mode3 = 1 then result <- a1 & a2
if mode3 = 2 then result <- a1 ^ a2