A-Form
-* maddsubrs RT,RA,RB,SH
+* maddsubrs RT,RA,SH,RB
Pseudo-code:
- n <- XLEN-SH
+ n <- SH
sum <- (RT) + (RA)
diff <- (RT) - (RA)
- prod1[0:(XLEN*2)-1] <- MULS(RB, sum)
- prod2[0:(XLEN*2)-1] <- MULS(RB, diff)
- res1 <- prod1[XLEN/2-SH:XLEN-1-SH]
- res2 <- prod2[XLEN/2-SH:XLEN-1-SH]
- RT <- (RT) + EXTS(res1)
- RS <- (RS) + EXTS(res2)
+ prod1 <- MULS(RB, sum)[XLEN:(XLEN*2)-1]
+ prod2 <- MULS(RB, diff)[XLEN:(XLEN*2)-1]
+ res1 <- ROTL64(prod1, XLEN-n)
+ res2 <- ROTL64(prod2, XLEN-n)
+ m <- MASK(n, (XLEN-1))
+ s1 <- res1[0]
+ s2 <- res2[0]
+ smask1 <- ([s1]*XLEN) & ¬m
+ smask2 <- ([s2]*XLEN) & ¬m
+ RT <- res1 & m | smask1
+ RS <- res2 & m | smask2
Special Registers Altered:
# 1.6.17 A-FORM
|0 |6 |11 |16 |21 |26 |31 |
- | PO | FRT | FRA | FRB | FRC | XO |Rc |
- | PO | FRT | FRA | FRB | /// | XO |Rc |
- | PO | FRT | FRA | /// | FRC | XO |Rc |
- | PO | FRT | /// | FRB | /// | XO |Rc |
- | PO | RT | RA | RB | BC | XO | /|
- | PO | RT | RA | RB | SH | XO |Rc |
+ | PO | FRT | FRA | FRB | FRC | XO |Rc |
+ | PO | FRT | FRA | FRB | /// | XO |Rc |
+ | PO | FRT | FRA | /// | FRC | XO |Rc |
+ | PO | FRT | /// | FRB | /// | XO |Rc |
+ | PO | RT | RA | RB | BC | XO | /|
+ | PO | RT | RA | RB | SH | XO |Rc |
# 1.6.18 M-FORM
|0 |6 |11 |16 |21 |26 |31|
class MADDSUBRSTestCase(TestAccumulatorBase):
def case_0_maddsubrs(self):
- isa = SVP64Asm(["maddsubrs 1,2,3,0"])
+ isa = SVP64Asm(["maddsubrs 1,2,14,3"])
lst = list(isa)
initial_regs = [0] * 32
initial_regs[1] = 0x00000a70
- initial_regs[2] = 0xffffe6b8
+ initial_regs[2] = 0x0000e6b8
initial_regs[3] = 0x00002d41
e = ExpectedState(pc=4)
- e.intregs[1] = 0xfffff581
- e.intregs[11] = 0x00001942
+ e.intregs[1] = 0x0000aa85
+ e.intregs[2] = 0xffffffffffff643e
self.add_case(Program(lst, bigendian), initial_regs, expected=e)
- self.add_case(Program(lst, bigendian), expected=e)
-
-