Encoding:

P32A

001000

rt

rs

0010000

100

111

111

6

5

5

7

3

3

3

Format:

ABSQ_S.W  rt, rs

DSP

Find Absolute Value of Fractional Word

Purpose:

Find Absolute Value of Fractional Word

Find the absolute value of a fractional Q31 value with 32-bit saturation.

Description:

rt = sat32(abs(rs31..0))

The absolute value of the Q31 fractional value in register rs is found and written to destination register rt. If the input value is the m inimum Q31 value (-1.0 in decimal, 0x80000000 in hexadecimal), the result is saturated to

0x7FFFFFFF before being sign-extended and written to register rt.

This instruction sets bit 20 in the DSPControl register in the ouflag field if the input value was saturated.

Restrictions:

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.

Operation:

ValidateAccessToDSPResources()
temp31..0 = satAbs32( GPR[rs]31..0 )
GPR[rt]31..0 = temp31..0
function satAbs32( a31..0 )
   if ( a31..0 = 0x80000000 ) then
      DSPControlouflag:20 = 1
      temp31..0 = 0x7FFFFFFF
   else
      if ( a31 = 1 ) then
          temp31..0 = -a31..0
      else
         temp31..0 = a31..0
      endif
   endif
   return temp31..0 
endfunction satAbs32

Exceptions:

Reserved Instruction, DSP Disabled