Encoding:

P32A

001000

rt

rs

rd

x

1101000

101

6

5

5

5

1

7

3

Format:

SUBQ_S.W rd, rs, rt

DSP

Subtract Fractional Word

Purpose:

Subtract Fractional Word

One Q31 fractional word is subtracted from another to produce a Q31 fractional result, with saturation.

Description:

rd = sat32(rs31..0 - rt31..0)

The Q31 fractional word in register rt is subtracted from the corresponding fractional word in register rs, and the 32bit result is written to destination register rd. The subtraction is performed using signed saturating arithmetic. If the operation results in an o verflow or an un derflow, the result is clamped to e ither the largest representable value

(0x7FFFFFFF hexadecimal) or the smallest representable value (0x80000000 hexadecimal), respectively, before being sign-extended and written to the destination register rd.

If the subtraction results in underflow, overflow, or saturation, a 1 is written to bit 20 in the DSPControl register within the ouflag field.

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 = sat32Subtract( GPR[rs]31..0 , GPR[rt]31..0 )
GPR[rd]31..0 = temp31..0
function sat32Subtract( a31..0, b31..0 ) 
   temp32..0 = ( a31 || a31..0 ) - ( b31 || b31..0 )
   if ( temp32 != temp31) then
      if ( temp32 = 0 ) then
          temp31..0 = 0x7FFFFFFF
      else
          temp31..0 = 0x80000000
      endif
      DSPControlouflag:20 = 1
   endif
   return temp31..0
endfunction sat32Subtract

Exceptions:

Reserved Instruction, DSP Disabled