POOL32A 000000 |
rt |
rs |
sa |
0 |
SHRA_R.W 1011110101 |
6 |
5 |
5 |
5 |
1 |
10 |
SPECIAL3 011111 |
sa |
rt |
rd |
SHRA_R.W 10101 |
SHLL.QB 010011 |
6 |
5 |
5 |
5 |
5 |
6 |
SHRA_R.W rdt, rts, sa |
microMIPSDSP |
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.
rdt = sign_extend(rnd32(rts31:0 >> sa))
The right-most word in register rts 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 sign-extended to 64 bits and written to the destination register rdt.
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.
temp31..0 = rnd32ShiftRightArithmetic( GPR[rt]31..0, sa4..0 ) GPR[rdt]63..0 = (temp32)32 || 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 MIPS64 SRA instruction.