P32A 001000 |
rt |
rs |
sa |
x |
1011110 |
101 |
6 |
5 |
5 |
5 |
1 |
7 |
3 |
SHRA_R.W rt, rs, sa |
DSP |
Shift Right Arithmetic Word with Rounding |
Shift Right Arithmetic Word with Rounding
To execute an arithmetic right shift with rounding on a word by a fixed number of bits.
rt = rnd32(rs31:0 >> sa)
The word in register rs is shifted right by sa bits, and the sign bit is duplicated into the sa bits emptied by the shift.
The shifted result is then rounded by adding a 1 bit to the most-significant discarded bit. The rounded result is then written to the destination register rt.
No data-dependent exceptions are possible.
The operands must be values in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.
ValidateAccessToDSPResources() temp31..0 = rnd32ShiftRightArithmetic( GPR[rt]31..0, sa4..0 ) GPR[rt]31..0 = temp32..1 function rnd32ShiftRightArithmetic( a31..0, s4..0 ) if ( s4..0 = 0 ) then temp32..0 = ( a31..0 || 0 ) else sign = a31 temp32..0 = ( signs || a31..s-1 ) endif temp32..0 = temp + 1 return temp32..1 endfunction rnd32ShiftRightArithmetic
Reserved Instruction, DSP Disabled
To do an arithmetic right shift of a word in a register without rounding, use the MIPS32 SRA instruction.