Pseudo-code (shadd):
- shift <- shift + 1 # Shift is between 1-4
- sum[0:63] <- ((RB) << shift) + (RA) # Shift RB, add RA
- RT <- sum # Result stored in RT
+ n <- (RB)
+ m <- sm + 1
+ RT <- (n[m:XLEN-1] || [0]*m) + (RA)
Pseudo-code (shadduw):
- shift <- shift + 1 # Shift is between 1-4
- n <- (RB)[XLEN/2:XLEN-1] # Limit RB to upper word (32-bits)
- sum[0:63] <- (n << shift) + (RA) # Shift n, add RA
- RT <- sum # Result stored in RT
+ n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
+ m <- sm + 1
+ RT <- (n[m:XLEN-1] || [0]*m) + (RA)
```
uint_xlen_t shadd(uint_xlen_t RA, uint_xlen_t RB, uint8_t sm) {