P32A 001000 |
rt |
rs |
rd |
x |
0101101 |
101 |
6 |
5 |
5 |
5 |
1 |
7 |
3 |
PRECRQU_S.QB.PH rd, rs, rt |
DSP |
Precision Reduce Fractional Halfwords to Unsigned Bytes With Saturation |
Precision Reduce Fractional Halfwords to Unsigned Bytes With Saturation
Reduce the precision of four fractional halfwords with saturation to produce four unsigned byte values, with saturation.
rd = sat(reduce_prec(rs31..16)) || sat(reduce_prec(rs15..0)) || sat(reduce_prec(rt31..16)) || sat(reduce_prec(rt15..0))
The four Q15 fractional halfwords from registers rs and rt are used to create four unsigned byte values that are written to corresponding elements of destination register rd. The two halfwords from the rs register and the tw o halfwords from the rt register are used to create the four unsigned byte values.
Each unsigned byte value is created from the Q15 fractional halfword input value after first examining the sign and magnitude of the halfword. If the sign of the halfword value is positive and the value is greater than 0x7F80 hexadecimal, the result is clamped to the maximum positive 8-bit value (255 decimal, 0xFF hexadecimal). If the sign of the halfword value is negative, the result is clamped to the minimum positive 8-bit value (0 decimal, 0x00 hexadecimal).
Otherwise, the sign bit is discarded from the input and the result is taken from the eight most-significant bits that remain.
If clamping was needed to produce any of the unsigned output values, bit 22 of the DSPControl register is set to 1.
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() tempD7..0 = sat8ReducePrecision( GPR[rs]31..16 ) tempC7..0 = sat8ReducePrecision( GPR[rs]15..0 ) tempB7..0 = sat8ReducePrecision( GPR[rt]31..16 ) tempA7..0 = sat8ReducePrecision( GPR[rt]15..0 ) GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0 function sat8ReducePrecision( a15..0 ) sign = a15 mag14..0 = a14..0 if ( sign = 0 ) then if ( mag14..0 > 0x7F80 ) then temp7..0 = 0xFF DSPControlouflag:22 = 1 else temp7..0 = mag14..7 endif else temp7..0 = 0x00 DSPControlouflag:22 = 1 endif return temp7..0
Reserved Instruction, DSP Disabled