SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
Signed Addition of Two Register Values with Saturation
SADD src1, src2, dst
Functional unit = D
16 bit
15 | 13 | 12 | 10 | 9 | 7 | 6 | 0 |
dst | src2 | src1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
3 | 3 | 3 | opcode |
Signed addition of src1 with src2 with result saturation and stored to dst. If a saturate occurs, the SAT bit in the control status register (CSR) is set after dst is written.
CSR[2]EQ = (dst == 0)
CSR[5]SAT = satP OR satN
tmp = src2 + src1
satP = tmp > 231 - 1
satN = tmp < -231
dst = satP ? (231 - 1) : (satN ? -231 : tmp)