Encoding:

P32A

001000

rt

rs

0001000

100

111

111

6

5

5

7

3

3

3

Format:

ABSQ_S.PH  rt, rs

DSP

Find Absolute Value of Two Fractional Halfwords

Purpose:

Find Absolute Value of Two Fractional Halfwords

Find the absolute value of each of a pair of Q15 fractional halfword values with 16-bit saturation.

Description:

rt = sat16(abs(rs31..16)) || sat16(abs(rs15..0))

For each value in the pair of Q15 fractional halfword values in register rs, the absolute value is found and written to the corresponding Q15 halfword in register rt. If either input value is the minimum Q15 value (-1.0 in deci mal,

0x8000 in hexadecimal), the corresponding result is saturated to 0x7FFF.

This instruction sets bit 20 in the DSPControl register in the ouflag field if either 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()
tempB15..0 = satAbs16( GPR[rs]31..16 )
tempA15..0 = satAbs16( GPR[rs]15..0 )
GPR[rt]31..0 = tempB15..0 || tempA15..0
function satAbs16( a15..0 )
   if ( a15..0 = 0x8000 ) then
      DSPControlouflag:20 = 1
      temp15..0 = 0x7FFF
   else
      if ( a15 = 1 ) then
          temp15..0 = -a15..0
      else
         temp15..0 = a15..0
      endif
   endif
   return temp15..0 
endfunction satAbs16

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0000000

100

111

111

6

5

5

7

3

3

3

Format:

ABSQ_S.QB rt, rs

DSP-R2

Find Absolute Value of Four Fractional Byte Values

Purpose:

Find Absolute Value of Four Fractional Byte Values

Find the absolute value of four fractional byte vector elements with saturation.

Description:

rt = sat8(abs(rs31..24)) || sat8(abs(rs23..16)) || sat8(abs(rs15..8)) || 
sat8(abs(rs7..0))

For each value in the four Q7 fractional byte elements in register rs, the absolute value is found and written to the corresponding byte in register rt. If either input value is the minimum Q7 value (-1.0 in decimal, 0x80 in hexadecimal), the corresponding result is saturated to 0x7F.s

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

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempD7..0 = abs8( GPR[rs]31..24 )
tempC7..0 = abs8( GPR[rs]23..16 )
tempB7..0 = abs8( GPR[rs]15..8 )
tempA7..0 = abs8( GPR[rs]7..0 )
GPR[rt]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
function abs8( a7..0 )
   if ( a7..0 = 0x80 ) then
      DSPControlouflag:20 = 1
      temp7..0 = 0x7F
   else
      if ( a7 = 1 ) then
          temp7..0 = -a7..0
      else
         temp7..0 = a7..0
      endif
   endif
   return temp7..0 
endfunction abs8

Exceptions:

Reserved Instruction, DSP Disabled

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

Encoding:

P32A

001000

rt

rs

rd

ADDQH.PH

0

0001001

101

P32A

001000

rt

rs

rd

ADDQH_R.PH

1

0001001

101

6

5

5

5

1

7

3

Format:

ADDQH[_R].PH 

Add Fractional Halfword Vectors And Shift Right to Halve Results

ADDQH.PH     rd, rs, rt

DSP-R2

Add Fractional Halfword Vectors And Shift Right to Halve Results

ADDQH_R.PH   rd, rs, rt

DSP-R2

Add Fractional Halfword Vectors And Shift Right to Halve Results

Purpose:

Add Fractional Halfword Vectors And Shift Right to Halve Results

Element-wise fractional addition of halfword vectors, with a right shift by one bit to halve each result, with optional rounding.

Description:

rd = round((rs31..16 + rt31..16) >> 1) || round((rs15..0 + rt15..0) >> 1)

Each element from the two halfword values in register rs is added to the corresponding halfword element in register rt to create an interim 17-bit result.

In the non-rounding instruction variant, each interim result is then shifted right by one bit before being written to the corresponding halfword element of destination register rd.

In the rounding version of the instruction, a v alue of 1 is added at the least-significant bit position of each interim result; the interim result is then right-shifted by one bit and written to the destination register.

This instruction does not modify the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDQH.PH
   ValidateAccessToDSP2Resources()
   tempB15..0 = rightShift1AddQ16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = rightShift1AddQ16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
ADDQH_R.PH
   ValidateAccessToDSP2Resources()
   tempB15..0 = roundRightShift1AddQ16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = roundRightShift1AddQ16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
function rightShift1AddQ16( a15..0 , b15..0 )
   temp16..0 = (( a15 || a15..0 ) + ( b15 || b15..0 ))
   return temp16..1
endfunction rightShift1AddQ16
function roundRightShift1AddQ16( a15..0 , b15..0 )
   temp16..0 = (( a15 || a15..0 ) + ( b15 || b15..0 ))
   return temp16..1
endfunction roundRightShift1AddQ16

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

ADDQH.W

0

0010001

101

P32A

001000

rt

rs

rd

ADDQH_R.W

1

0010001

101

6

5

5

5

1

7

3

Format:

ADDQH[_R].W 

Add Fractional Words And Shift Right to Halve Results

ADDQH.W     rd, rs, rt

DSP-R2

Add Fractional Words And Shift Right to Halve Results

ADDQH_R.W   rd, rs, rt

DSP-R2

Add Fractional Words And Shift Right to Halve Results

Purpose:

Add Fractional Words And Shift Right to Halve Results

Fractional addition of word vectors, with a right shift by one bit to halve the result, with optional rounding.

Description:

rd = round((rs31..0 + rt31..0) >> 1)

The word in register rs is added to the word in register rt to create an interim 33-bit result.

In the non-rounding instruction variant, the interim result is then shifted right by one bit before being written to the destination register rd.

In the rounding version of the instruction, a value of 1 is added at the least-si gnificant bit position of the int erim result; the interim result is then right-shifted by one bit and written to the destination register.

This instruction does not modify the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDQH.W
   ValidateAccessToDSP2Resources()
   tempA31..0 = rightShift1AddQ32( GPR[rs]31..0 , GPR[rt]31..0 )
   GPR[rd]31..0 = tempA31..0
ADDQH_R.W
   ValidateAccessToDSP2Resources()
   tempA31..0 = roundRightShift1AddQ32( GPR[rs]31..0 , GPR[rt]31..0 )
   GPR[rd]31..0 = tempA31..0
function rightShift1AddQ32( a31..0 , b31..0 )
   temp32..0 = (( a31 || a31..0 ) + ( b31 || b31..0 ))
   return temp32..1
endfunction rightShift1AddQ32
function roundRightShift1AddQ32( a31..0 , b31..0 )
   temp32..0 = (( a31 || a31..0 ) + ( b31 || b31..0 ))
   temp32..0 = temp32..0 + 1
   return temp32..1
endfunction roundRightShift1AddQ32

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

ADDQ.PH

0

0000001

101

P32A

001000

rt

rs

rd

ADDQ_S.PH

1

0000001

101

6

5

5

5

1

7

3

Format:

ADDQ[_S].PH 

Add Fractional Halfword Vectors

ADDQ.PH   rd, rs, rt

DSP

Add Fractional Halfword Vectors

ADDQ_S.PH rd, rs, rt

DSP

Add Fractional Halfword Vectors

Purpose:

Add Fractional Halfword Vectors

Element-wise addition of two vectors of Q15 fractional values to produce a vector of Q15 fractional results, with optional saturation.

Description:

rd = sat16(rs31..16 + rt31..16) || sat16(rs15..0 + rt15..0)

Each of the tw o fractional halfword elements in re gister rt are added to the corresponding fractional halfword elements in register rs.

For the non-saturating version of the instruction, the result of each addition is written into the corresponding element in register rd. If the addition results in overflow or underflow, the result modulo 2 is written to the corresponding element in register rd.

For the saturating version of the instruction, signed saturating arithmetic is performed, where an overflow is clamped to the largest representable v alue (0x7FFF he xadecimal) and an underflow to the sm allest representable value

(0x8000 hexadecimal) before being written to the destination register rd.

For each instruction, if either of the individual additions result in underflow, overflow, or saturation, a 1 is written to bit 20 in the DSPControl register in 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:

ADDQ.PH:
   ValidateAccessToDSPResources()
   tempB15..0 = add16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = add16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
ADDQ_S.PH:
   ValidateAccessToDSPResources()
   tempB15..0 = satAdd16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = satAdd16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
function add16( a15..0, b15..0 ) 
   temp16..0 = ( a15 || a15..0 ) + ( b15 || b15..0 )
   if ( temp16 != temp15 ) then
   return temp15..0
endfunction add16
function satAdd16( a15..0, b15..0 )
   temp16..0 = ( a15 || a15..0 ) + ( b15 || b15..0 )
   if ( temp16 != temp15 ) then
      if ( temp16 = 0 ) then
          temp15..0 = 0x7FFF
      else
          temp15..0 = 0x8000
      endif
      DSPControlouflag:20 = 1
   endif
   return temp15..0
endfunction satAdd16

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1100000

101

6

5

5

5

1

7

3

Format:

ADDQ_S.W rd, rs, rt

DSP

Add Fractional Words

Purpose:

Add Fractional Words

Addition of two Q31 fractional values to produce a Q31 fractional result, with saturation.

Description:

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

The Q31 fractional word in register rt is added to the corresponding fractional word in register rs. The result is then written to the destination register rd.

Signed saturating arithmetic is used, where an overflow is clamped to the largest representable value (0x7FFFFFFF hexadecimal) and an un derflow to the smallest representable value (0x80000000 hexadecimal) before being signextended and written to the destination register rd.

If the addition 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 = satAdd32( GPR[rs]31..0 , GPR[rt]31..0 )
GPR[rd]31..0 = temp31..0
function satAdd32( 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 satAdd32

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1110000

101

6

5

5

5

1

7

3

Format:

ADDSC rd, rs, rt

DSP

Add Signed Word and Set Carry Bit

Purpose:

Add Signed Word and Set Carry Bit

Add two signed 32-bit values and set the carry bit in the DSPControl register if the addition generates a carry-out bit.

Description:

DSPControl[c],rd = rs + rt

The 32-bit signed value in register rt is added to the 32-bit signed value in register rs. The result is then written into register rd. The carry bit result out of the addition operation is written to bit 13 (the c field) of the DSPControl register.

This instruction does not modify the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

Operation:

ValidateAccessToDSPResources()
temp32..0 = ( 0 || GPR[rs]31..0 ) + ( 0 || GPR[rt]31..0 )
DSPControlc:13 = temp32 
GPR[rd]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

Note that this is really two’s complement (modulo) arithmetic on the two integer values, where the overflow is preserved in architectural state. The ADDWC instruction can be used to do an add using this carry bit. These instructions are provided in the MIPS32 ISA to support 64-bit addition and subtraction using two pairs of 32-bit GPRs to hold each 64-bit value. In the MIPS64 ISA, 64-bit addition and subtraction can be performed directly, without requiring the use of these instructions.

Encoding:

P32A

001000

rt

rs

rd

ADDUH.QB

0

0101001

101

P32A

001000

rt

rs

rd

ADDUH_R.QB

1

0101001

101

6

5

5

5

1

7

3

Format:

ADDUH[_R].QB 

Unsigned Add Vector Quad-Bytes And Right Shift to Halve Results

ADDUH.QB     rd, rs, rt

DSP-R2

Unsigned Add Vector Quad-Bytes And Right Shift to Halve Results

ADDUH_R.QB   rd, rs, rt

DSP-R2

Unsigned Add Vector Quad-Bytes And Right Shift to Halve Results

Purpose:

Unsigned Add Vector Quad-Bytes And Right Shift to Halve Results

Element-wise unsigned additi on of unsigned byte v ectors, with right shift by one bit to ha lve each result, with optional rounding.

Description rd = round((rs31..24 + rt31..24)>>1) || round((rs23..16 + rt23..16)>>1) ||

round((rs15..8 + rt15..8)>>1) || round((rs7..0 + rt7..0)>>1)

Each element from the four unsigned byte values in register rs is added to the corresponding unsigned byte element in register rt to create an unsigned interim result.

In the non-rounding instruction variant, each interim result is then shifted right by one bit before being written to the corresponding unsigned byte element of destination register rd.

In the rounding version of the instruction, a v alue of 1 is added at the least-significant bit position of each interim result before being right-shifted by one bit and written to the destination register.

This instruction does not modify the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDUH.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = rightShift1AddU8( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = rightShift1AddU8( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = rightShift1AddU8( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = rightShift1AddU8( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
ADDUH_R.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = roundRightShift1AddU8( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = roundRightShift1AddU8( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = roundRightShift1AddU8( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = roundRightShift1AddU8( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
function rightShift1AddU8( a7..0 , b7..0 )
   return temp8..1
endfunction rightShift1AddU8
function roundRightShift1AddU8( a7..0 , b7..0 )
   temp8..0 = (( 0 || a7..0 ) + ( 0 || b7..0 ))
   temp8..0 = temp8..0 + 1
   return temp8..1
endfunction roundRightShift1AddU8

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

ADDU.PH

0

0100001

101

P32A

001000

rt

rs

rd

ADDU_S.PH

1

0100001

101

6

5

5

5

1

7

3

Format:

ADDU[_S].PH 

Unsigned Add Integer Halfwords

ADDU.PH   rd, rs, rt

DSP-R2

Unsigned Add Integer Halfwords

ADDU_S.PH rd, rs, rt

DSP-R2

Unsigned Add Integer Halfwords

Purpose:

Unsigned Add Integer Halfwords

Add two pairs of unsigned integer halfwords, with optional saturation.

Description:

rd = sat16(rs31..16 + rt31..16) || sat16(rs15..0 + rt15..0)

The two unsigned integer halfword elements in register rt are added to the corresponding unsigned integer halfword elements in register rs.

For the non-saturating version of the instruction, the result modulo 65,536 is written into the corresponding element in register rd.

For the saturating version of the instruction, the addition is performed using unsigned saturating arithmetic. Results that overflow are clamped to the lar gest representable value (65,535 decimal, 0xFFFF hexadecimal) before being written to the destination register rd.

For either instruction, if any of the individual additions result in 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 a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDU.PH:
   ValidateAccessToDSP2Resources()
   tempB15..0 = addU16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = addU16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
ADDU_S.PH:
   ValidateAccessToDSP2Resources()
   tempB15..0 = satAddU16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = satAddU16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

ADDU.QB

0

0011001

101

P32A

001000

rt

rs

rd

ADDU_S.QB

1

0011001

101

6

5

5

5

1

7

3

Format:

ADDU[_S].QB 

Unsigned Add Quad Byte Vectors

ADDU.QB   rd, rs, rt

DSP

Unsigned Add Quad Byte Vectors

ADDU_S.QB rd, rs, rt

DSP

Unsigned Add Quad Byte Vectors

Purpose:

Unsigned Add Quad Byte Vectors

Element-wise addition of two vectors of unsigned byte values to prod uce a vector of unsigned byte result s, with optional saturation.

Description:

rd = sat8(rs31..24 + rt31..24) || sat8(rs23..16 + rt23..16) || sat8(rs15..8 + 
rt15..8) || sat8(rs7..0 + rt7..0)

The four byte elements in register rt are added to the corresponding byte elements in register rs.

For the non-saturating version of the instruction, the result modulo 256 is written into the corresponding element in register rd.

For the saturating version of the instruction, the addition is performed using unsigned saturating arithmetic. Results that overflow are clamped to the largest representable value (255 decimal, 0xFF hexadecimal) before being written to the destination register rd.

For either instruction, if any of the individual additions result in 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:

ADDU.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = addU8( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = addU8( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = addU8( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = addU8( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
ADDU_S.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = satAddU8( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = satAddU8( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = satAddU8( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = satAddU8( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
   if ( temp8 = 1 ) then
      DSPControlouflag:20 = 1
   endif
   return temp7..0
endfunction addU8
function satAddU8( a7..0, b7..0 )
   temp8..0 = ( 0 || a7..0 ) + ( 0 || b7..0 )
   if ( temp8 = 1 ) then
      temp7..0 = 0xFF
      DSPControlouflag:20 = 1
   endif
   return temp7..0
endfunction satAddU8

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1111000

101

6

5

5

5

1

7

3

Format:

ADDWC rd, rs, rt

DSP

Add Word with Carry Bit

Purpose:

Add Word with Carry Bit

Add two signed 32-bit values with the carry bit in the DSPControl register.

Description:

rd = rs + rt + DSPControlc:13

The 32-bit value in register rt is added to the 32-bit value in register rs and the carry bit in the DSPControl register.

The result is then written to destination register rd.

If the addition results in either overflow or underflow, this instruction writes a 1 to bi t 20 in the ouflag field of the

DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

Operation:

ValidateAccessToDSPResources()
temp32..0 = ( GPR[rs]31 || GPR[rs]31..0 ) + ( GPR[rt]31 || GPR[rt]31..0 ) + ( 032 || 
DSPControlc:13 )
if ( temp32 != temp31 ) then
   DSPControlouflag:20 = 1
endif
GPR[rd]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

Format:

BALIGN rt, rs, bp

DSP-R2

Byte Align Contents from Two Registers

EXTW rt, rs, rt, 8*(4-bp)

Replaced with EXTW in nanoMIPS

Byte Align Contents from Two Registers

Purpose:

Byte Align Contents from Two Registers

Create a word result by combining a specified number of bytes from each of two source registers.

Description:

rt = (rt << 8*bp) || (rs >> 8*(4-bp))

The 32-bit word in register rt is left-shifted as a 32-bit value by bp byte positions, and the right-most word in register

rs is right-shifted as a 32-bit value by (4-bp) byte positions. The shifted values are then or-ed together to create a 32bit result that is written to destination register rt.

The argument bp is pr ovided by the i nstruction, and i s interpreted as an unsigned two-bit integer taking values between zero and three.

Restrictions:

No data-dependent exceptions are possible.

Operation:

ValidateAccessToDSP2Resources()
if (bp1..0 = 0) or (bp1..0 = 2) then
   GPR[rt]31..0 = UNPREDICTABLE
else 
   temp31..0 = ( GPR[rt]31..0 << (8*bp1..0) ) || ( GPR[rs]31..0 >> (8*(4-bp1..0)) )
   GPR[rt]31..0 = temp31..0
endif

Implementation Notes:

When bp is equal to zero, no left-shift is performed. When bp is equal to two, the result is equivalent to a PACKRL operation when the destination register is identical to the first source register. The assembler is expected to map these two variants of the BALIGN instructions to the appropriate equivalents. The only valid values of bp that the hardware must implement are when bp is equal to 1 and 3. If this instruction is passed through to the hardware with bp value equal to 0 or 2, the result is UNPREDICTABLE.

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

001000

rt

rs

0011000

100

111

111

6

5

5

7

3

3

3

Format:

BITREV rt, rs

DSP

Bit-Reverse Halfword

Purpose:

Bit-Reverse Halfword

To reverse the order of the bits of the least-significant halfword in the specified register.

Description:

rt = rs0..15

The right-most halfword value in register rs is bit-reversed into the right-most halfword position in the destination register rt. The 16 most-significant bits of the destination register are zero-filled.

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()
temp15..0 = GPR[rs]0..15
GPR[rt]31..0 = 016 || temp15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

100010

x

00100

01

s[13:1]

s

[14]

6

5

5

2

13

1

Format:

BPOSGE32C offset

DSP-R3

Branch on Greater Than or Equal To Value 32 in

Purpose:

Branch on Greater Than or Equal To Value 32 in

DSPControl

Pos Field

Perform a PC-relative branch if the value of the pos field in the DSPControl register is greater than or equal to 32.

Description:

 if (DSPControlpos:5..0 >= 32) then goto PC+offset

First, the offset argument is left-shifted by one bit to form a 17-bit signed integer value. This value is added to the address of the instruction immediately following the branch to form a target branch address. Then, if the value of the pos field of the DSPControl register is greater than or equal to 32, the branch is taken and execution begins from the target address.

Restrictions:

Any instruction may be placed at PC + 4, where PC is that of the branch. An exception on such an instruction does not affect CP0 CAUSEBD, and CP0 EPC is that of instruction in slot after branch.

Availability:

This instruction is introduced by and required as of Revision 3 of the DSP Module.

Operation:

I:    ValidateAccessToDSPResources()
      se_offsetGPRLEN..0 = ( offset15 )GPRLEN-17 || offset15..0 || 01
      branch_condition = ( DSPControlpos:5..0 >= 32 ? 1 : 0 )
I+1:  if ( branch_condition = 1 ) then
          PCGPRLEN..0 = PCGPRLEN..0 + se_offsetGPRLEN..0
      endif

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

With the 17-bit signed instruction offset, the conditional branch range is ±64 Kbytes. Use jump (J) or jump register

(JR) instructions to branch to addresses outside of this range.

Encoding:

P32A

0010000

rt

rs

x

CMP.EQ.PH

0000000

101

P32A

0010000

rt

rs

x

CMP.LE.PH

0010000

101

P32A

0010000

rt

rs

x

CMP.LT.PH

0001000

101

6

5

5

6

7

3

Format:

CMP.cond.PH 

Compare Vectors of Signed Integer Halfword Values

CMP.EQ.PH  rs, rt

DSP

Compare Vectors of Signed Integer Halfword Values

CMP.LT.PH  rs, rt

DSP

Compare Vectors of Signed Integer Halfword Values

CMP.LE.PH  rs, rt

DSP

Compare Vectors of Signed Integer Halfword Values

Purpose:

Compare Vectors of Signed Integer Halfword Values

Perform an element-wise comparison oftwo vectors of two signed integer halfwords, recording the results of the comparison in condition code bits.

Description:

DSPControlccond:25..24 = (rs31..16 cond rt31..16) || (rs15..0 cond rt15..0)

The two signed integer halfword elements in register rs are compared with the corresponding signed integer halfword element in register rt. The two 1-bit boolean comparison results are written to bits 24 and 25 of the DSPControl register’s 4-bit condition code field. The v alues of t he two remaining condition code bi ts (bits 26 t hrough 27 of the

DSPControl register) are UNPREDICTABLE.

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:

CMP.EQ.PH
   ValidateAccessToDSPResources()
   ccB = GPR[rs]31..16 EQ GPR[rt]31..16 
   ccA = GPR[rs]15..0 EQ GPR[rt]15..0 
   DSPControlccond:25..24 = ccB || ccA
   DSPControlccond:27..26 = UNPREDICTABLE
CMP.LT.PH
   ValidateAccessToDSPResources()
   ccB = GPR[rs]31..16 LT GPR[rt]31..16 
   ccA = GPR[rs]15..0 LT GPR[rt]15..0 
   DSPControlccond:25..24 = ccB || ccA
   DSPControlccond:27..26 = UNPREDICTABLE
CMP.LE.PH
   ValidateAccessToDSPResources()
   ccB = GPR[rs]31..16 LE GPR[rt]31..16 
   ccA = GPR[rs]15..0 LE GPR[rt]15..0 
   DSPControlccond:25..24 = ccB || ccA

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

CMPGU.EQ.QB

0011000

101

P32A

001000

rt

rs

rd

x

CMPGU.LE.QB

0101000

101

P32A

001000

rt

rs

rd

x

CMPGU.LT.QB

0100000

101

6

5

5

5

1

7

3

Format:

CMPGU.cond.QB 

Compare Vectors of Unsigned Byte Values and Write Results to a GPR

CMPGU.EQ.QB  rd, rs, rt

DSP

Compare Vectors of Unsigned Byte Values and Write Results to a GPR

CMPGU.LT.QB  rd, rs, rt

DSP

Compare Vectors of Unsigned Byte Values and Write Results to a GPR

CMPGU.LE.QB  rd, rs, rt

DSP

Compare Vectors of Unsigned Byte Values and Write Results to a GPR

Purpose:

Compare Vectors of Unsigned Byte Values and Write Results to a GPR

Perform an element-wise comparison of two vectors of unsigned bytes, recording the results of the comparison in condition code bits that are written to the specified GPR.

Description:

rd = (rs31..24 cond rt31..24) || (rs23..16 cond rt23..16) || (rs15..8 condrt15..8) 
|| (rs7..0 cond rt7..0)

Each of the unsigned byte elements in register rs are compared with the corresponding unsigned byte elements in register rt. The four 1-bit boolean comparison results are written to the four least-significant bits of destination register

rd. The remaining bits in rd are set to zero.

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:

CMPGU.EQ.QB
   ValidateAccessToDSPResources()
   ccD = GPR[rs]31..24 EQ GPR[rt]31..24 
   ccC = GPR[rs]23..16 EQ GPR[rt]23..16 
   ccB = GPR[rs]15..8 EQ GPR[rt]15..8 
   ccA = GPR[rs]7..0 EQ GPR[rt]7..0 
   GPR[rd]31..0 = 0(GPRLEN-4) || ccD || ccC || ccB || ccA
CMPGU.LT.QB
   ValidateAccessToDSPResources()
   ccD = GPR[rs]31..24 LT GPR[rt]31..24 
   ccC = GPR[rs]23..16 LT GPR[rt]23..16 
   ccB = GPR[rs]15..8 LT GPR[rt]15..8 
   ccA = GPR[rs]7..0 LT GPR[rt]7..0 
   GPR[rd]31..0 = 0(GPRLEN-4) || ccD || ccC || ccB || ccA
CMPGU.LE.QB
   ValidateAccessToDSPResources()
   ccB = GPR[rs]15..8 LE GPR[rt]15..8 
   ccA = GPR[rs]7..0 LE GPR[rt]7..0 
   GPR[rd]31..0 = 0(GPRLEN-4) || ccD || ccC || ccB || ccA

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

x

x

CMPU.EQ.QB

1001000

101

P32A

001000

rt

rs

x

x

CMPU.LE.QB

1011000

101

P32A

001000

rt

rs

x

x

CMPU.LT.QB

1010000

101

6

5

5

5

1

7

3

Format:

CMPU.cond.QB 

Compare Vectors of Unsigned Byte Values

CMPU.EQ.QB  rs, rt

DSP

Compare Vectors of Unsigned Byte Values

CMPU.LT.QB  rs, rt

DSP

Compare Vectors of Unsigned Byte Values

CMPU.LE.QB  rs, rt

DSP

Compare Vectors of Unsigned Byte Values

Purpose:

Compare Vectors of Unsigned Byte Values

Perform an element-wise comparison of two vectors of unsigned bytes, recording the results of the comparison in condition code bits.

Description:

DSPControlccond:27..24 = (rs31..24 cond rt31..24) || (rs23..16 cond rt23..16) || 
(rs15..8 cond rt15..8) || (rs7..0 cond rt7..0)

Each of the unsigned byte elements in register rs are compared with the corresponding unsigned byte elements in register rt. The four 1-bit boolean comparison results are written to bits 24 through 27 of the DSPControl register’s 4-bit condition code 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:

CMPU.EQ.QB
   ValidateAccessToDSPResources()
   ccD = GPR[rs]31..24 EQ GPR[rt]31..24 
   ccC = GPR[rs]23..16 EQ GPR[rt]23..16 
   ccB = GPR[rs]15..8 EQ GPR[rt]15..8 
   ccA = GPR[rs]7..0 EQ GPR[rt]7..0 
   DSPControlccond:27..24 = ccD || ccC || ccB || ccA
CMPU.LT.QB
   ValidateAccessToDSPResources()
   ccD = GPR[rs]31..24 LT GPR[rt]31..24 
   ccC = GPR[rs]23..16 LT GPR[rt]23..16 
   ccB = GPR[rs]15..8 LT GPR[rt]15..8 
   ccA = GPR[rs]7..0 LT GPR[rt]7..0 
   DSPControlccond:27..24 = ccD || ccC || ccB || ccA
CMPU.LE.QB
   ValidateAccessToDSPResources()
   ccB = GPR[rs]15..8 LE GPR[rt]15..8 
   ccA = GPR[rs]7..0 LE GPR[rt]7..0 
   DSPControlccond:27..24 = ccD || ccC || ccB || ccA

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

00

000

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPA.W.PH ac, rs, rt

DSP-R2

Dot Product with Accumulate on Vector Integer Halfword Elements

Purpose:

Dot Product with Accumulate on Vector Integer Halfword Elements

Generate the dot-product of two integer halfword vector elements using full-size intermediate products and then accumulate into the specified accumulator register.

Description:

ac = ac + ((rs31..16 * rt31..16) + (rs15..0 * rt15..0))

Each of the two halfword integer values from register rt is multiplied with the corresponding halfword element from register rs to create two integer word results. These two products are summed to generate a dot-product result, which is then accumulated into the specified 64-bit HI/LO accumulator, creating a 64-bit integer result.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction does not set any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempB31..0 = (GPR[rs]31..16 * GPR[rt]31..16)
tempA31..0 = (GPR[rs]15..0 * GPR[rt]15..0)
dotp32..0 = ( tempB31 || tempB31..0 ) + ( tempA31 || tempA31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + ( (dotp32)31 || dotp32..0 )
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 || acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

10

001

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAQX_S.W.PH ac, rs, rt 

DSP-R2

Cross Dot Product with Accumulation on Fractional Halfword Elements

Purpose:

Cross Dot Product with Accumulation on Fractional Halfword Elements

Element-wise cross multipli cation of two vectors of fractional halfword elements and accumu lation of the 32-bit intermediate products into the specified 64-bit accumulator register, with saturation.

Description:

ac = ac + (sat32(rs31..16 * rt15..0) + sat32(rs15..0 * rt31..16))

The left Q15 fractional word value from registers rt is multiplied with the right halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. Similarly, the right

Q15 fractional word value from registers rt is multiplied with the left halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. If both multiplicands for either of the multiplications are equal to -1.0 (0x8000 hexadecimal), the resulting intermediate product is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal).

The two intermediate products are then sign-extended and summed to generate a 64-bit, Q32.31 fractional format dotproduct result that is accumulated in to the specified 64-bit HI/LO accumulator to produce a f inal Q32.31 fractional result.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs as a result of a half word multiplication, a 1 is wr itten to one o f bits 16 through 19 of the

DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds

to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]15..0 )
tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]31..16 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) + ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0
function multiplyQ15Q15( acc1..0, a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
      DSPControlouflag:16+acc = 1
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15

Exceptions:

Encoding:

P32A

001000

rt

rs

ac

11

001

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAQX_SA.W.PH ac, rs, rt 

DSP-R2

Cross Dot Product with Accumulation on Fractional Halfword Elements

Purpose:

Cross Dot Product with Accumulation on Fractional Halfword Elements

Element-wise cross multipli cation of two vectors of fractional halfword elements and accumu lation of the 32-bit intermediate products into the specified 64-bit accumulator register, with saturation of the accumulator.

Description:

ac = sat32(ac + (sat32(rs31..16 * rt15..0) + sat32(rs15..0 * rt31..16)))

The left Q15 fractional word value from registers rt is multiplied with the right halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. Similarly, the right

Q15 fractional word value from registers rt is multiplied with the left halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. If both multiplicands for either of the multiplications are equal to -1.0 (0x8000 hexadecimal), the resulting intermediate product is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal).

The two intermediate products are then sign-extended and summed to generate a 64-bit, Q32.31 fractional format dotproduct result that is accumulated into the specified 64-bit HI/LO accumulator to produce a Q32.31 fractional result. If this result is larger than or equal to +1.0, or smaller than -1.0, it is saturated to the Q31 range.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs as a result of halfword multiplication or accumulation, a 1 is written to one of bits 16 through 19 of the DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]15..0 )
tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]31..16 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) + ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + dotp63..0
if ( tempC63 = 0 ) and ( tempC62..31 != 0 ) then
   tempC63..0 = 032 || 0x7FFFFFFF
   DSPControlouflag:16+acc = 1
endif
if ( tempC63 = 1) and ( tempC62..31 != 132) then
   tempC63..0 = 132 || 0x80000000
   DSPControlouflag:16+acc = 1
endif
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0
function multiplyQ15Q15( acc1..0, a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

00

001

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAQ_S.W.PH ac, rs, rt 

DSP

Dot Product with Accumulation on Fractional Halfword Elements

Purpose:

Dot Product with Accumulation on Fractional Halfword Elements

Element-wise multiplication of two vectors of fractional halfword elements and accumulation of the accumulated 32bit intermediate products into the specified 64-bit accumulator register, with saturation.

Description:

ac = ac + (sat32(rs31..16 * rt31..16) + sat32(rs15..0 * rt15..0))

Each of the two Q15 fractional word values from registers rt and rs are multiplied together, and the results left-shifted by one bit position to generate two Q31 fractional format intermediate products. If both multiplicands for either of the multiplications are equal to -1.0 (0x8000 hexadecimal), the resulting intermediate product is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal).

The two intermediate products are then sign-extended and summed to generate a 64-bit, Q32.31 fractional format dotproduct result that is accumulated in to the specified 64-bit HI/LO accumulator to produce a f inal Q32.31 fractional result.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs as a result of a half word multiplication, a 1 is wr itten to one o f bits 16 through 19 of the

DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds

to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]31..16 )
tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]15..0 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) + ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0
function multiplyQ15Q15( acc1..0, a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
      DSPControlouflag:16+acc = 1
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

01

001

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAQ_SA.L.W ac, rs, rt 

DSP

Dot Product with Accumulate on Fractional Word Element

Purpose:

Dot Product with Accumulate on Fractional Word Element

Multiplication of two fractional word elements, accumulating the product to the specified 64-bit accumulator register, with saturation.

Description:

ac = sat64(ac + sat32(rs31..0 * rt31..0))

The two right-most Q31 fractional word values from registers rt and rs are multiplied together and the result leftshifted by one bit position to generate a 64-bit, Q63 fractional format intermediate product. If both multiplicands are equal to -1.0 (0x80000000 hexadecimal), the intermediate product is saturated to the max imum positive Q63 fractional value (0x7FFFFFFFFFFFFFFF hexadecimal).

The intermediate product is then added to the specified 64-bit HI/LO accumulator, creating a Q63 fractional result. If the accumulation results in overflow or underflow, the accumulator is saturated to either the maximum positi ve or minimum negative Q63 fractional value (0x8000000000000000 hexadecimal), respectively.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs, a 1 is written to one of bits 16 through 19 of the DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to

ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
dotp63..0 = multiplyQ31Q31( ac, GPR[rs]31..0, GPR[rt]31..0 )
temp64..0 = HI[ac]31 || HI[ac]31..0 || LO[ac]31..0
temp64..0 = temp64..0 + dotp63..0
if ( temp64 != temp63 ) then
   if ( temp64 = 1 ) then
      temp63..0 = 0x8000000000000000
   else
      temp63..0 = 0x7FFFFFFFFFFFFFFF
   endif
   DSPControlouflag:16+ac = 1
endif
( HI[ac]31..0 || LO[ac]31..0 ) = temp63..32 || temp31..0 
function multiplyQ31Q31( acc1..0, a31..0, b31..0 )
   if (( a31..0 = 0x80000000 ) and ( b31..0 = 0x80000000 )) then
      temp63..0 = 0x7FFFFFFFFFFFFFFF
      DSPControlouflag:16+acc = 1
   else
      temp63..0 = ( a31..0 * b31..0 ) << 1
   return temp63..0
endfunction multiplyQ31Q31

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

10

000

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAU.H.QBL ac, rs, rt

DSP

Dot Product with Accumulate on Vector Unsigned Byte Elements

Purpose:

Dot Product with Accumulate on Vector Unsigned Byte Elements

Element-wise multiplication of the two left-most elements of the four elements of each of two vectors of unsigned bytes, accumulating the sum of the products into the specified 64-bit accumulator register.

Description:

ac = ac + zero_extend((rs31..24 * rt31..24) + (rs23..16 * rt23..16))

The two left-most elements of the four unsigned byte elements of each of registers rt and rs are multiplied together using unsigned arithmetic to generate two 16-bit unsigned intermediate products. The intermediate products are then zero-extended to 64 bits and accumulated into the specified 64-bit HI/LO accumulator.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction does not set any bits in the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB15..0 = multiplyU8U8( GPR[rs]31..24, GPR[rt]31..24 )
tempA15..0 = multiplyU8U8( GPR[rs]23..16, GPR[rt]23..16 )
dotp63..0 = ( 048 || tempB15..0 ) + ( 048 || tempA15..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + dotp63..0
( HI[ac]31..0 || LO[ac]31..0 )  = tempC63..32 || tempC31..0 
function multiplyU8U8( a7..0, b7..0 )
   temp17..0 = ( 0 || a7..0 ) * ( 0 || b7..0 )
   return temp15..0
endfunction multiplyU8U8

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

11

000

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAU.H.QBR ac, rs, rt

DSP

Dot Product with Accumulate on Vector Unsigned Byte Elements

Purpose:

Dot Product with Accumulate on Vector Unsigned Byte Elements

Element-wise multiplication of the two right-most elements of the four elements of each of two vectors of unsigned bytes, accumulating the sum of the products into the specified 64-bit accumulator register.

Description:

ac = ac + zero_extend((rs15..8 * rt15..8) + (rs7..0 * rt7..0))

The two right-most elements of the four unsigned byte elements of each of registers rt and rs are multiplied together using unsigned arithmetic to generate two 16-bit unsigned intermediate products. The intermediate products are then zero-extended to 64 bits and accumulated into the specified 64-bit HI/LO accumulator.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction does not set any bits in the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB15..0 = multiplyU8U8( GPR[rs]15..8, GPR[rs]15..8 )
tempA15..0 = multiplyU8U8( GPR[rs]7..0, GPR[rs]7..0 )
dotp63..0 = ( 048 || tempB15..0 ) + ( 048 || tempA15..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

01

000

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPAX.W.PH ac, rs, rt

DSP-R2

Cross Dot Product with Accumulate on Vector Integer Halfword Elements

Purpose:

Cross Dot Product with Accumulate on Vector Integer Halfword Elements

Generate the cross dot-product of two integer halfword vector elements using full-size intermediate products and then accumulate into the specified accumulator register.

Description:

ac = ac + ((rs31..16 * rt15..0) + (rs15..0 * rt31..16))

The left halfword integer value from register rt is multiplied with the right halfword element from register rs to create an integer word result. Similarly, the right halfword integer value from register rt is multiplied with the left halfword element from register rs to create the second integer word result. These two products are summed to generate the dotproduct result, which is then accumulated into the specified 64-bit HI/LO accumulator, creating a 64-bit integer result.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction will not set any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = (GPR[rs]31..16 * GPR[rt]15..0)
tempA31..0 = (GPR[rs]15..0 * GPR[rt]31..16)
dotp32..0 = ( (tempB31) || tempB31..0 ) + ( (tempA31) || tempA31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + ( (dotp32)31 || dotp32..0 )
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

00

010

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPS.W.PH ac, rs, rt

DSP-R2

Dot Product with Subtract on Vector Integer Half-Word Elements

Purpose:

Dot Product with Subtract on Vector Integer Half-Word Elements

Generate the dot-product of two integer halfword vector elements using full-size intermediate products and then subtract from the specified accumulator register.

Description:

ac = ac - ((rs31..16 * rt31..16) + (rs15..0 * rt15..0))

Each of the two halfword integer values from register rt is multiplied with the corresponding halfword element from register rs to create tw o integer word results. These two products are summed to generate the dot-product result, which is then subtracted from the specified 64-bit HI/LO accumulator, creating a 64-bit integer result.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction will not set any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempB31..0 = (GPR[rs]31..16 * GPR[rt]31..16)
tempA31..0 = (GPR[rs]15..0 * GPR[rt]15..0)
dotp32..0 = ( (tempB31) || tempB31..0 ) + ( (tempA31) || tempA31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - ( (dotp32)31 || dotp32..0 )
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 || acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

10

011

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSQX_S.W.PH ac, rs, rt 

DSP-R2

Cross Dot Product with Subtraction on Fractional Halfword Elements

Purpose:

Cross Dot Product with Subtraction on Fractional Halfword Elements

Element-wise cross multiplication of two vectors of fractional halfword elements and subtraction of the accumulated

32-bit intermediate products from the specified 64-bit accumulator register, with saturation.

Description:

ac = ac - (sat32(rs31..16 * rt15..0) + sat32(rs15..0 * rt31..16))

The left Q15 fractional word value from registers rt is multiplied with the right halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. Similarly, the right

Q15 fractional word value from registers rt is multiplied with the left halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. If both multiplicands for either of the multiplications are equal to -1.0 (0x8000 hexadecimal), the resulting intermediate product is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal).

The two intermediate products are then sign-extended and summed to generate a 64-bit, Q32.31 fractional format dotproduct result that is subtracted from the specified 64-bit HI/LO accumulator to produce a f inal Q32.31 fractional result.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs as a result of a half word multiplication, a 1 is wr itten to one o f bits 16 through 19 of the

DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds

to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]15..0 )
tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]31..16 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) + ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0
function multiplyQ15Q15( acc1..0, a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
      DSPControlouflag:16+acc = 1
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15

Exceptions:

Encoding:

P32A

001000

rt

rs

ac

11

011

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSQX_SA.W.PH ac, rs, rt 

DSP-R2

Cross Dot Product with Subtraction on Fractional Halfword Elements

Purpose:

Cross Dot Product with Subtraction on Fractional Halfword Elements

Element-wise cross multiplication of two vectors of fractional halfword elements and subtraction of the accumulated

32-bit intermediate products from the specified 64-bit accumulator register, with saturation of the accumulator.

Description:

ac = sat32(ac - (sat32(rs31..16 * rt15..0) + sat32(rs15..0 * rt31..16)))

The left Q15 fractional word value from registers rt is multiplied with the right halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. Similarly, the right

Q15 fractional word value from registers rt is multiplied with the left halfword element from register rs and the result left-shifted by one bit position to generate a Q31 fractional format intermediate product. If both multiplicands for either of the multiplications are equal to -1.0 (0x8000 hexadecimal), the resulting intermediate product is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal).

The two intermediate products are then sign-extended and summed to generate a 64-bit, Q32.31 fractional format dotproduct result that is subtracted from the specified 64-bit HI/LO accumulator to produce a Q32.31 fractional result. If this result is larger than or equal to +1.0, or smaller than -1.0, it is saturated to the Q31 range.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs as a result of halfword multiplication or accumulation, a 1 is written to one of bits 16 through 19 of the DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]15..0 )
tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]31..16 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) + ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - dotp63..0
if ( tempC63 = 0 ) and ( tempC62..31 != 0 ) then
   tempC63..0 = 032 || 0x7FFFFFFF
   DSPControlouflag:16+acc = 1
endif
if ( tempC63 = 1) and ( tempC62..31 != 132) then
   tempC63..0 = 132 || 0x80000000
   DSPControlouflag:16+acc = 1
endif
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0
function multiplyQ15Q15( acc1..0, a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

00

011

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSQ_S.W.PH ac, rs, rt 

DSP

Dot Product with Subtraction on Fractional Halfword Elements

Purpose:

Dot Product with Subtraction on Fractional Halfword Elements

Element-wise multiplication of two vectors of fractional halfword elements and subtraction of the accumulated 32-bit intermediate products from the specified 64-bit accumulator register, with saturation.

Description:

ac = ac - (sat32(rs31..16 * rt31..16) + sat32(rs15..0 * rt15..0))

Each of the two Q15 fractional word values from registers rt and rs are multiplied together, and the results left-shifted by one bit position to generate two Q31 fractional format intermediate products. If both multiplicands for either of the multiplications are equal to -1.0 (0x8000 hexadecimal), the resulting intermediate product is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal).

The two intermediate products are then sign-extended and summed to generate a 64-bit, Q32.31 fractional format dotproduct result that is subtracted from the specified 64-bit HI/LO accumulator to produce a f inal Q32.31 fractional result.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs as a result of a half word multiplication, a 1 is wr itten to one o f bits 16 through 19 of the

DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds

to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]31..16 )
tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]15..0 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) + ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - dotp63..0
( HI[ac]31..0 || LO[ac]31..0 )  = tempC63..32 || tempC31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

01

011

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSQ_SA.L.W ac, rs, rt 

DSP

Dot Product with Subtraction on Fractional Word Element

Purpose:

Dot Product with Subtraction on Fractional Word Element

Multiplication of two fractional word elements, subtracting the accumulated product from the specified 64-bit accumulator register, with saturation.

Description:

ac = sat64(ac - sat32(rs31..0 * rt31..0))

The two right-most Q31 fractional word values from registers rt and rs are multiplied together and the resul t leftshifted by one bit position to generate a 64-bit Q63 fractional format intermediate product. If both multiplicands are equal to -1.0 (0x80000000 hexadecimal), the intermediate product is saturated to the max imum positive Q63 fractional value (0x7FFFFFFFFFFFFFFF hexadecimal).

The intermediate product is then subtracted from the specified 64-bit HI/LO accumulator, creating a Q63 fractional result. If the accumulation results in overflow or underflow, the accumulator is saturated to either the maximum positive or minimum negative Q63 fractional value (0x8000000000000000 hexadecimal), respectively.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs, a 1 is written to one of bits 16 through 19 of the DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to

ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
dotp63..0 = multiplyQ31Q31( ac, GPR[rs]31..0, GPR[rt]31..0 )
temp64..0 = HI[ac]31 || HI[ac]31..0 || LO[ac]31..0
temp64..0 = temp - dotp63..0
if ( temp64 != temp63 ) then
   if ( temp64 = 1 ) then
      temp63..0 = 0x8000000000000000
   else
      temp63..0 = 0x7FFFFFFFFFFFFFFF
   endif
   DSPControlouflag:16+ac = 1
endif
( HI[ac]31..0 || LO[ac]31..0 )  = temp63..32 || temp31..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

10

010

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSU.H.QBL ac, rs, rt

DSP

Dot Product with Subtraction on Vector Unsigned Byte Elements

Purpose:

Dot Product with Subtraction on Vector Unsigned Byte Elements

Element-wise multiplication of two left-most elements from the four elements of each oftwo vectors of unsigned bytes, subtracting the sum of the products from the specified 64-bit accumulator register.

Description:

ac = ac - zero_extend((rs31..24 * rt31..24) + (rs23..16 * rt23..16))

The two left-most elements of the four unsigned byte elements of each of registers rt and rs are multiplied together using unsigned arithmetic to generate two 16-bit unsigned intermediate products. The intermediate products are then zero-extended to 64 bits and subtracted from the specified 64-bit HI/LO accumulator. The result of the subtraction is written back to the specified 64-bit HI/LO accumulator.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction does not set any bits in the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB15..0 = multiplyU8U8( GPR[rs]31..24, GPR[rt]31..24 )
tempA15..0 = multiplyU8U8( GPR[rs]23..16, GPR[rt]23..16 )
dotp63..0 = ( 048 || tempB15..0 ) + ( 048 || tempA15..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

11

010

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSU.H.QBR ac, rs, rt

DSP

Dot Product with Subtraction on Vector Unsigned Byte Elements

Purpose:

Dot Product with Subtraction on Vector Unsigned Byte Elements

Element-wise multiplication of the two right-most elements of the four elements of each of two vectors of unsigned bytes, subtracting the sum of the products from the specified 64-bit accumulator register.

Description:

ac = ac - zero_extend((rs15..8 * rt15..8) + (rs7..0 * rt7..0))

The two right-most elements of the four unsigned byte elements of each of registers rt and rs are multiplied together using unsigned arithmetic to generate two 16-bit unsigned intermediate products. The intermediate products are then zero-extended to 64 bits and subtracted from the specified 64-bit HI/LO accumulator.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction does not set any bits in the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB15..0 = multiplyU8U8( GPR[rs]15..8, GPR[rt]15..8 )
tempA15..0 = multiplyU8U8( GPR[rs]7..0, GPR[rt]7..0 )
dotp63..0 = ( 048 || tempB15..0 ) + ( 048 || tempA15..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

01

010

010

111

111

6

5

5

2

2

3

3

3

3

Format:

DPSX.W.PH ac, rs, rt

DSP-R2

Cross Dot Product with Subtract on Vector Integer Halfword Elements

Purpose:

Cross Dot Product with Subtract on Vector Integer Halfword Elements

Generate the cross dot-product of two integer halfword vector elements using full-size intermediate products and then subtract from the specified accumulator register.

Description:

ac = ac - ((rs31..16 * rt15..0) + (rs15..0 * rt31..16))

The left halfword integer value from register rt is multiplied with the right halfword element from register rs to create an integer word result. Similarly, the right halfword integer value from register rt is multiplied with the left halfword element from register rs to create the second integer word result. These two products are summed to generate the dotproduct result, which is then subtracted from the specified 64-bit HI/LO accumulator, creating a 64-bit integer result.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction will not set any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB31..0 = (GPR[rs]31..16 * GPR[rt]15..0)
tempA31..0 = (GPR[rs]15..0 * GPR[rt]31..16)
dotp32..0 = ( (tempB31) || tempB31..0 ) + ( (tempA31) || tempA31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - ( (dotp32)31 || dotp32..0 )
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

size

ac

11

011

001

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTPDP rt, ac, size

DSP

Extract Fixed Bitfield From Arbitrary Position in Accumulator to GPR and Decrement Pos

Purpose:

Extract Fixed Bitfield From Arbitrary Position in Accumulator to GPR and Decrement Pos

Extract size+1 contiguous bits from a 64-bit accumulator from a position specified in the DSPControl register, writing the bits to a GPR with zero-extension and modifying the extraction position.

Description:

rt = zero_extend(acpos..pos-size) ; DSPControlpos:5..0 -= (size+1)

A set of size+1 contiguous bits are extracted from an arbitrary position in accumulator ac, zero-extended to 32 bits, then written to register rt.

The bit position, start_pos, of the first bit of the contiguous set to extract is specified by the pos field in bits 0 through

5 of the DSPControl register. The position of the last bit in the extracted set is start_pos - size, where the size argument is specified in the instruction.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, accumulator ac remains unmodified.

If start_possize, the extraction is valid and the value of the pos field in the DSPControl register is decre–(1+)1–>= mented by size+1. Otherwise, the extraction is invalid and is said to have failed. The value of the destination register is UNPREDICTABLE when the extraction is invalid, and the value of the pos field in the DSPControl register (bits 0 through 5) is not modified.

Upon an invalid extraction this instruction writes a 1 to bit 14, the Extract Failed Indicator (EFI) bit of the DSPControl register, and 0 otherwise.

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()
start_pos5..0 = DSPControlpos:5..0
if ( start_pos - (size+1) >= -1 ) then
   tempsize..0 = ( HI[ac]31..0 || LO[ac]31..0 )start_pos..start_pos-size
   GPR[rt] = 0(GPRLEN-(size+1)) || tempsize..0
   DSPControlpos:5..0 = DSPControlpos:5..0 - (size + 1)
   DSPControlEFI:14 = 0
else
   DSPControlEFI:14 = 1
   GPR[rt] = UNPREDICTABLE
endif

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

size

ac

10

011

001

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTP rt, ac, size

DSP

Extract Fixed Bitfield From Arbitrary Position in Accumulator to GPR

Purpose:

Extract Fixed Bitfield From Arbitrary Position in Accumulator to GPR

Extract size+1 contiguous bits from a 64-bit accumulator from a position specified in the DSPControl register, writing the bits to a GPR with zero-extension.

Description:

rt = zero_extend(acpos..pos-size)

A set of size+1 contiguous bits are extracted from an arbitrary position in accumulator ac, zero-extended to 32 bits, and then written to register rt.

The bit position, start_pos, of the first bit of the contiguous set to extract is specified by the pos field in bits 0 through

5 of the DSPControl register. The last bit in the set is start_pos - size, where size is specified in the instruction.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, accumulator ac remains unmodified.

If start_possize, the extraction is valid, otherwise the extraction is invalid and is said to have failed. The–(1+)1–>= value of the destination register is UNPREDICTABLE when the extraction is invalid. Upon an invalid extraction this instruction writes a 1 to bit 14, the Extract Failed Indicator (EFI) bit of the DSPControl register, and 0 otherwise.

The values of bits 0 to 5 in the pos field of the DSPControl register are unchanged by this instruction.

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()
start_pos5..0 = DSPControlpos:5..0
if ( start_pos - (size+1) >= -1 ) then
   tempsize..0 = ( HI[ac]31..0 || LO[ac]31..0 )start_pos..start_pos-size
   temp31..0 = 0(32-(size+1)) || tempsize..0
   GPR[rt]31..0 = temp31..0
   DSPControlEFI:14 = 0
else
   DSPControlEFI:14 = 1
   GPR[rt] = UNPREDICTABLE
endif

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

10

100

010

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTPV rt, ac, rs

DSP

Extract Variable Bitfield From Arbitrary Position in Accumulator to GPR

Purpose:

Extract Variable Bitfield From Arbitrary Position in Accumulator to GPR

Extract a variable number of contiguous bits from a 64-bit accumulator from a position specified in the DSPControl register, writing the bits to a GPR with zero-extension.

Description:

rt = zero_extend(acpos..pos-rs[4:0])

A variable number of contiguous bits are extracted from an arbitrary position in accumulator ac, zero-extended to 32 bits, then written to register rt. The number of bits extracted is size+1, where size is specified by the five least-significant bits in register rs, interpreted as a five-bit unsigned integer. The remaining bits in register rs are ignored.

The position of the first bit of the contiguous set to extract, start_pos, is specified by the pos field in bits 0 through 5 of the DSPControl register. The position of the last bit in the contiguous set is start_pos - size.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, accumulator ac remains unmodified.

An extraction is valid if start_possize; otherwise, the extraction is invalid and is said to have failed. The–(1+)1–>= value of the destination register is UNPREDICTABLE when the extraction is invalid. Upon an invalid extraction this instruction writes a 1 to bit 14, the Extract Failed Indicator (EFI) bit of the DSPControl register, and 0 otherwise.

The values of bits 0 to 5 in the pos field of the DSPControl register are unchanged by this instruction.

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()
start_pos5..0 = DSPControlpos:5..0
size4..0 = GPR[rs]4..0
if ( start_pos - (size+1) >= -1 ) then
   tempsize..0 = ( HI[ac]31..0 || LO[ac]31..0 )start_pos..start_pos-size
   GPR[rt] = 0(GPRLEN-(size+1)) || tempsize..0
   DSPControlEFI:14 = 0
else
   DSPControlEFI:14 = 1
   GPR[rt] = UNPREDICTABLE
endif

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

EXTRV.W

00

111

010

111

111

P32A

001000

rt

rs

ac

EXTRV_R.W

01

111

010

111

111

P32A

001000

rt

rs

ac

EXTRV_RS.W

10

111

010

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTRV[_RS].W 

Extract Word Value With Variable Right Shift From Accumulator to GPR

EXTRV.W   rt, ac, rs

DSP

Extract Word Value With Variable Right Shift From Accumulator to GPR

EXTRV_R.W rt, ac, rs

DSP

Extract Word Value With Variable Right Shift From Accumulator to GPR

EXTRV_RS.W rt, ac, rs

DSP

Extract Word Value With Variable Right Shift From Accumulator to GPR

Purpose:

Extract Word Value With Variable Right Shift From Accumulator to GPR

Extract a word value from a 64-bit accumulator to a GPR with variable right shift, and with optional rounding or rounding and saturation.

Description:

rt = sat32(round(ac >> rs5..0))

The value in accumulator ac is shifted right by shift bits with sign extension (arithmetic shift right). The lower 32 bits of the shifted value are then written to the destination register rt. The number of bits to shift is given by the five leastsignificant bits of register rs; the remaining bits of rs are ignored.

The rounding variant of the instruction adds a 1 at the most-significant discarded bit position. The 32 least-significant bits of the rounded result are then written to the destination register.

The rounding and saturating variant of the i nstruction adds a 1 at the most-significant discarded bit position. If the rounding operation results in an overflow, the shifted value is clamped to the maximum positive Q31 fractional value

(0x7FFFFFFF hexadecimal). The rounded and saturated result is then written to the destination register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, ac remains unmodified.

For all variants of the instruction, including EXTRV.W, bit 23 of th e DSPControl register is set to 1 if either of the rounded or non-rounded calculation results in overflow or saturation.

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:

EXTRV.W
   ValidateAccessToDSPResources()
   temp64..0 = _shiftShortAccRightArithmetic( ac, GPR[rt]4..0 )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   GPR[rt]31..0 = temp32..1
   temp64..0 = temp + 1
      DSPControlouflag:23 = 1
   endif
EXTRV_R.W
   ValidateAccessToDSPResources()
   temp64..0 = _shiftShortAccRightArithmetic( ac, GPR[rt]4..0 )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   GPR[rt]31..0 = temp32..1
EXTRV_RS.W
   ValidateAccessToDSPResources()
   temp64..0 = _shiftShortAccRightArithmetic( ac, GPR[rt]4..0 )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      if ( temp64 = 0 ) then
          temp32..1 = 0x7FFFFFFF
      else
          temp32..1 = 0x80000000
      endif
      DSPControlouflag:23 = 1
   endif
   GPR[rt]31..0 = temp32..1

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

11

111

010

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTRV_S.H rt, ac, rs

DSP

Extract Halfword Value Variable From Accumulator to GPR With Right Shift and Saturate

Purpose:

Extract Halfword Value Variable From Accumulator to GPR With Right Shift and Saturate

Extract a halfword value from a 64-bit accumulator to a GPR with right shift and saturation.

Description:

rt = sat16(ac >> rs4..0)

The value in the 64-bit accumulator ac is shifted right by shift bits with sign extension (arithmetic shift right). The 64bit value is then saturated to 16-bits and sign-extended to 32 bits before being written to the destination register rt.

The five least-significant bits of register rs provide the shift argument, interpreted as a five-bit unsigned integer; the remaining bits in rs are ignored.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, ac remains unmodified.

This instruction sets bit 23 of the DSPControl register in the ouflag field if the operation results in saturation.

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()
shift4..0 = GPR[rs]4..0
temp31..0 = shiftShortAccRightArithmetic( ac, shift )
if ( temp63..0 > 0x0000000000007FFF ) then
   temp31..0 = 0x00007FFF
   DSPControl23 = 1
else if ( temp63..0 < 0xFFFFFFFFFFFF8000 ) then
   temp31..0 = 0xFFFF8000
   DSPControl23 = 1
endif
GPR[rt]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

shift

ac

EXTR.W

00

111

001

111

111

P32A

001000

rt

shift

ac

EXTR_R.W

01

111

001

111

111

P32A

001000

rt

shift

ac

EXTR_RS.W

10

111

001

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTR[_RS].W 

Extract Word Value With Right Shift From Accumulator to GPR

EXTR.W   rt, ac, shift

DSP

Extract Word Value With Right Shift From Accumulator to GPR

EXTR_R.W  rt, ac, shift

DSP

Extract Word Value With Right Shift From Accumulator to GPR

EXTR_RS.W rt, ac, shift

DSP

Extract Word Value With Right Shift From Accumulator to GPR

Purpose:

Extract Word Value With Right Shift From Accumulator to GPR

Extract a word value from a 64-bit accumulator to a GPR with right shift, and with optional rounding or rounding and saturation.

Description:

rt = sat32(round(ac >> shift))

The value in accumulator ac is shifted right by shift bits with sign extension (arithmetic shift right). The 32 least-significant bits of the shifted value are then written to the destination register rs.

The rounding variant of the instruction adds a 1 at the most-significant discarded bit position. The 32 least-significant bits of the rounded result are then written to the destination register.

The rounding and saturating variant of the i nstruction adds a 1 at the most-significant discarded bit position. If the rounding operation results in an overflow, the shifted value is clamped to the maximum positive Q31 fractional value

(0x7FFFFFFF hexadecimal). The rounded and saturated result is then written to the destination register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, ac remains unmodified.

For all variants of the instruction, including EXTR.W, bit 23 of the DSPControl register is set to 1 if either of the rounded or non-rounded calculation results in overflow or saturation.

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:

EXTR.W
   ValidateAccessToDSPResources()
   temp64..0 = _shiftShortAccRightArithmetic( ac, shift )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF ) ) then
      DSPControlouflag:23 = 1
   endif
   GPR[rt]31..0 = temp32..1
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
   endif
EXTR_R.W
   ValidateAccessToDSPResources()
   temp64..0 = _shiftShortAccRightArithmetic( ac, shift )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   GPR[rt]31..0 = temp32..1
EXTR_RS.W
   ValidateAccessToDSPResources()
   temp64..0 = _shiftShortAccRightArithmetic( ac, shift )
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      DSPControlouflag:23 = 1
   endif
   temp64..0 = temp + 1
   if (( temp64..32 != 0 ) and ( temp64..32 != 0x1FFFFFFFF )) then
      if ( temp64 = 0 ) then
          temp32..1 = 0x7FFFFFFF
      else
          temp32..1 = 0x80000000
      endif
      DSPControlouflag:23 = 1
   endif
   GPR[rt]31..0 = temp32..1
function _shiftShortAccRightArithmetic( ac1..0, shift4..0 )
   if ( shift4..0 = 0 ) then
      temp64..0 = ( HI[ac]31..0 || LO[ac]31..0 || 0 )
   else
      temp64..0 = ( (HI[ac]31)shift || HI[ac]31..0 || LO[ac]31..shift-1 )
   endif
   return temp64..0
endfunction _shiftShortAccRightArithmetic

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

shift

ac

11

111

001

111

111

6

5

5

2

2

3

3

3

3

Format:

EXTR_S.H rt, ac, shift

DSP

Extract Halfword Value From Accumulator to GPR With Right Shift and Saturate

Purpose:

Extract Halfword Value From Accumulator to GPR With Right Shift and Saturate

Extract a halfword value from a 64-bit accumulator to a GPR with right shift and saturation.

Description:

rt = sat16(ac >> shift)

The value in the 64-bit accumulator ac is shifted right by shift bits with sign extension (arithmetic shift right). The 64bit value is then saturated to 16-bits, sign extended to 32 bits, and written to the destination register rt. The shift argument is provided in the instruction.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture. After the execution of this instruction, ac remains unmodified.

This instruction sets bit 23 of the DSPControl register in the ouflag field if the operation results in saturation.

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()
temp63..0 = shiftShortAccRightArithmetic( ac, shift )
if ( temp63..0 > 0x0000000000007FFF ) then
   temp31..0 = 0x00007FFF
   DSPControlouflag:23 = 1
else if ( temp63..0 < 0xFFFFFFFFFFFF8000 ) then
   temp31..0 = 0xFFFF8000
   DSPControlouflag:23 = 1
endif
GPR[rt]31..0 = temp31..0
function shiftShortAccRightArithmetic( ac1..0, shift4..0 )
   sign = HI[ac]31
   if ( shift = 0 ) then
      temp63..0 = HI[ac]31..0 || LO[ac]31..0
   else
      temp63..0 = signshift || (( HI[ac]31..0 || LO[ac]31..0 ) >> shift )
   endif
   if ( sign != temp31 ) then
      DSPControlouflag:23 = 1
   endif
   return temp63..0
endfunction shiftShortAccRightArithmetic

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0100000

100

111

111

6

5

5

7

3

3

3

Format:

INSV rt, rs

MIPSDSP

Insert Bit Field Variable

Purpose:

Insert Bit Field Variable

To merge a right-justified bit field from register rs into a specified field in register rt.

Description:

rt = InsertFieldVar(rt, rs, Scount, Pos)

The DSPControl register provides the size value from the Scount field, and the pos value from the pos field. The rightmost size bits from register rs are merged into the value from register rt starting at bit position pos. The result is put back in register rt. These pos and size values are converted by the instruction into the fields msb (the most significant bit of the field), and lsb (least significant bit of the field), as follows:

pos = DSPControl5..0
size = DSPControl12..7
msb = pos+size-1
lsb = pos

The values of pos and size must satisfy all of the following relations, or the instruction results in UNPREDICTABLE results:

0 <= pos < 32
0 < size <= 32
0 < pos+size <= 32

Restrictions:

The operation is UNPREDICTABLE if lsb > msb.

Operation:

ValidateAccessToDSPResources()
if (lsb > msb) then
UNPREDICTABLE
endif
GPR[rt]31..0 = GPR[rt]31..msb+1 || GPR[rs]msb-lsb..0 || GPR[rt]lsb-1..0

Exceptions:

Reserved Instruction, DSP Disabled

Implementation Notes

The destination of this instruction is register rt because that register is used as both a source and destination of the instruction. Since most implementations have potential critical paths around source register decode, and typically decode registers rs and rt as source registers, the instruction is defined with the destination as register rt instead of register rd to minimize the impact on source register decode.

One implementation method is to shift the register rs value left by lsb bits and merge that value into the register rt value based on a merge mask. The merge mask has a 1 in every bit position from which the corresponding output bit comes from register rs and a 0 in every bit position from which the corresponding output bit comes from register rt.

The mask can be calculated by subtracting two constants generated from the fields of the instruction, as follows:

k1 = 032-lsb-1 || 1 || 0lsb
k2 = (033-(msb+2) || 1 || 0msb+1)31..0
merge_mask = k2 - k1

Some implementations may choose to use the ALU to calculate the merge_mask in parallel with shifting the register

rs value to the left, then using the merge_mask to bit-select from the register rt value or the shifted register rs value.

Encoding:

Format:

LBUX rd, index(base)

DSP

Load Unsigned Byte Indexed

LBUX rd, rs(rt)

Replaced with LBUX in nanoMIPS

Load Unsigned Byte Indexed

Purpose:

Load Unsigned Byte Indexed

To load a byte from memory as an unsigned value, using indexed addressing.

Description:

 rd = memory[base+index]

The contents of GPR index is added to the contents of GPR base to form an effective address. The contents of the 8bit byte at the memory location specified by the aligned effective address are fetched, zero-extended to the GPR register length and placed in GPR rd.

Restrictions:

None.

Operation:

ValidateAccessToDSPResources()
vAddr31..0 = GPR[index]31..0 + GPR[base]31..0
( pAddr, CCA ) = AddressTranslation( vAddr, DATA, LOAD )
pAddr = pAddrPSIZE-1..2 || ( pAddr1..0 xor ReverseEndian2 )
memwordGPRLEN..0 = LoadMemory ( CCA, BYTE, pAddr, vAddr, DATA )
GPR[rd]31..0 = zero_extend( memword7..0 )

Exceptions:

Reserved Instruction, DSP Disabled, TLB Refill, TLB Invalid, Bus Error, Address Error, Watch

Encoding:

Format:

LHX rd, index(base)

DSP

Load Halfword Indexed

LHX rd, rs(rt)

Replaced with LHX in nanoMIPS

Load Halfword Indexed

Purpose:

Load Halfword Indexed

To load a halfword value from memory as a signed value, using indexed addressing.

Description:

 rd = memory[base+index]

The contents of GPR index is added to the contents of GPR base to form an effective address. The contents of the 16bit halfword at the memory location specified by the aligned effective address are fetched, sign-extended to the length of the destination GPR, and placed in GPR rd.

Restrictions:

The effective address must be naturally-aligned. If the least-significant bit of the ef fective address is non-zero, an

Address Error exception occurs.

Operation:

ValidateAccessToDSPResources()
vAddr31..0 = GPR[index]31..0 + GPR[base]31..0
if ( vAddr0 != 0 ) then
   SignalException( AddressError )
endif
( pAddr, CCA ) = AddressTranslation( vAddr, DATA, LOAD )
halfwordGPRLEN..0 = LoadMemory( CCA, HALFWORD, pAddr, vAddr, DATA )
GPR[rd]31..0 = sign_extend( halfword15..0 )

Exceptions:

Reserved Instruction, DSP Disabled, TLB Refill, TLB Invalid, Bus Error, Address Error, Watch

Encoding:

Format:

LWX rd, index(base)

DSP

Load Word Indexed

LWX rd, rs(rt)

Replaced with LWX in nanoMIPS

Load Word Indexed

Purpose:

Load Word Indexed

To load a word value from memory as a signed value, using indexed addressing.

Description:

 rd = memory[base+index]

The contents of GPR index is added to the contents of GPR base to form an effective address. The contents of the 32bit word at the memory location specified by the aligned effective address are fetched and placed in GPR rd.

Restrictions:

The effective address must be naturally-aligned. If either of the two least-significant bits of the address are non-zero, an Address Error exception occurs.

Operation:

ValidateAccessToDSPResources()
vAddr31..0 = GPR[index]31..0 + GPR[base]31..0
if ( vAddr1..0 != 02 ) then
   SignalException( AddressError )
endif
( pAddr, CCA ) = AddressTranslation( vAddr, DATA, LOAD )
memwordGPRLEN..0 = LoadMemory( CCA, WORD, pAddr, vAddr, DATA )
GPR[rd]31..0 = memword31..0

Exceptions:

Reserved Instruction, DSP Disabled, TLB Refill, TLB Invalid, Bus Error, Address Error, Watch

Encoding:

P32A

001000

rt

rs

ac

00

101

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MADD ac, rs, rt

DSP

Multiply Word and Add to Accumulator

Purpose:

Multiply Word and Add to Accumulator

To multiply two 32-bit integer words and add the 64-bit result to the specified accumulator.

Description:

 (HI[ac]||LO[ac]) = (HI[ac]||LO[ac]) + (rs31..0 * rt31..0)

The 32-bit signed integer word in register rs is multiplied by the corresponding 32-bit signed integer word in register

rt to produce a 64-bit result. The 64-bit product is added to the specified 64-bit accumulator.

These special registers HI and LO are specified by the value of ac. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

No arithmetic exception occurs under any circumstances.

Restrictions:

None

This instruction does not provide the capability of writing directly to a target GPR.

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSP2Resources()
endif
temp63..0 = ((GPR[rs]31)32 || GPR[rs]31..0) * ((GPR[rt]31)32 || GPR[rt]31..0)
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + temp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 || acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Implementation Notes:

Processors which implement a multiplier array which is not square (for example, 32 x 16), and which therefore has an operation latency which is data dependent, should assume that the shorter operand is in register rt.

Programming Notes:

In some processors the integer multiply operation may proceed asynchronously and allow other CPU instructions to execute before it is complete. An attempt to read LO or HI before the results are written interlocks until the results are ready. Asynchronous execution does not af fect the program result, but offers an opportunity for performance improvement by scheduling the multiply so that other instructions can execute in parallel.

Programs that require overflow detection must check for it explicitly.

Where the size of the operands are known, software should place the shorter operand in register rt. This may reduce the latency of the instruction on those processors which implement data-dependent instruction latencies.

Encoding:

P32A

001000

rt

rs

ac

01

101

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MADDU ac, rs, rt

DSP

Multiply Unsigned Word and Add to Accumulator

Purpose:

Multiply Unsigned Word and Add to Accumulator

To multiply two 32-bit unsigned integer words and add the 64-bit result to the specified accumulator.

Description:

 (HI[ac]||LO[ac]) = (HI[ac]||LO[ac]) + (rs31..0 * rt31..0)

The 32-bit unsigned integer word in register rs is multiplied by the corresponding 32-bit unsigned integer word in register rt to produce a 64-bit result. The 64-bit product is added to the specified 64-bit accumulator.

These special registers HI and LO are specified by the value of ac. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

No arithmetic exception occurs under any circumstances.

Restrictions:

None

This instruction does not provide the capability of writing directly to a target GPR.

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSP2Resources()
endif
temp64..0 = (032 || GPR[rs]31..0 ) * ( 032 || GPR[rt]31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + temp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 || acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Implementation Notes:

Processors which implement a multiplier array which is not square (for example, 32 x 16), and which therefore has an operation latency which is data dependent, should assume that the shorter operand is in register rt.

Programming Notes:

In some processors the integer multiply operation may proceed asynchronously and allow other CPU instructions to execute before it is complete. An attempt to read LO or HI before the results are written interlocks until the results are ready. Asynchronous execution does not af fect the program result, but offers an opportunity for performance improvement by scheduling the multiply so that other instructions can execute in parallel.

Programs that require overflow detection must check for it explicitly.

Where the size of the operands are known, software should place the shorter operand in register rt. This may reduce the latency of the instruction on those processors which implement data-dependent instruction latencies.

Encoding:

P32A

001000

rt

rs

ac

MAQ_S.W.PHL

0

1

101

001

111

111

P32A

001000

rt

rs

ac

MAQ_SA.W.PHL

1

1

101

001

111

111

6

5

5

2

1

1

3

3

3

3

Format:

MAQ_S[A].W.PHL 

Multiply with Accumulate Single Vector Fractional Halfword Element

MAQ_S.W.PHL  ac, rs, rt 

DSP

Multiply with Accumulate Single Vector Fractional Halfword Element

MAQ_SA.W.PHL ac, rs, rt

DSP

Multiply with Accumulate Single Vector Fractional Halfword Element

Purpose:

Multiply with Accumulate Single Vector Fractional Halfword Element

To multiply one pair of elements from two vectors of fractional halfword values using full-sized intermediate products and accumulate the result into the specified 64-bit accumulator, with optional saturating accumulation.

Description:

ac = sat32(ac + sat32(rs31..16 * rt31..16))

The left-most Q15 fractional halfword values from the paired halfword vectors in each of registers rt and rs are multiplied together, and the product left-shifted by o ne bit po sition to gen erate a Q31 fractional format intermediate result. If both multiplicands are equal to -1.0 in Q15 fractional format (0x8000 hexadecimal), the intermediate result is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal). The intermediate result is then sign-extended and accumulated into accumulator ac to generate a 64-bit Q32.31 fractional format result.

In the saturating accumulation variant of this instruction, if the accumulati on of the intermediate product with the accumulator results in a value that cannot be represented as a Q31 fractional format value, the accumulator is saturated to either the maximum positive Q31 fractional format value (0x7FFFFFFF hexadecimal) or the minimum negative Q31 fractional format value (0x80000000), sign-extended to 64 bits.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If overflow or saturation occurs, a 1 is wri tten to one of bits 16 through 19 of the DSPControl register, within the

ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

MAQ_S.W.PHL
   ValidateAccessToDSPResources()
   tempA31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]31..16 )
   tempB63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + ( (tempA31)32 || tempA31..0 )
   ( HI[ac]31..0 || LO[ac]31..0 )  = tempB63..32 || tempB31..0
MAQ_SA.W.PHL
   ValidateAccessToDSPResources()
   tempA31..0 = multiplyQ15Q15( ac, GPR[rs]31..16, GPR[rt]31..16 )
   tempA31..0 = sat32AccumulateQ31( ac, temp )
   tempB63..0 = (tempA31)32 || tempA31..0
function sat32AccumulateQ31( acc1..0, a31..0 )
   signA = a31
   temp63..0 = HI[acc]31..0 || LO[acc]31..0
   temp63..0 = temp + ( (signA)32 || a31..0 )
   if ( temp32 != temp31 ) then
      if ( temp32 = 0 ) then
          temp31..0 = 0x80000000
      else
          temp31..0 = 0x7FFFFFFF
      endif
      DSPControlouflag:16+acc = 1
   endif
   return temp31..0
endfunction sat32AccumulateQ31

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The MAQ_SA version of the instruction is useful for compliance with some ITU speech processing codecs that require a 32-bit saturation after every multiply-accumulate operation.

Encoding:

P32A

001000

rt

rs

ac

MAQ_S.W.PHR

0

0

101

001

111

111

P32A

001000

rt

rs

ac

MAQ_SA.W.PHR

1

0

101

001

111

111

6

5

5

2

1

1

3

3

3

3

Format:

MAQ_S[A].W.PHR 

Multiply with Accumulate Single Vector Fractional Halfword Element

MAQ_S.W.PHR  ac, rs, rt 

DSP

Multiply with Accumulate Single Vector Fractional Halfword Element

MAQ_SA.W.PHR ac, rs, rt

DSP

Multiply with Accumulate Single Vector Fractional Halfword Element

Purpose:

Multiply with Accumulate Single Vector Fractional Halfword Element

To multiply one pair of elements from two vectors of fractional halfword values using full-sized intermediate products and accumulate the result into the specified 64-bit accumulator, with optional saturating accumulation.

Description:

ac = sat32(ac + sat32(rs15..0 * rt15..0))

The right-most Q15 fr actional halfword values from each of the re gisters rt and rs are multiplied together and the product left-shifted by one bit position to generate a Q31 fractional format intermediate result. If both multiplicands are equal to -1.0 in Q15 fractional format (0x8000 hexadecimal), the intermediate result is saturated to the maximum positive Q31 fractional value (0x7FFFFFFF hexadecimal). The intermediate result is then sign-extended and accumulated into accumulator ac to generate a 64-bit Q32.31 fractional format result.

In the saturating accumulation variant of this instruction, if the accumulati on of the intermediate product with the accumulator results in a value that cannot be represented as a Q31 fractional format value, the accumulator is saturated to either the maximum positive Q31 fractional format value (0x7FFFFFFF hexadecimal) or the minimum negative Q31 fractional format value (0x80000000), sign-extended to 64 bits.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If overflow or saturation occurs, a 1 is wri tten to one of bits 16 through 19 of the DSPControl register, within the

ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to ac3.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

MAQ_S.W.PHR
   ValidateAccessToDSPResources()
   tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]15..0 )
   tempB63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + ( (tempA31)32 || tempA31..0 )
   ( HI[ac]31..0 || LO[ac]31..0 )  = tempB63..32 || tempB31..0
MAQ_SA.W.PHR
   ValidateAccessToDSPResources()
   tempA31..0 = multiplyQ15Q15( ac, GPR[rs]15..0, GPR[rt]15..0 )
   tempA31..0 = sat32AccumulateQ31( ac, temp )
   tempB63..0 = (tempA31)32 || tempA31..0

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The MAQ_SA version of the instruction is useful for compliance with some ITU speech processing codecs that require a 32-bit saturation after every multiply-accumulate operation.

Encoding:

P32A

001000

rt

x

ac

00

000

001

111

111

6

5

5

2

2

3

3

3

3

Format:

MFHI rs, ac

DSP

Move from HI register

Purpose:

Move from HI register

To copy the special purpose HI register to a GPR.

Description:

rs = HI[ac]

The HI part of accumulator ac is copied to the general-purpose register rs. The HI part of the accumulator is defined to be bits 32 through 63 of the DSP Module accumulator register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

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:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSPResources()
endif
GPR[rs]31..0 = HI[ac]31..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

x

ac

01

000

001

111

111

6

5

5

2

2

3

3

3

3

Format:

MFLO rt, ac

DSP

Move from LO register

Purpose:

Move from LO register

To copy the special purpose LO register to a GPR.

Description:

rt = LO[ac]

The LO part of accumulator ac is copied to the general-purpose register rt. The LO part of the accumulator is defined to be bits 0 through 31 of the DSP Module accumulator register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

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:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSPResources()
endif
GPR[rt]31..0 = LO[ac]31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1010010

101

6

5

5

5

1

7

3

Format:

MODSUB  rd, rs, rt

DSP

Modular Subtraction on an Index Value

Purpose:

Modular Subtraction on an Index Value

Do a modular subtraction on a specified index value, using the specified decrement and modular roll-around values.

Description:

rd = (GPR[rs]==0 ? zero_extend(GPR[rt]23..8) : GPR[rs] - GPR[rt]7..0)

The 32-bit value in register rs is compared to the value zero. If it is zero, then the index value has reached the bottom of the buffer and must be rolled back around to the top of the buffer. The index value of the top element of the buffer is obtained from bits 8 through 23 in register rt; this value is zero-extended to 32 bits and written to destination register rd.

If the value of register rs is not zero, then it is simply decremented by the size of the elements in the buffer. The size of the elements, in bytes, is specified by bits 0 through 7 of register rt, interpreted as an unsigned integer.

This instruction does not modify the ouflag field in the DSPControl register.

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()
decr7..0 = GPR[rt]7..0
lastindex15..0 = GPR[rt]23..8
if ( GPR[rs]31..0 = 0x00000000 ) then
   GPR[rd]31..0 = 0(GPRLEN-16) || lastindex15..0
else
   GPR[rd]31..0 = GPR[rs]31..0 - decr7..0
endif

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

10

101

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MSUB ac, rs, rt

DSP

Multiply Word and Subtract from Accumulator

Purpose:

Multiply Word and Subtract from Accumulator

To multiply two 32-bit integer words and subtract the 64-bit result from the specified accumulator.

Description:

 (HI[ac]||LO[ac]) = (HI[ac]||LO[ac]) - (rs31..0 * rt31..0)

The 32-bit signed integer word in register rs is multiplied by the corresponding 32-bit signed integer word in register

rt to produce a 64-bit result. The 64-bit product is subtracted from the specified 64-bit accumulator.

These special registers HI and LO are specified by the value of ac. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

No arithmetic exception occurs under any circumstances.

Restrictions:

None

This instruction does not provide the capability of writing directly to a target GPR.

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSP2Resources()
endif
temp63..0 = ((GPR[rs]31)32 || GPR[rs]31..0) * ((GPR[rt]31)32 || GPR[rt]31..0)
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - temp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 ||acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Implementation Notes:

Processors which implement a multiplier array which is not square (for example, 32 x 16), and which therefore has an operation latency which is data dependent, should assume that the shorter operand is in register rt.

Programming Notes:

In some processors the integer multiply operation may proceed asynchronously and allow other CPU instructions to execute before it is complete. An attempt to read LO or HI before the results are written interlocks until the results are ready. Asynchronous execution does not af fect the program result, but offers an opportunity for performance improvement by scheduling the multiply so that other instructions can execute in parallel.

Programs that require overflow detection must check for it explicitly.

Where the size of the operands are known, software should place the shorter operand in register rt. This may reduce the latency of the instruction on those processors which implement data-dependent instruction latencies.

Encoding:

P32A

001000

rt

rs

ac

11

101

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MSUBU ac, rs, rt

DSP

Multiply Unsigned Word and Add to Accumulator

Purpose:

Multiply Unsigned Word and Add to Accumulator

To multiply two 32-bit unsigned integer words and subtract the 64-bit result from the specified accumulator.

Description:

 (HI[ac]||LO[ac]) = (HI[ac]||LO[ac]) - (rs31..0 * rt31..0)

The 32-bit unsigned integer word in register rs is multiplied by the corresponding 32-bit unsigned integer word in register rt to produce a 64-bit result. The 64-bit product is subtracted from the specified 64-bit accumulator.

These special registers HI and LO are specified by the value of ac. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

No arithmetic exception occurs under any circumstances.

Restrictions:

None

This instruction does not provide the capability of writing directly to a target GPR.

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSP2Resources()
endif
temp64..0 = (032 || GPR[rs]31..0 ) * ( 032 || GPR[rt]31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) - temp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 ||acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Implementation Notes:

Processors which implement a multiplier array which is not square (for example, 32 x 16), and which therefore has an operation latency which is data dependent, should assume that the shorter operand is in register rt.

Programming Notes:

In some processors the integer multiply operation may proceed asynchronously and allow other CPU instructions to execute before it is complete. An attempt to read LO or HI before the results are written interlocks until the results are ready. Asynchronous execution does not af fect the program result, but offers an opportunity for performance improvement by scheduling the multiply so that other instructions can execute in parallel.

Programs that require overflow detection must check for it explicitly.

Where the size of the operands are known, software should place the shorter operand in register rt. This may reduce the latency of the instruction on those processors which implement data-dependent instruction latencies.

Encoding:

P32A

001000

x

rs

ac

10

000

001

111

111

6

5

5

2

2

3

3

3

3

Format:

MTHI rs, ac

DSP

Move to HI register

Purpose:

Move to HI register

To copy a GPR to the special purpose HI part of the specified accumulator register.

Description:

HI[ac] = GPR[rs]

The source register rs is copied to the HI part of accumulator ac. The HI part of the accumulator is defined to be bits

32 to 63 of the DSP Module accumulator register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

Restrictions:

A computed result written to the HI/LO pair by DIV, DIVU, DDIV, DDIVU, DMULT, DMULTU, MULT, or MULTU must be read by MF HI or MFLO before a new result can be written into either HI or LO. Note that this restriction only applies to the original HI/LO accumulator pair, and does not apply to the new accumulators, ac1, ac2, and ac3.

If an MTHI instruction is executed following one of these arithmetic instructions, but before an M FLO or MFHI instruction, the contents of LO are UNPREDICTABLE. The following example shows this illegal situation:

MULT r2,r4 # start operation that will eventually write to HI,LO
...        # code not containing mfhi or mflo
MTHI r6
...        # code not containing mflo
MFLO r3    # this mflo would get an UNPREDICTABLE value

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSPResources()
endif
HI[ac]31..0 = GPR[rs]31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

x

rs

ac

00

001

001

111

111

6

5

5

2

2

3

3

3

3

Format:

MTHLIP rs, ac

DSP

Copy LO to HI and a GPR to LO and Increment Pos by 32

Purpose:

Copy LO to HI and a GPR to LO and Increment Pos by 32

Copy the LO part of an accumulator to the HI part, copy a GPR to LO, and increment the pos field in the DSPControl register by 32.

Description:

ac = LO[ac]31..0 || GPR[rs]31..0 ; DSPControlpos:5..0 += 32

The 32 least-significant bits of the specified accumulator are copied to the most-significant 32 bits of the same accumulator. Then the 32 least-significant bits of register rs are copied to the least-significant 32 bits of the accumulator.

The instruction then increments the value of bits 0 through 5 of the DSPControl register (the pos field) by 32.

The result of this instruction is UNPREDICTABLE if the value of the pos field before the execution of the instruction is greater than 32.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

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()
tempA31..0 = GPR[rs]31..0
tempB31..0 = LO[ac]31..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempB31..0 || tempA31..0
oldpos5..0 = DSPControlpos:5..0
if ( oldpos5..0 > 32 ) then
   DSPControlpos:5..0 = UNPREDICTABLE
else
   DSPControlpos:5..0 = oldpos5..0 + 32
endif

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

x

rs

ac

11

000

001

111

111

6

5

5

2

2

3

3

3

3

Format:

MTLO rs, ac

DSP

Move to LO register

Purpose:

Move to LO register

To copy a GPR to the special purpose LO part of the specified accumulator register.

Description:

LO[ac] = GPR[rs]

Thesource register rs is copied to the LO part of accumulator ac. The LO part of the accumulator is defined to be bits

0 to 32 of the DSP Module accumulator register.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

Restrictions:

A computed result written to the HI/LO pair by DIV, DIVU, DDIV, DDIVU, DMULT, DMULTU, MULT, or MULTU must be read by MF HI or MFLO before a new result can be written into either HI or LO. Note that this restriction only applies to the original HI/LO accumulator pair, and does not apply to the new accumulators, ac1, ac2, and ac3.

If an MTHI instruction is executed following one of these arithmetic instructions, but before an M FLO or MFHI instruction, the contents of LO are UNPREDICTABLE. The following example shows this illegal situation:

MULT r2,r4 # start operation that will eventually write to HI,LO
...        # code not containing mfhi or mflo
MTHI r6
...        # code not containing mflo
MFLO r3    # this mflo would get an UNPREDICTABLE value

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSPResources()
endif
LO[ac]31..0 = GPR[rs]31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0000100

101

6

5

5

5

1

7

3

Format:

MULEQ_S.W.PHL rd, rs, rt

DSP

Multiply Vector Fractional Left Halfwords to Expanded Width Products

Purpose:

Multiply Vector Fractional Left Halfwords to Expanded Width Products

Multiply two Q15 fractional halfword values to produce a Q31 fractional word result, with saturation.

Description:

rd = sat32(rs31..16 * rt31..16)

The left-most Q15 fractional halfword value from the paired halfword vector in register rs is multiplied by the corresponding Q15 fractional halfword value from register rt. The result is left-shifted one bit position to create a Q31 format result and written into the destination register rd. If both input values are -1.0 in Q15 format (0x8000 in hexadecimal) the result is clamped to the maximum positive Q31 fractional value (0x7FFFFFFF in hexadecimal) before being written to the destination register.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3 are unmodified.

If the result is saturated, this instruction writes a 1 to bit 21 in the ouflag field of the DSPControl register.

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 = multiplyQ15Q15ouflag21( GPR[rs]31..16, GPR[rt]31..16 )
GPR[rd]31..0 = temp31..0
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE
function multiplyQ15Q15ouflag21( a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
      DSPControlouflag:21 = 1
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15ouflag21

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture this multiply instruction, MULEQ_S.W.PHL, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULEQ_S.W.PHL instruction. the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0001100

101

6

5

5

5

1

7

3

Format:

MULEQ_S.W.PHR rd, rs, rt

DSP

Multiply Vector Fractional Right Halfwords to Expanded Width Products

Purpose:

Multiply Vector Fractional Right Halfwords to Expanded Width Products

Multiply two Q15 fractional halfword values to produce a Q31 fractional word result, with saturation.

Description:

rd = sat32(rs15..0 * rt15..0)

The right-most Q15 fractional halfword value from register rs is multiplied by the corresponding Q15 fractional halfword value from register rt. The result is left-shifted one bit position to create a Q31 format result and written into the destination register rd. If both input values are -1.0 in Q15 format (0x8000 in hexadecimal) the result is clamped to the maximum positive Q31 fractional value (0x7FFFFFFF in hexadecimal) before being written to the destination register.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3 are unmodified.

If the result is saturated, this instruction writes a 1 to bit 21 in the ouflag field of the DSPControl register.

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 = multiplyQ15Q15ouflag21( GPR[rs]15..0, GPR[rt]15..0 )
GPR[rd]31..0 = temp31..0
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE
function multiplyQ15Q15ouflag21( a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFFFFFF
      DSPControlouflag:21 = 1
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
   endif
   return temp31..0
endfunction multiplyQ15Q15ouflag21

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture this multiply instruction, MULEQ_S.W.PHR, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULEQ_S.W.PHR instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0010010

101

6

5

5

5

1

7

3

Format:

MULEU_S.PH.QBL rd, rs, rt

DSP

Multiply Unsigned Vector Left Bytes by Halfwords to Halfword Products

Purpose:

Multiply Unsigned Vector Left Bytes by Halfwords to Halfword Products

Multiply two left-most unsigned byte vector elements in a byte vector by two unsigned halfword vector elements to produce two unsigned halfword results, with saturation.

Description:

rd = sat16(rs31..24 * rt31..16) || sat16(rs23..16 * rt15..0)

The two left-most unsigned byte elements in a four-element byte vector in register rs are multiplied as unsigned integer values with the four corresponding unsigned halfword elements from register rt. The eight most-significant bits of each 24-bit result are discarded, and the remaining 16 least-significant bits are written to the corresponding elements in halfword vector register rd. The instruction saturates the result to the maximum positive value (0xFFFF hexadecimal) if any of the discarded bits from each intermediate result are non-zero.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3 are unmodified.

If either result is saturated this instruction writes a 1 to bit 21 in the DSPControl register in 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()
tempB15..0 = multiplyU8U16( GPR[rs]31..24, GPR[rt]31..16 )
tempA15..0 = multiplyU8U16( GPR[rs]23..16, GPR[rt]15..0 )
GPR[rd]31..0 = tempB15..0 || tempA15..0 
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE
function multiplyU8U16( a7..0, b15..0 )
   temp25..0 = (0 || a) * (0 || b)
   if ( temp25..16> 0x00 ) then
      temp25..0 = 010 || 0xFFFF
      DSPControlouflag:21 = 1
   endif
   return temp15..0
endfunction multiplyU8U16

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture this multiply instruction, MULEU_S.PH.QBL, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULEU_S.PH.QBL instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0011010

101

6

5

5

5

1

7

3

Format:

MULEU_S.PH.QBR rd, rs, rt

DSP

Multiply Unsigned Vector Right Bytes with halfwords to Half Word Products

Purpose:

Multiply Unsigned Vector Right Bytes with halfwords to Half Word Products

Element-wise multiplication of unsigned byte elements with corresponding unsigned halfword elements, with saturation.

Description:

rd = sat16(rs15..8 * rt31..16) || sat16(rs7..0 * rt15..0)

The two right-most unsigned byte elements in a four-element byte vector in register rs are multiplied as unsigned integer values with the corresponding right-most 16-bit unsigned values from register rt. Each result is clipped to preserve the 16 l east-significant bits and written back into the respective halfword element positions in the destination register rd. The instruction saturates the result to the maximum positive value (0xFFFF hexadecimal) if any of the clipped bits are non-zero.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3 must be unmodified.

This instruction writes a 1 to bit 21 in the ouflag field in the DSPControl register if either multiplication results in saturation.

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()
tempB15..0 = multiplyU8U16( GPR[rs]15..8, GPR[rt]31..16 )
tempA15..0 = multiplyU8U16( GPR[rs]7..0, GPR[rt]15..0 )
GPR[rd] = tempB15..0 || tempA15..0
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture this multiply instruction, MULEU_S.PH.QBR, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULEU_S.PH.QBR instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0100010

101

6

5

5

5

1

7

3

Format:

MULQ_RS.PH rd, rs, rt

DSP

Multiply Vector Fractional Halfwords to Fractional Halfword Products

Purpose:

Multiply Vector Fractional Halfwords to Fractional Halfword Products

Multiply Q15 fractional halfword vector elements with rounding and saturation to produce two Q15 fractional halfword results.

Description:

rd = rndQ15(rs31..16 * rt31..16) || rndQ15(rs15..0 * rt15..0)

The two Q15 fractional halfword elements from register rs are separately multiplied by the corresponding Q15 fractional halfword elements from register rt to pr oduce 32-bit intermediate results. Each intermediate result is left shifted by one bit position to produce a Q31 fractional value, then rounded by adding 0x00008000 hexadecimal. The rounded intermediate result is then truncated to a Q15 fractional value and written to the corresponding position in destination register rd.

If the two input values to either multiplication are both -1.0 (0x8000 in hexadecimal), the final halfword result is saturated to the maximum positive Q15 value (0x7FFF in hexadecimal) and rounding and truncation are not performed.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3 must be unmodified.

If either result is saturated this instruction writes a 1 to bit 21 in the DSPControl register in 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()
tempB15..0 = rndQ15MultiplyQ15Q15( GPR[rs]31..16, GPR[rt]31..16 )
tempA15..0 = rndQ15MultiplyQ15Q15( GPR[rs]15..0, GPR[rt]15..0 )
GPR[rd]31..0 = tempB15..0 || tempA15..0 
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE
function rndQ15MultiplyQ15Q15( a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFF0000
      DSPControlouflag:21 = 1
   else
      temp31..0 = ( a15..0 * b15..0 ) << 1
      temp31..0 = temp31..0 + 0x00008000
   endif
   return temp31..16
endfunction rndQ15MultiplyQ15Q15

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture, this multiply instruction, MULQ_RS.PH, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULQ_RS.PH instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result, the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0110010

101

6

5

5

5

1

7

3

Format:

MULQ_RS.W rd, rs, rt

DSP-R2

Multiply Fractional Words to Same Size Product with Saturation and Rounding

Purpose:

Multiply Fractional Words to Same Size Product with Saturation and Rounding

Multiply fractional Q31 word values, with saturation and rounding.

Description:

rd = round(sat32(rs31..0 * rt31..0))

The Q31 fractional format words in registers rs and rt are multiplied together and the product shifted left by one bit position to create a 64-bit fractional format intermediate result. The intermediate result is rounded up by adding a 1 at bit position 31, and then truncated by discarding the 32 least-significant bits to create a 32-bit fractional format result.

The result is then written to destination register rd.

If both input multiplicands are equal to -1 (0x80000000 hexadecimal), rounding is not performed and the maximum positive Q31 fractional format value (0x7FFFFFFF hexadecimal) is written to the destination register.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3, are unchanged.

This instruction, on an overflow or underflow of the operation, writes a 1 to bit 21 in the DSPControl register in the

ouflag field.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
if ( GPR[rs]31..0 = 0x80000000 ) and ( GPR[rt]31..0 = 0x80000000 ) then
   temp63..0 = 0x7FFFFFFF00000000
   DSPControlouflag:21 = 1
else 
   temp63..0 = ( GPR[rs]31..0 * GPR[rt]31..0 ) << 1
   temp63..0 = temp63..0 + ( 032 || 0x80000000 )
endif
GPR[rd]31..0 = temp63..32
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture, this multiply instruction, MULQ_RS.W, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULQ_RS.W instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result,

Encoding:

P32A

001000

rt

rs

rd

x

0101010

101

6

5

5

5

1

7

3

Format:

MULQ_S.PH rd, rs, rt

DSP-R2

Multiply Vector Fractional Half-Words to Same Size Products

Purpose:

Multiply Vector Fractional Half-Words to Same Size Products

Multiply two vector fractional Q15 values to create a Q15 result, with saturation.

Description:

rd = sat16(rs31..16 * rt31..16) || sat16(rs15..0 * rt15..0)

The two vector fractional Q15 values in register rs are multiplied with the corresponding elements in register rt to produce two 32-bit products. Each product is left-shifted by one bit position to create a Q31 fractional word intermediate result. The two 32-bit intermediate results are then each truncated by discarding the 16 least-significant bits of each result, and the resulting Q15 fractional format halfwords are then written to the corresponding positions in destination register rd. For each halfword result, if both input multiplicands are equal to -1 (0x8000 hexadecimal), the final halfword result is saturated to the maximum positive Q15 value (0x7FFF hexadecimal).

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other D SP Module accumulators , ac1, ac2, and ac3, must be untouched.

This instruction, on an overflow or underflow of any one of the two vector operation, writes bit 21 in the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempB31..0 = sat16MultiplyQ15Q15( GPR[rs]31..16, GPR[rt]31..16 )
tempA31..0 = sat16MultiplyQ15Q15( GPR[rs]15..0, GPR[rt]15..0 )
GPR[rd]31..0 = tempB15..0 || tempA15..0 
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE
function sat16MultiplyQ15Q15( a15..0, b15..0 )
   if ( a15..0 = 0x8000 ) and ( b15..0 = 0x8000 ) then
      temp31..0 = 0x7FFF0000
      DSPControlouflag:21 = 1
   else
      temp31..0 = ( a15..0 * b15..0 )
      temp31..0 = ( temp30..0 || 0 )
   endif
   return temp31..16
endfunction sat16MultiplyQ15Q15

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

isters HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture, this multiply instruction, MULQ_S.PH, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULQ_S.PH instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result, the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0111010

101

6

5

5

5

1

7

3

Format:

MULQ_S.W rd, rs, rt

DSP-R2

Multiply Fractional Words to Same Size Product with Saturation

Purpose:

Multiply Fractional Words to Same Size Product with Saturation

Multiply two Q31 fractional format word values to create a fractional Q31 result, with saturation.

Description:

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

The Q31 fractional format words in registers rs and rt are multiplied together to create a 64-bit fractional format intermediate result. The intermediate result is left-shifted by one bit position, and then truncated by discarding the 32 least-significant bits to create a Q31 fractional format result. This result is then written to destination register rd.

If both input multiplicands are equal to -1 (0x80000000 hexadecimal), the product is clipped to the maximum positive

Q31 fractional format value (0x7FFFFFFF hexadecimal), and written to the destination register.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3, are unchanged.

This instruction, on an overflow or underflow of the operation, writes a 1 to bit 21 in the DSPControl register in the

ouflag field.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
if ( GPR[rs]31..0 = 0x80000000 ) and ( GPR[rt]31..0 = 0x80000000 ) then
   temp63..0 = 0x7FFFFFFF00000000
   DSPControlouflag:21 = 1
else 
   temp63..0 = ( GPR[rs]31..0 * GPR[rt]31..0 ) << 1
endif
GPR[rd]31..0 = temp63..32
HI[0]31..0 = UNPREDICTABLE
LO[0]31..0 = UNPREDICTABLE

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that after a GPR-targeting multiply instruction such as MUL, the contents of registers HI and LO are UNPREDICTABLE. To maintain compliance with the base architecture, this multiply instruction, MULQ_S.W, has the same requirement. Software must save and restore the ac0 register if the previous value in the ac0 register is needed following the MULQ_S.W instruction.

Note that the requirement on HI and LO does not apply to the new accumulator registers ac1, ac2, and ac3; as a result, the values in these accumulators need not be saved.

Encoding:

P32A

001000

rt

rs

ac

10

110

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MULSA.W.PH ac, rs, rt

DSP-R2

Multiply and Subtract Vector Integer Halfword Elements and Accumulate

Purpose:

Multiply and Subtract Vector Integer Halfword Elements and Accumulate

To multiply and s ubtract two integer vector elements using full-size intermediate pr oducts, accumulating the result into the specified accumulator.

Description:

ac = ac + ((rs31..16 * rt31..16) - (rs15..0 * rt15..0))

Each of the two halfword integer elements from register rt are multiplied by the corresponding elements in rs to create two word results. The right-most result is subtracted from the left-most result to generate the intermediate result, which is then added to the specified 64-bit accumulator.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

This instruction does not set any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the result is UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempB31..0 = (GPR[rs]31..16 * GPR[rt]31..16)
tempA31..0 = (GPR[rs]15..0 * GPR[rt]15..0)
dotp32..0 = ( (tempB31) || tempB31..0 ) - ( (tempA31) || tempA31..0 )
acc63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + ( (dotp32)31 || dotp32..0 )
( HI[ac]31..0 || LO[ac]31..0 ) = acc63..32 || acc31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

11

110

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MULSAQ_S.W.PH ac, rs, rt

DSP

Multiply And Subtract Vector Fractional Halfwords And Accumulate

Purpose:

Multiply And Subtract Vector Fractional Halfwords And Accumulate

Multiply and subtract two Q15 fractional halfword vector elements using full-size intermediate products, accumulating the result from the specified accumulator, with saturation.

Description:

ac = ac + (sat32(rs31..16 * rt31..16) - sat32(rs15..0 * rt15..0))

The two corresponding Q15 fractional values from registers rt and rs are multiplied together and left-shifted by 1 bit to generate two Q31 fractional format intermediate products. If the input multiplicands to either of the multiplications are both -1.0 (0x8000 hexadecimal), the intermediate result is saturated to 0x7FFFFFFF hexadecimal.

The two intermediate products (named left and right) are summed with alternating sign to create a sum-of-products, i.e., the sign of the right product is negated before summation. The sum-of-products is then sign-extended to 64 bits and accumulated into the specified 64-bit accumulator, producing a Q32.31 result.

The value of ac can range from 0 to 3; a v alue of 0 refers to the original HI/LO register pair of the MIPS32 architecture.

If saturation occurs, a 1 is written to one of bits 16 through 19 of the DSPControl register, within the ouflag field. The value of ac determines which of these bits is set: bit 16 corresponds to ac0, bit 17 to ac1, bit 18 to ac2, and bit 19 to

ac3.

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()
tempB31..0 = multiplyQ15Q15( ac, rs31..16, rt31..16 )
tempA31..0 = multiplyQ15Q15( ac, rs15..0, rt15..0 )
dotp63..0 = ( (tempB31)32 || tempB31..0 ) - ( (tempA31)32 || tempA31..0 )
tempC63..0 = ( HI[ac]31..0 || LO[ac]31..0 ) + dotp63..0
( HI[ac]31..0 || LO[ac]31..0 ) = tempC63..32 || tempC31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

ac

00

110

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MULT ac, rs, rt 

DSP

Multiply Word

Purpose:

Multiply Word

To multiply two 32-bit signed integers, writing the 64-bit result to the specified accumulator.

Description:

 ac = rs31..0 * rt31..0

The 32-bit signed integer value in register rt is multiplied by the corresponding 32-bit signed integer value in register

rs, to produce a 64-bit result that is written to the specified accumulator register.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

No arithmetic exception occurs under any circumstances.

Restrictions:

None

Operation:

if (( ac != 0 )or (ConfigAR >= )) then 
   ValidateAccessToDSP2Resources()
endif
temp63..0 = ((GPR[rs]31)32 || GPR[rs]31..0) * ((GPR[rt31)32 || GPR[rt]31..0)
( HI[ac]31..0 || LO[ac]31..0 ) = temp63..32 || temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

In some processors the integer multiply operation may proceed asynchronously and allow other CPU instructions to execute before it is complete. An attempt to read LO or HI before the results are written interlocks until the results are ready. Asynchronous execution does not af fect the program result, but offers an opportunity for performance improvement by scheduling the multiply so that other instructions can execute in parallel.

Programs that require overflow detection must check for it explicitly.

Where the size of the operands are known, software should place the shorter operand in register rt. This may reduce the latency of the instruction on those processors which implement data-dependent instruction latencies.

Implementation Note:

Processors which implement a multiplier array which is not square (for example, 32 x 16), and which therefore has an operation latency which is data dependent, should assume that the shorter operand is in register rt.

Encoding:

P32A

001000

rt

rs

ac

01

110

010

111

111

6

5

5

2

2

3

3

3

3

Format:

MULTU ac, rs, rt 

DSP

Multiply Unsigned Word

Purpose:

Multiply Unsigned Word

To multiply 32-bit unsigned integers, writing the 64-bit result to the specified accumulator.

Description:

 ac = rs31..0 * rt31..0

The 32-bit unsigned integer value in register rt is multiplied by the corresponding 32-bit unsigned integer value in register rs, to produce a 64-bit unsigned result that is written to the specified accumulator register.

The value of ac selects an accumulator numbe red from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

In Release 6 of the MIPS Architecture, accumulators are eliminated from MIPS32.

No arithmetic exception occurs under any circumstances.

Restrictions:

None

Operation:

if (( ac != 0 ) or (ConfigAR >= )) then 
   ValidateAccessToDSP2Resources()
endif
temp64..0 = ( 032 || GPR[rs]31..0 ) * ( 032 || GPR[rt]31..0 ) 
( HI[ac]31..0 || LO[ac]31..0 ) = temp63..32 || temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

In some processors the integer multiply operation may proceed asynchronously and allow other CPU instructions to execute before it is complete. An attempt to read LO or HI before the results are written interlocks until the results are ready. Asynchronous execution does not af fect the program result, but offers an opportunity for performance improvement by scheduling the multiply so that other instructions can execute in parallel.

Programs that require overflow detection must check for it explicitly.

Where the size of the operands are known, software should place the shorter operand in register rt. This may reduce the latency of the instruction on those processors which implement data-dependent instruction latencies.

Implementation Note:

Processors which implement a multiplier array which is not square (for example, 32 x 16), and which therefore has an operation latency which is data dependent, should assume that the shorter operand is in register rt.

Encoding:

P32A

001000

rt

rs

rd

MUL.PH

0

0000101

101

P32A

001000

rt

rs

rd

MUL_S.PH

1

0000101

101

6

5

5

5

1

7

3

Format:

MUL[_S].PH 

Multiply Vector Integer HalfWords to Same Size Products

MUL.PH    rd, rs, rt

DSP-R2

Multiply Vector Integer HalfWords to Same Size Products

MUL_S.PH  rd, rs, rt

DSP-R2

Multiply Vector Integer HalfWords to Same Size Products

Purpose:

Multiply Vector Integer HalfWords to Same Size Products

Multiply two vector halfword values.

Description:

rd = (rs31..16 * rt31..16) || (rs15..0 * rt15..0)

Each of the two integer halfword elements in register rs is multiplied by the corresponding integer halfword element in register rt to create a 32-bit signed integer intermediate result.

In the non-saturation version of the instruction, the 16 least-significant bits of each 32-bit intermediate result are written to the corresponding vector element in destination register rd.

In the saturating version of the instruction, intermediate results that cannot be represented in 16 bits are clipped to either the maximum positive 16-bit value (0x7FFF hexadecimal) or the minimum negative 16-bit value (0x8000 hexadecimal), depending on the sign of the intermediate result. The saturated results are then written to the destination register.

To stay compliant with the base architecture, this instruction leaves the base HI/LO pair (accumulator ac0) UNPREDICTABLE after the operation completes. The other DSP Module accumulators, ac1, ac2, and ac3, are unchanged.

In the saturating instruction variant, if either multiplication results in an overflow or underflow, the instruction writes a 1 to bit 21 in the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

MUL.PH
   ValidateAccessToDSPResources()
   tempB31..0 = MultiplyI16I16( GPR[rs]31..16, GPR[rt]31..16 )
   tempA31..0 = MultiplyI16I16( GPR[rs]15..0, GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0 
   HI31..0 = UNPREDICTABLE
   LO31..0 = UNPREDICTABLE
MUL_S.PH
   ValidateAccessToDSPResources()
   tempB31..0 = sat16MultiplyI16I16( GPR[rs]31..16, GPR[rt]31..16 )
   tempA31..0 = sat16MultiplyI16I16( GPR[rs]15..0, GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0 
   LO31..0 = UNPREDICTABLE
function MultiplyI16I16( a15..0, b15..0 ) 
   temp31..0 = a15..0 * b15..0
   if ( temp31..0 > 0x7FFF ) or ( temp31..0 < 0xFFFF8000 ) then
         DSPControlouflag:21 = 1
   endif
   return temp15..0
endfucntion MultiplyI16I16
function satMultiplyI16I16( a15..0, b15..0 ) 
   temp31..0 = a15..0 * b15..0
   if ( temp31..0 > 0x7FFF ) then
      temp31..0 = 0x00007FFF
      DSPControlouflag:21 = 1
   else
      if ( temp31..0 < 0xFFFF8000 ) then
         temp31..0 = 0xFFFF8000
          DSPControlouflag:21 = 1
      endif
   endif
   return temp15..0
endfucntion satMultiplyI16I16

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

The base MIPS32 architecture states that upon the after a GPR-targeting multiply instruction such as MUL, the contents of HI and LO are UNPREDICTABLE. To stay compliant with the base architecture, this multiply instruction states the same requirement. But this requirement does not apply to the new accumulators ac1-ac3 and hence a programmer must save the value in ac0 (which is the same as HI and LO) across a GPR-targeting multiply instruction, it needed, while the values in ac1-ac3 do not need to be saved.

Encoding:

P32A

001000

rt

rs

rd

x

0110101

101

6

5

5

5

1

7

3

Format:

PACKRL.PH rd, rs, rt

DSP

Pack a Vector of Halfwords from Vector Halfword Sources

Purpose:

Pack a Vector of Halfwords from Vector Halfword Sources

Pick two elements for a halfword vector using the right halfword and left halfword respectively from the two source registers.

Description:

rd = rs15..0 || rt31..16

The right halfword element from register rs and the left halfword from register rt are packed into the two halfword positions of the destination register rd.

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()
tempB15..0 = GPR[rs]15..0
tempA15..0 = GPR[rt]31..16
GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1000101

101

6

5

5

5

1

7

3

Format:

PICK.PH rd, rs, rt

DSP

Pick a Vector of Halfword Values Based on Condition Code Bits

Purpose:

Pick a Vector of Halfword Values Based on Condition Code Bits

Select two halfword elements from either of two source registers based on condition code bits, writing the selected elements to the destination register.

Description:

rd = pick(cc25,rs31..16,rt31..16) || pick(cc24,rs15..0,rt15..0)

The two right-most condition code bits in the DSPControl register are used to select halfword values from the corresponding element of either source register rs or source register rt. If the value of the corresponding condition code bit is 1, then the halfword value is selected from register rs; otherwise, it is selected from rt. The selected halfwords are written to the destination register rd.

Restrictions:

No data-dependent exceptions are possible.

The operands must be in the specif ied format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempB15..0 = ( DSPControlccond:25 = 1 ? GPR[rs]31..16 : GPR[rt]31..16 )
tempA15..0 = ( DSPControlccond:24 = 1 ? GPR[rs]15..0 : GPR[rt]15..0 )
GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0111101

101

6

5

5

5

1

7

3

Format:

PICK.QB rd, rs, rt

DSP

Pick a Vector of Byte Values Based on Condition Code Bits

Purpose:

Pick a Vector of Byte Values Based on Condition Code Bits

Select four byte elements from either of two source registers based on condition code bits, writing the selected elements to the destination register.

Description:

rd = pick(cc27,rs31..24,rt31..24) || pick(cc26,rs23..16,rt23..16) || 
pick(cc25,rs15..8,rt15..8) || pick(cc24,rs7..0,rt7..0)

Four condition code bits in the DSPControl register are used to select byte values from the corresponding byte element of either source register rs or source register rt. If the value of the corresponding condition code bit is 1, then the byte value is selected from register rs; otherwise, it is selected from rt. The selected bytes are written to the destination register rd.

Restrictions:

No data-dependent exceptions are possible.

The operands must be in the specif ied format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
tempD7..0 = ( DSPControlccond:27 = 1 ? GPR[rs]31..24 : GPR[rt]31..24 )
tempC7..0 = ( DSPControlccond:26 = 1 ? GPR[rs]23..16 : GPR[rt]23..16 )
tempB7..0 = ( DSPControlccond:25 = 1 ? GPR[rs]15..8 : GPR[rt]15..8 )
tempA7..0 = ( DSPControlccond:24 = 1 ? GPR[rs]7..0 : GPR[rt]7..0 )
GPR[rd]31..0 = tempD7..0|| tempC7..0 || tempB7..0 || tempA7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0101000

100

111

111

6

5

5

7

3

3

3

Format:

PRECEQ.W.PHL rt, rs

DSP

Precision Expand Fractional Halfword to Fractional Word Value

Purpose:

Precision Expand Fractional Halfword to Fractional Word Value

Expand the precision of a Q15 fractional value taken from the left element of a paired halfword vector to create a Q31 fractional word value.

Description:

rt = expand_prec(rs31..16)

The left Q15 fractional halfword value from the paired halfword vector in register rs is expanded to a Q31 fractional value and written to destination register rt. The precision expansion is achieved by appending 16 least-significant zero bits to the original halfword value to generate the 32-bit fractional value.

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 = GPR[rs]31..16 || 016
GPR[rt]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0110000

100

111

111

6

5

5

7

3

3

3

Format:

PRECEQ.W.PHR rt, rs

DSP

Precision Expand Fractional Halfword to Fractional Word Value

Purpose:

Precision Expand Fractional Halfword to Fractional Word Value

Expand the precision of a Q15 fractional value taken from the right element of a paired halfword vector to create a

Q31 fractional word value.

Description:

rt = expand_prec(rs15..0)

The right Q15 fractional halfword value from the paired halfword vector in register rs is expanded to a Q31 fractional value and written to destination register rt. The precision expansion is achieved by appending 16 least-significant zero bits to the original halfword value to generate the 32-bit fractional value.

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 = GPR[rs]15..0 || 016
GPR[rt]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0111001

100

111

111

6

5

5

7

3

3

3

Format:

PRECEQU.PH.QBLA rt, rs

DSP

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Purpose:

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Expand the precision of two unsigned byte values taken from the two left-alternate aligned elements of a quad byte vector to create two Q15 fractional halfword values.

Description:

rt = expand_prec(rs31..24) || expand_prec(rs15..8)

The two left-alternate aligned unsigned integer byte values from the four byte elements in register rs are expanded to create two Q15 fractional values that are then written to destination register rt. The precision expansion is achieved by pre-pending a single zero bit (for positive sign) to the original byte value and appending seven least-significant zeros to generate each 16-bit fractional value.

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()
tempB15..0 = 01 || GPR[rs]31..24 || 07 
tempA15..0 = 01 || GPR[rs]15..8 || 07 
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0111000

100

111

111

6

5

5

7

3

3

3

Format:

PRECEQU.PH.QBL rt, rs

DSP

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Purpose:

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Expand the precision of two unsigned byte values taken from the two left-most elements of a quad byte vector to create two Q15 fractional halfword values.

Description:

rt = expand_prec(rs31..24) || expand_prec(rs23..16)

The two left-most unsigned integer byte values from the four byte elements in register rs are expanded to create two

Q15 fractional values that are then written to destination register rt. The precision expansion is achieved by pre-pending a single zero bit (for positive sign) to the original byte value and appending seven least-significant zeros to generate each 16-bit fractional value.

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()
tempB15..0 = 01 || GPR[rs]31..24 || 07 
tempA15..0 = 01 || GPR[rs]23..16 || 07 
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1001001

100

111

111

6

5

5

7

3

3

3

Format:

PRECEQU.PH.QBRA rt, rs

DSP

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Purpose:

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Expand the precision of two unsigned byte values taken from the two right-alternate aligned elements of a quad byte vector to create two Q15 fractional halfword values.

Description:

rt = expand_prec(rs23..16) || expand_prec(rs7..0)

The two right-alternate aligned unsigned integer byte values from the four byte elements in register rs are expanded to create two Q15 fractional values that are then written to destination register rt. The precision expansion is achieved by pre-pending a single zero bit (for positive sign) to the origi nal byte value and appending seven least-significant zeros to generate each 16-bit fractional value.

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()
tempB15..0 = 01 || GPR[rs]23..16 || 07 
tempA15..0 = 01 || GPR[rs]7..0 || 07 
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1001000

100

111

111

6

5

5

7

3

3

3

Format:

PRECEQU.PH.QBR rt, rs

DSP

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Purpose:

Precision Expand two Unsigned Bytes to Fractional Halfword Values

Expand the precision of two unsigned byte values taken from the two right-most elements of a quad byte vector to create two Q15 fractional halfword values.

Description:

rt = expand_prec(rs15..8) || expand_prec(rs7..0)

The two right-most unsigned integer byte values from the four byte elements in register rs are expanded to create two

Q15 fractional values that are then written to destination register rt. The precision expansion is achieved by pre-pending a single zero bit (for positive sign) to the original byte value and appending seven least-significant zeros to generate each 16-bit fractional value.

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()
tempB15..0 = 01 || GPR[rs]15..8 || 07 
tempA15..0 = 01 || GPR[rs]7..0 || 07 
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1011001

100

111

111

6

5

5

7

3

3

3

Format:

PRECEU.PH.QBLA rt, rs

DSP

Precision Expand Two Unsigned Bytes to Unsigned Halfword Values

Purpose:

Precision Expand Two Unsigned Bytes to Unsigned Halfword Values

Expand the precision of two unsigned integer byte values taken from the two left-alternate aligned positions of a quad byte vector to create four unsigned halfword values.

Description:

rt = expand_prec8u16(rs31..24) || expand_prec8u16(rs15..8)

The two left-alternate aligned unsigned integer byte values from the four right-most byte elements in register rs are each expanded to unsigned halfword values and written to destination register rt. The precision expansion is achieved by pre-pending eight most-significant zero bits to the original byte v alue to generate each 16 bit unsigned halfw ord value.

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()
tempB15..0 = 08 || GPR[rs]31..24
tempA15..0 = 08 || GPR[rs]15..8
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1011000

100

111

111

6

5

5

7

3

3

3

Format:

PRECEU.PH.QBL rt, rs

DSP

Precision Expand Two Unsigned Bytes to Unsigned Halfword Values

Purpose:

Precision Expand Two Unsigned Bytes to Unsigned Halfword Values

Expand the precision of two unsigned byte values taken from the two left-most elements of a quad byte vector to create two unsigned halfword values.

Description:

rt = expand_prec8u16(rs31..24) || expand_prec8u16(rs23..16)

The two left-most unsigned integer byte values from the four byte elements in register rs are expanded to create two unsigned halfword values that are then written to destination register rt. The precision expansion is achieved by prepending eight most-significant zeros to each original value to generate each 16 bit unsigned value.

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()
tempB15..0 = 08 || GPR[rs]31..24
tempA15..0 = 08 || GPR[rs]23..16
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1101001

100

111

111

6

5

5

7

3

3

3

Format:

PRECEU.PH.QBRA rt, rs

DSP

Precision Expand Two Unsigned Bytes to Unsigned Halfword Values

Purpose:

Precision Expand Two Unsigned Bytes to Unsigned Halfword Values

Expand the precision of two unsigned byte values taken from the two right-alternate aligned positions of a quad byte vector to create two unsigned halfword values.

Description:

rt = expand_prec8u16(rs23..16) || expand_prec8u16(rs7..0)

The two right-alternate aligned unsigned integer byte values from the four byt e elements in re gister rs are each expanded to unsigned halfword values and written to destination register rt. The precision expansion is achieved by pre-pending eight most-significant zero bits to the original byte value to generate each 16 bit unsigned halfword value.

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()
tempB15..0 = 08 || GPR[rs]23..16
tempA15..0 = 08 || GPR[rs]7..0
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1101000

100

111

111

6

5

5

7

3

3

3

Format:

PRECEU.PH.QBR rt, rs

DSP

Precision Expand two Unsigned Bytes to Unsigned Halfword Values

Purpose:

Precision Expand two Unsigned Bytes to Unsigned Halfword Values

Expand the precision of two unsigned integer byte values taken from the two right-most elements of a quad byte vector to create two unsigned halfword values.

Description:

rt = expand_prec8u16(rs15..8) || expand_prec8u16(rs7..0)

The two right-most unsigned integer byte values from the four byte elements in register rs are expanded to create two unsigned halfword values that are then written to destination register rt. The precision expansion is achieved by prepending eight most-significant zero bits to each original value to generate each 16 bit halfword value.

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()
tempB15..0 = 08 || GPR[rs]15..8
tempA15..0 = 08 || GPR[rs]7..0
GPR[rt]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0001101

101

6

5

5

5

1

7

3

Format:

PRECR.QB.PH rd, rs, rt

DSP-R2

Precision Reduce Four Integer Halfwords to Four Bytes

Purpose:

Precision Reduce Four Integer Halfwords to Four Bytes

Reduce the precision of four integer halfwords to four byte values.

Description:

rd = rs23..16 || rs7..0 || rt23..16 || rt7..0

The 8 least-significant bits from each of the two integer halfword values in registers rs and rt are taken to produce four byte-sized results that are w ritten to the four byte elements in destination register rd. The two bytes values obtained from rs are written to the two left-most destination byte elements, and the two b ytes obtained from rt are written to the two right-most destination byte elements.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempD7..0 = GPR[rs]23..16
tempC7..0 = GPR[rs]7..0
tempB7..0 = GPR[rt]23..16
tempA7..0 = GPR[rt]7..0
GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0011101

101

6

5

5

5

1

7

3

Format:

PRECRQ.PH.W rd, rs, rt

DSP

Precision Reduce Fractional Words to Fractional Halfwords

Purpose:

Precision Reduce Fractional Words to Fractional Halfwords

Reduce the precision of two fractional words to produce two fractional halfword values.

Description:

rd = rt31..16 || rs31..16

The 16 most-significant bits from each of the Q31 fractional word values in registers rs and rt are written to destination register rd, creating a vector of two Q15 fractional values. The fractional word from the rs register is used to create the left-most Q15 fractional value in rd, and the fractional word from the rt register is used to create the right-most

Q15 fractional value.

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()
tempB15..0 = GPR[rs]31..16
tempA15..0 = GPR[rt]31..16
GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0010101

101

6

5

5

5

1

7

3

Format:

PRECRQ.QB.PH rd, rs, rt

DSP

Precision Reduce Four Fractional Halfwords to Four Bytes

Purpose:

Precision Reduce Four Fractional Halfwords to Four Bytes

Reduce the precision of four fractional halfwords to four byte values.

Description:

rd = rs31..24 || rs15..8 || rt31..24 || rt15..8

The four Q15 fractional values in registers rs and rt are truncated by dropping the eight least significant bits from each value to produce four fractional byte values. The four fractional byte values are written to the four byte elements of destination register rd. The two values obtained from register rt are placed in the two right-most byte positions in the destination register, and the two values obtained from register rs are placed in the two remaining byte positions.

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()
tempD7..0 = GPR[rs]31..24
tempC7..0 = GPR[rs]15..8
tempB7..0 = GPR[rt]31..24
tempA7..0 = GPR[rt]15..8
GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0101101

101

6

5

5

5

1

7

3

Format:

PRECRQU_S.QB.PH rd, rs, rt

DSP

Precision Reduce Fractional Halfwords to Unsigned Bytes With Saturation

Purpose:

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.

Description:

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.

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()
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

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

0100101

101

6

5

5

5

1

7

3

Format:

PRECRQ_RS.PH.W rd, rs, rt

DSP

Precision Reduce Fractional Words to Halfwords With Rounding and Saturation

Purpose:

Precision Reduce Fractional Words to Halfwords With Rounding and Saturation

Reduce the precision of two fractional words to produce two fractional halfword values, with rounding and saturation.

Description:

rd = truncQ15SatRound(rs31..0) || truncQ15SatRound(rt31..0)

The two Q31 fractional word values in each of registers rs and rt are used to create two Q15 fractional halfword values that are written to the two halfword elements in destination register rd. The fractional word from the rs register is used to create the left-most Q15 fractional halfword result in rd, and the fractional word from the rt register is used to create the right-most halfword value.

Each input Q31 fractional value is rounded and saturated before being truncated to create the Q15 fractional halfword result. First, the value 0x00008000 is added to the input Q31 value to round even, creating an interim rounded result.

If this addition causes overflow, the interim rounded result is saturated to the maximum Q31 value (0x7FFFFFFF hexadecimal). Then, the 16 least-significant bits of the interim rounded and saturated result are discarded and the 16 most-significant bits are written to the destination register in the appropriate position.

If either of the rounding operations results in overflow and saturation, a 1 is written to bit 22 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()
tempB15..0 = trunc16Sat16Round( GPR[rs]31..0 )
tempA15..0 = trunc16Sat16Round( GPR[rt]31..0 )
GPR[rd]31..0 = tempB15..0 || tempA15..0
function trunc16Sat16Round( a31..0 )
   temp32..0 = ( a31 || a31..0 ) + 0x00008000
   if ( temp32 != temp31 ) then
      temp32..0 = 0 || 0x7FFFFFFF
      DSPControlouflag:22 = 1
   endif
   return temp31..16
endfunction trunc16Sat16Round

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

PRECR_SRA.PH.W

0

1111001

101

P32A

001000

rt

rs

sa

PRECR_SRA_R.PH.W

1

1111001

101

6

5

5

5

1

7

3

Format:

PRECR_SRA[_R].PH.W 

Precision Reduce Two Integer Words to Halfwords after a Right Shift

PRECR_SRA.PH.W    rt, rs, sa

DSP-R2

Precision Reduce Two Integer Words to Halfwords after a Right Shift

PRECR_SRA_R.PH.W   rt, rs, sa

DSP-R2

Precision Reduce Two Integer Words to Halfwords after a Right Shift

Purpose:

Precision Reduce Two Integer Words to Halfwords after a Right Shift

Do an arithmetic right shift of two integer words with optional rounding, and then reduce the precision to halfwords.

Description:

rt = (round(rt>>shift))15..0 || (round(rs>>shift))15..0

The two words in registers rs and rt are right shifted arithmetically by the specified shift amount sa to create interim results. The 16 least-significant bits of each interim result are then written to the corresponding elements of destination register rt.

In the rounding version of the instruction, a value of 1 is added at the most-significant discarded bit position after the shift is performed. The 16 least-significant bits of each interim result are then written to the corresponding elements of destination register rt.

The shift amount sa is interpreted as a five-bit unsigned integer taking values between 0 and 31.

This instruction does not write any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

PRECR_SRA.PH.W
   ValidateAccessToDSP2Resources()
   if (sa4..0 = 0) then
      tempB15..0 = GPR[rt]15..0
      tempA15..0 = GPR[rs]15..0
   else
      tempB15..0 = ( (GPR[rt]31)sa || GPR[rt]31..sa )
      tempA15..0 = ( (GPR[rs]31)sa || GPR[rs]31..sa )
   endif
   GPR[rt]31..0 = tempB15..0 || tempA15..0
PRECR_SRA_R.PH.W
   ValidateAccessToDSP2Resources()
   if (sa4..0 = 0) then
      tempB16..0 = ( GPR[rt]15..0 || 0 )
      tempA16..0 = ( GPR[rs]15..0 || 0 )
   else
      tempB32..0 = ( (GPR[rt]31)sa || GPR[rt]31..sa-1 ) + 1
      tempA32..0 = ( (GPR[rs]31)sa || GPR[rs]31..sa-1 ) + 1
   GPR[rt]31..0 = tempB16..1 || tempA16..1

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

Format:

PREPEND rt, rs, sa

DSP-R2

Right Shift and Prepend Bits to the MSB

EXTW rt, rs, rt, sa

Replaced with EXTW in nanoMIPS

Right Shift and Prepend Bits to the MSB

Purpose:

Right Shift and Prepend Bits to the MSB

Logically right-shift the first source register, replacing the bits emptied by the shift with bits from the source register.

Description:

rt = rssa-1..0 || (rt >> sa)

The word value in register rt is logically right-shifted by the specified shift amount sa, and sa bits from the least-significant positions of register rs are written into the sa most-significant bits emptied by the shift. The result is then written to destination register rt.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
if ( sa4..0 = 0 ) then
   temp31..0 = GPR[rt]31..0 
else
   temp31..0 = ( GPR[rs]sa-1..0 || GPR[rt]31..sa )
endif
GPR[rt]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

1111000

100

111

111

6

5

5

7

3

3

3

Format:

RADDU.W.QB rt, rs

DSP

Unsigned Reduction Add Vector Quad Bytes

Purpose:

Unsigned Reduction Add Vector Quad Bytes

Reduction add of four unsigned byte values in a vector register to produce an unsigned word result.

Description:

rt = zero_extend(rs31..24 + rs23..16 + rs15..8 + rs7..0)

The unsigned byte elements in register rs are added together as unsigned 8-bit values, and the result is zero extended to a word and written to register rt.

Restrictions:

No data-dependent exceptions are possible.

The operands must be in the specif ied format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSPResources()
temp9..0 = ( 02 || GPR[rs]31..24 ) + ( 02 || GPR[rs]23..16 ) + ( 02 || GPR[rs]15..8 ) + 
( 02 || GPR[rs]7..0 )
GPR[rt]31..0 = 0(GPRLEN-10) || temp9..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

mask

00

011

001

111

111

6

5

7

2

3

3

3

3

Format:

RDDSP rt, mask

DSP

Read DSPControl Register Fields to a GPR

Purpose:

Read DSPControl Register Fields to a GPR

To copy selected fields from the special-purpose DSPControl register to the specified GPR.

Description:

rt = select(mask, DSPControl)

Selected fields in the special register DSPControl are copied into the corresponding bits of destination register rt.

Each of bits 0 through 5 of the mask operand corresponds to a specific field in the DSPControl register. A mask bit value of 1 indicates that the bits from the corresponding field in DSPControl will be copied into the same bit positions in register rt, and a mask bit value of 0 indicates that the corresponding bit positions in rt will be set to zer o. Bits 6 through 9 of the mask operand are ignored.

The table below shows the correspondence between the bits in the mask operand and the fields in the DSPControl register; mask bit 0 is the least-significant bit in mask.

Bit31242316151413127650

DSPControl

ccond

ouflag

0

EFI C

scount

pos

4

3

5

2

1

0

field

Mask bit

For example, to copy only the bits from the scount field in DSPControl, the value of the mask operand used will be 2 decimal (0x02 hexadecimal). After execution of the instruction, bits 7 through 12 of register rt will have the value of bits 7 through 12 from the scount field in DSPControl. The remaining bits in register rt will be set to zero.

The one-operand version of the instruction provides a convenient assembly idiom that allows the programmer to read all fields in the DSPControl register into the destination register, i.e., it is equivalent to specifying a mask value of 31 decimal (0x1F hexadecimal).

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 = 032
if ( mask0 = 1 ) then
   temp5..0 = DSPControlpos:5..0
endif
if ( mask1 = 1 ) then
   temp12..7 = DSPControlscount:12..7
endif
if ( mask2 = 1 ) then
   temp13 = DSPControlc:13
endif
if ( mask3 = 1 ) then
endif
if ( mask4 = 1 ) then
   temp27..24 = DSPControlccond:27..24
endif
if ( mask5 = 1 ) then
   temp14 = DSPControlefi:14
endif
GPR[rt]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

s

x

0000111

101

6

5

10

1

7

3

Format:

REPL.PH  rd, immediate

DSP

Replicate Immediate Integer into all Vector Element Positions

Purpose:

Replicate Immediate Integer into all Vector Element Positions

Replicate a sign-extended, 10-bit signed immediate integer value into the two halfwords in a halfword vector.

Description:

rd = sign_extend(immediate) || sign_extend(immediate)

The specified 10-bit signed immediate integer value is sign-extended to 16 bits and replicated into the two halfword positions in destination register rd.

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()
temp15..0 = (immediate9)6 || immediate9..0
GPR[rd]31..0 = temp15..0 || temp15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

u

x

010

111

111

111

6

5

8

1

3

3

3

3

Format:

REPL.QB  rt, immediate

DSP

Replicate Immediate Integer into all Vector Element Positions

Purpose:

Replicate Immediate Integer into all Vector Element Positions

Replicate a immediate byte into all elements of a quad byte vector.

Description:

rt = immediate || immediate || immediate || immediate

The specified 8-bit signed immediate value is replicated into the four byte elements of destination register rt.

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()
temp7..0 = immediate7..0
GPR[rt]31..0 = temp7..0 || temp7..0 || temp7..0 || temp7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0000001

100

111

111

6

5

5

7

3

3

3

Format:

REPLV.PH  rt, rs

DSP

Replicate a Halfword into all Vector Element Positions

Purpose:

Replicate a Halfword into all Vector Element Positions

Replicate a variable halfword into the elements of a halfword vector.

Description:

rt = (rs15..0 || rs15..0)

The halfword value in register rs is replicated into the two halfword elements of destination register rt.

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()
temp15..0 = GPR[rs]15..0
GPR[rt]31..0 = temp15..0 || temp15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

0001001

100

111

111

6

5

5

7

3

3

3

Format:

REPLV.QB  rt, rs

DSP

Replicate Byte into all Vector Element Positions

Purpose:

Replicate Byte into all Vector Element Positions

Replicate a variable byte into all elements of a quad byte vector.

Description:

rt = rs7..0 || rs7..0 || rs7..0 || rs7..0

The byte value in register rs is replicated into the four byte elements of destination register rt.

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()
temp7..0 = GPR[rs]7..0
GPR[rt]31..0 = temp7..0 || temp7..0 || temp7..0 || temp7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

x

s

ac

x

0000011

101

6

4

6

2

4

7

3

Format:

SHILO ac, shift

DSP

Shift an Accumulator Value Leaving the Result in the Same Accumulator

Purpose:

Shift an Accumulator Value Leaving the Result in the Same Accumulator

Shift the HI/LO paired value in a 64-bit accumulator either left or right, leaving the result in the same accumulator.

Description:

ac = (shift >= 0) ? (ac >> shift) : (ac << -shift)

The HI/LO register pair is treated as a single 64-bit accumulator that is shifted logically by shift bits, with the result of the shift written back to the source accumulator. The shift argument is a six-bit signed integer value: a positive argument results in a right shift of up to 31 bits, and a negative argument results in a left shift of up to 32 bits.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

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()
sign = shift5 
shift5..0 = ( sign = 0 ? shift5..0 : -shift5..0 )
if ( shift5..0 = 0 ) then
   temp63..0 = (HI[ac]31..0 || LO[ac]31..0)
else
   if (sign = 0) then
      temp63..0 = 0shift || (( HI[ac]31..0 || LO[ac]31..0 ) >> shift )
   else
      temp63..0 = (( HI[ac]31..0 || LO[ac]31..0 ) << shift ) || 0shift
   endif
endif
( HI[ac]31..0 || LO[ac]31..0 ) = temp63..32 || temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

x

rs

ac

01

001

001

111

111

6

5

5

2

2

3

3

3

3

Format:

SHILOV ac, rs

DSP

Variable Shift of Accumulator Value Leaving the Result in the Same Accumulator

Purpose:

Variable Shift of Accumulator Value Leaving the Result in the Same Accumulator

Shift the HI/LO paired value in an accumulator either left or right by the amount specified in a GPR, leaving the result in the same accumulator.

Description:

ac = ( GPR[rs]6..0 >= 0) ? (ac >> GPR[rs]6..0) : (ac << -GPR[rs]6..0)

The HI/LO register pair is treated as a single 64-bit accumulator that is shifted logically by shift bits, with the result of the shift written back to the source accumulator. The shift argument is provided by the six least-significant bits of register rs; the remaining bits of rs are ignored. The shift argument is interpreted as a six-bit signed integer: a positive argument results in a right shift of up to 31 bits, and a negative argument results in a left shift of up to 32 bits.

The value of ac can range from 0 to 3. When ac=0, this refers to the original HI/LO register pair of the MIPS32 architecture.

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()
sign = GPR[rs]5
shift5..0 = ( sign = 0 ? GPR[rs]5..0 : -GPR[rs]5..0 )
if ( shift5..0 = 0 ) then
   temp63..0 = ( HI[ac]31..0 || LO[ac]31..0 )
else
   if ( sign = 0 ) then
      temp63..0 = 0shift || (( HI[ac]31..0 || LO[ac]31..0 ) >> shift )
   else
      temp63..0 = (( HI[ac]31..0 || LO[ac]31..0 ) << shift ) || 0shift
   endif
endif
( HI[ac]31..0 || LO[ac]31..0 ) = temp63..32 || temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

0

100

001

111

111

6

5

5

3

1

3

3

3

3

Format:

SHLL.QB rt, rs, sa

DSP

Shift Left Logical Vector Quad Bytes

Purpose:

Shift Left Logical Vector Quad Bytes

Element-wise left shift of four independent bytes in a vector data type by a fixed number of bits.

Description:

rt = (rs31..24 << sa) || (rs23..16 << sa) || (rs15..8 << sa) || (rs7..0 << sa)

The four byte values in register rs are each independently shifted left by sa bits and the sa least significant bits of each value are set to zero. The four independent results are then written to the corresponding byte elements of destination register rt.

This instruction writes a 1 to bi t 22 in the DSPControl register in the ouflag field if any of the left shift operations results in an overflow.

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()
tempD7..0 = shift8Left( GPR[rs]31..24, sa2..0 )
tempC7..0 = shift8Left( GPR[rs]23..16, sa2..0 )
tempB7..0 = shift8Left( GPR[rs]15..8, sa2..0 )
tempA7..0 = shift8Left( GPR[rs]7..0, sa2..0 )
GPR[rt]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
function shift8Left( a7..0, s2..0 )
   if ( s2..0 = 0 ) then
      temp7..0 = a7..0
   else
      sign = a7
      temp7..0 = ( a7-s..0 || 0s )
      discard7..0 = ( sign(8-s) || a6..6-(s-1) )
      if ( discard7..0 != 0x00 ) then
          DSPControlouflag:22 = 1
      endif
   endif
   return temp7..0
endfunction shift8Left

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1110010

101

6

5

5

5

1

7

3

Format:

SHLLV.QB rd, rt, rs

DSP

Shift Left Logical Variable Vector Quad Bytes

Purpose:

Shift Left Logical Variable Vector Quad Bytes

Element-wise left shift of four independent bytes in a vector data type by a variable number of bits.

Description:

rd = (rt31..24 << rs2..0) || (rt23..16 << rs2..0) || (rt15..8 << rs2..0) || (rt7..0 
<< rs2..0)

The four byte values in register rt are each independently shifted left by sa bits, inserting zeros into the least-significant bit positions emptied by the shift. The four independent results are then written to the corresponding byte elements of destination register rd.

The three least-significant bits of rs provide the shift value, interpreted as a three-bit unsigned integer; the remaining bits of rs are ignored.

This instruction writes a 1 to bi t 22 in the DSPControl register in the ouflag field if any of the left shift operations results in an overflow.

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()
tempD7..0 = shift8Left( GPR[rt]31..24, GPR[rs]2..0 )
tempC7..0 = shift8Left( GPR[rt]23..16, GPR[rs]2..0 )
tempB7..0 = shift8Left( GPR[rt]15..8, GPR[rs]2..0 )
tempA7..0 = shift8Left( GPR[rt]7..0, GPR[rs]2..0 )
GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SHLLV.PH

0

1110001

101

P32A

001000

rt

rs

rd

SHLLV_S.PH

1

1110001

101

6

5

5

5

1

7

3

Format:

SHLLV[_S].PH 

Shift Left Logical Variable Vector Pair Halfwords

SHLLV.PH   rd, rt, rs

DSP

Shift Left Logical Variable Vector Pair Halfwords

SHLLV_S.PH rd, rt, rs

DSP

Shift Left Logical Variable Vector Pair Halfwords

Purpose:

Shift Left Logical Variable Vector Pair Halfwords

Element-wise left shift of the two right-most independent halfwords in a vector data type by a variable number of bits, with optional saturation.

Description:

rd = sat16(rt31..16 << rs3..0) || sat16(rt15..0 << rs3..0)

The two halfword values in register rt are each independently shifted left by shift bits, inserting zeros into the leastsignificant bit positions emptied by the shift. In the saturating version of the instruction, if the shift results in an overflow the int ermediate result is satur ated to eit her the maximum positive or the minimum negative 16-bit value, depending on the sign of the original unshifted value. The two independent results are then written to the corresponding halfword elements of destination register rd.

The four least-significant bits of rs provide the shift value, interpreted as a four-bit unsigned integer; the remaining bits of rs are ignored.

This instruction writes a 1 to bit 22 in th e DSPControl register in the ouflag field if any of the left shift operations results in an overflow or saturation.

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:

SHLLV.PH
   ValidateAccessToDSPResources()
   tempB15..0 = shift16Left( GPR[rt]31..16, GPR[rs]3..0 )
   tempA15..0 = shift16Left( GPR[rt]15..0, GPR[rs]3..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
SHLLV_S.PH
   ValidateAccessToDSPResources()
   tempB15..0 = sat16ShiftLeft( GPR[rt]31..16, GPR[rs]3..0 )
   tempA15..0 = sat16ShiftLeft( GPR[rt]15..0, GPR[rs]3..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1111010

101

6

5

5

5

1

7

3

Format:

SHLLV_S.W rd, rt, rs

DSP

Shift Left Logical Variable Vector Word

Purpose:

Shift Left Logical Variable Vector Word

A left shift of the word in a vector data type by a variable number of bits, with optional saturation.

Description:

rd = sat32(rt31..0 << rs4..0)

The word element in register rt is shifted left by shift bits, inserting zeros into the least-significant bit positions emptied by the shift. If the shift results in an overflow the intermediate result is saturated to either the maximum positive or the minimum negative 32-bit value, depending on the sign of the original unshifted value.

The shifted result is then written to destination register rd.

The five least-significant bits of rs are used as the shift value, interpreted as a five-bit unsigned integer; the remaining bits of rs are ignored.

This instruction writes a 1 to bit 22 in the DSPControl register in the ouflag field if either of the left shift operations results in an overflow or saturation.

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 = sat32ShiftLeft( GPR[rt]31..0, GPR[rs]4..0 )
GPR[rd]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

SHLL.PH

00

1110110

101

P32A

001000

rt

rs

sa

SHLL_S.PH

10

1110110

101

6

5

5

4

2

7

3

Format:

SHLL[_S].PH 

Shift Left Logical Vector Pair Halfwords

SHLL.PH   rt, rs, sa

DSP

Shift Left Logical Vector Pair Halfwords

SHLL_S.PH rt, rs, sa

DSP

Shift Left Logical Vector Pair Halfwords

Purpose:

Shift Left Logical Vector Pair Halfwords

Element-wise shift of two independent halfwords in a vector data type by a fixed number of bits, with optional saturation.

Description:

rt = sat16(rs31..16 << sa) || (rs15..0 << sa)

The two halfword values in register rs are each independently shifted left, inserting zeros into the least-significant bit positions emptied by the shift. In the saturating version of the instruction, if the shift results in an overflow the intermediate result is saturated to either the maximum positive or the minimum negative 16-bit value, depending on the sign of the original unshifted value. The two independent results are then written to the corresponding halfword elements of destination register rt.

This instruction writes a 1 to bi t 22 in the DSPControl register in the ouflag field if any of the left shift operations results in an overflow or saturation.

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:

SHLL.PH
   ValidateAccessToDSPResources()
   tempB15..0 = shift16Left( GPR[rs]31..16, sa )
   tempA15..0 = shift16Left( GPR[rs]15..0, sa )
   GPR[rt]31..0 = tempB15..0 || tempA15..0
SHLL_S.PH
   ValidateAccessToDSPResources()
   tempB15..0 = sat16ShiftLeft( GPR[rs]31..16, sa )
   tempA15..0 = sat16ShiftLeft( GPR[rs]15..0, sa )
   GPR[rt]31..0 = tempB15..0 || tempA15..0
function shift16Left( a15..0, s3..0 )
   if ( s3..0 = 0 ) then
      temp15..0 = a15..0
   else
      sign = a15
      temp15..0 = ( a15-s..0 || 0s )
      discart15..0 = ( sign(16-s) || a14..14-(s-1) )
         DSPControlouflag:22 = 1
      endif
   endif
   return temp15..0
endfunction shift16Left
function sat16ShiftLeft( a15..0, s3..0 )
   if ( s3..0 = 0 ) then
      temp15..0 = a15..0
   else
      sign = a15
      temp15..0 = ( a15-s..0 || 0s )
      discard15..0 = ( sign(16-s) || a14..14-(s-1) )
      if (( discard15..0 != 0x0000 ) and ( discard15..0 != 0xFFFF )) then
          temp15..0 = ( sign = 0 ? 0x7FFF : 0x8000 )
          DSPControlouflag:22 = 1
      endif
   endif
   return temp15..0
endfunction sat16ShiftLeft

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

x

1111110

101

6

5

5

5

1

7

3

Format:

SHLL_S.W rt, rs, sa

DSP

Shift Left Logical Word with Saturation

Purpose:

Shift Left Logical Word with Saturation

To execute a left shift of a word with saturation by a fixed number of bits.

Description:

rt = sat32(rs << sa)

The 32-bit word in register rs is shifted left by sa bits, with zeros inserted into the bit positions emptied by the shift. If the shift results in a signed overflow, the shifted result is saturated to either the maximum positive (hexadecimal

0x7FFFFFFF) or minimum negative (hexadecimal 0x80000000) 32-bit value, depending on the sign of the original unshifted value. The shifted result is then written to destination register rt.

The instruction’s sa field specifies the shift value, interpreted as a five-bit unsigned integer.

If the shift operation results in an overflow and saturation, this instruction writes a 1 to bit 22 of 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 = sat32ShiftLeft( GPR[rs]31..0, sa4..0 )
GPR[rt]31..0 = temp31..0
function sat32ShiftLeft( a13..0, s4..0 )
   if ( s = 0 ) then
      temp31..0 = a
   else
      sign = a31
      temp31..0 = ( a31-s..0 || 0s )
      discard31..0 = ( sign(32-s) || a30..30-(s-1) )
      if (( discard31..0 != 0x00000000 ) and ( discard31..0 != 0xFFFFFFFF )) then
          temp31..0 = ( sign = 0 ? 0x7FFFFFFF : 0x80000000 )
          DSPControlouflag:22 = 1
      endif
   endif
   return temp31..0
endfunction sat32ShiftLeft

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

To do a logical left shift of a word in a register without saturation, use the MIPS32 SLL instruction.

Encoding:

P32A

001000

rt

rs

rd

SHRAV.PH

0

0110001

101

P32A

001000

rt

rs

rd

SHRAV_R.PH

1

0110001

101

6

5

5

5

1

7

3

Format:

SHRAV[_R].PH 

Shift Right Arithmetic Variable Vector Pair Halfwords

SHRAV.PH   rd, rt, rs

DSP

Shift Right Arithmetic Variable Vector Pair Halfwords

SHRAV_R.PH rd, rt, rs

DSP

Shift Right Arithmetic Variable Vector Pair Halfwords

Purpose:

Shift Right Arithmetic Variable Vector Pair Halfwords

Element-wise arithmetic right shift of two independent halfwords in a vector data type by a variable number of bits, with optional rounding.

Description:

rd = rnd16(rt31..16 >> rs3..0) || rnd16(rt15..0 >> rs3..0)

The two halfword values in register rt are each independently shifted right, with each value’s original sign bit duplicated into the most-significant bits emptied by the shift. In the non-rounding variant of this instruction, the two independent results are then written to the corresponding halfword elements of destination register rd.

In the rounding variant of this instruction, a 1 is added at the most-significant discarded bit position before the results are written to destination register rd.

The shift amount sa is given by the four least-significant bits of register rs; the remaining bits of rs are ignored.

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:

SHRAV.PH
   ValidateAccessToDSPResources()
   tempB15..0 = shift16RightArithmetic( GPR[rt]31..16, GPR[rs]3..0 )
   tempA15..0 = shift16RightArithmetic( GPR[rt]15..0, GPR[rs]3..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
SHRAV_R.PH
   ValidateAccessToDSPResources()
   tempB15..0 = rnd16ShiftRightArithmetic( GPR[rt]31..16, GPR[rs]3..0 )
   tempA15..0 = rnd16ShiftRightArithmetic( GPR[rt]15..0, GPR[rs]3..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SHRAV.QB

0

0111001

101

P32A

001000

rt

rs

rd

SHRAV_R.QB

1

0111001

101

6

5

5

5

1

7

3

Format:

SHRAV[_R].QB 

Shift Right Arithmetic Variable Vector of Four Bytes

SHRAV.QB     rd, rt, rs

DSP-R2

Shift Right Arithmetic Variable Vector of Four Bytes

SHRAV_R.QB   rd, rt, rs

DSP-R2

Shift Right Arithmetic Variable Vector of Four Bytes

Purpose:

Shift Right Arithmetic Variable Vector of Four Bytes

To execute an arithmetic right shift on four independent bytes by a variable number of bits.

Description:

rd = round(rt31..24 >> rs2..0) || round(rt23..16 >> rs2..0) || round(rt15..8 >> 
rs2..0) || round(rt7..0 >> rs2..0)

The four byte elements in register rt are each shifted right arithmetically by sa bits, then written to the corresponding byte elements in destination register rd. The sa argument is provided by the three least-significant bits of register rs, interpreted as an unsigned three-bit integer taking values from zero to seven. The remaining bits of rs are ignored.

In the rounding variant of the instruction, a value of 1 is added at the most significant discarded bit position of each result prior to writing the rounded result to the destination register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

SHRAV.QB
   ValidateAccessToDSP2Resources()
   sa2..0 = GPR[rs]2..0
   if ( sa2..0 = 0 ) then
      tempD7..0 = GPR[rt]31..24
      tempC7..0 = GPR[rt]23..16
      tempB7..0 = GPR[rt]15..8
      tempA7..0 = GPR[rt]7..0
   else
      tempD7..0 = ( GPR[rt]31)sa || GPR[rt]31..24+sa )
      tempC7..0 = ( GPR[rt]23)sa || GPR[rt]23..16+sa )
      tempB7..0 = ( GPR[rt]15)sa || GPR[rt]15..8+sa )
      tempA7..0 = ( GPR[rt]7)sa || GPR[rt]7..sa )
   endif
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
SHRAV_R.QB
   ValidateAccessToDSP2Resources()
   sa2..0 = GPR[rs]2..0
   if ( sa2..0 = 0 ) then
      tempD8..0 = ( GPR[rt]31..24 || 0)
      tempB8..0 = ( GPR[rt]15..8 || 0)
      tempA8..0 = ( GPR[rt]7..0 || 0)
   else
      tempD8..0 = ( GPR[rt]31)sa || GPR[rt]31..24+sa-1 ) + 1
      tempC8..0 = ( GPR[rt]23)sa || GPR[rt]23..16+sa-1 ) + 1
      tempB8..0 = ( GPR[rt]15)sa || GPR[rt]15..8+sa-1 ) + 1
      tempA8..0 = ( GPR[rt]7)sa || GPR[rt]7..sa-1 ) + 1
   endif
   GPR[rd]31..0 = tempD8..1 || tempC8..1 || tempB8..1 || tempA8..1

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1011010

101

6

5

5

5

1

7

3

Format:

SHRAV_R.W rd, rt, rs

DSP

Shift Right Arithmetic Variable Word with Rounding

Purpose:

Shift Right Arithmetic Variable Word with Rounding

Arithmetic right shift with rounding of a signed 32-bit word by a variable number of bits.

Description:

rd = rnd32(rt31..0 >> rs4..0)

The word value in register rt is shifted right, with the value’s original sign bit duplicated into the most-significant bits emptied by the shift. A 1 is then added at the most-significant discarded bit position before the result is written to destination register rd.

The shift amount sa is given by the five least-significant bits of register rs; the remaining bits of rs are ignored.

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 = rnd32ShiftRightArithmetic( GPR[rt]31..0, GPR[rs]4..0 )
GPR[rd]31..0 = temp31..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

x

SHRA.PH

0

1100110

101

P32A

001000

rt

rs

sa

x

SHRA_R.PH

1

1100110

101

6

5

5

4

1

1

7

3

Format:

SHRA[_R].PH 

Shift Right Arithmetic Vector Pair Halfwords

SHRA.PH   rt, rs, sa

DSP

Shift Right Arithmetic Vector Pair Halfwords

SHRA_R.PH rt, rs, sa

DSP

Shift Right Arithmetic Vector Pair Halfwords

Purpose:

Shift Right Arithmetic Vector Pair Halfwords

Element-wise arithmetic right-shift of two independent halfwords in a vector data type by a fixed number of bits, with optional rounding.

Description:

rt = rnd16(rs31..16 >> sa) || rnd16(rs15..0 >> sa)

The two halfword values in register rt are each independently shifted right by sa bits, with each value’s original sign bit duplicated into the sa most-significant bits emptied by the shift.

In the non-rounding variant of this instruction, the two independent results are then written to the corresponding halfword elements of destination register rd.

In the rounding variant of the instruction, a 1 is added at the most-significant discarded bit position before the results are written to destination register rd.

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:

SHRA.PH
   ValidateAccessToDSPResources()
   tempB15..0 = shift16RightArithmetic( GPR[rs]31..16, sa )
   tempA15..0 = shift16RightArithmetic( GPR[rs]15..0, sa )
   GPR[rt]31..0 = tempB15..0 || tempA15..0
SHRA_R.PH
   ValidateAccessToDSPResources()
   tempB15..0 = rnd16ShiftRightArithmetic( GPR[rs]31..16, sa )
   tempA15..0 = rnd16ShiftRightArithmetic( GPR[rs]15..0, sa )
   GPR[rt]31..0 = tempB15..0 || tempA15..0
function shift16RightArithmetic( a15..0, s3..0 )
   if ( s3..0 = 0 ) then
      temp15..0 = a15..0
   else
      sign = a15
      temp15..0 = ( signs || a15..s )
   endif
   return temp15..0
function rnd16ShiftRightArithmetic( a15..0, s3..0 )
   if ( s3..0 = 0 ) then
      temp16..0 = ( a15..0 || 0 )
   else
      sign = a15
      temp16..0 = ( signs || a15..s-1 )
   endif
   temp16..0 = temp + 1
   return temp16..1 
endfunction rnd16ShiftRightArithmetic

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

SHRA.QB

0

000

111

111

111

P32A

001000

rt

rs

sa

SHRA_R.QB

1

000

111

111

111

6

5

5

3

1

3

3

3

3

Format:

SHRA[_R].QB 

Shift Right Arithmetic Vector of Four Bytes

SHRA.QB    rt, rs, sa

DSP-R2

Shift Right Arithmetic Vector of Four Bytes

SHRA_R.QB  rt, rs, sa

DSP-R2

Shift Right Arithmetic Vector of Four Bytes

Purpose:

Shift Right Arithmetic Vector of Four Bytes

To execute an arithmetic right shift on four independent bytes by a fixed number of bits.

Description:

rt = round(rs31..24 >> sa) || round(rs23..16 >> sa) || round(rs15..8 >> sa) || 
round(rs7..0 >> sa)

The four byte elements in register rs are each shifted right arithmetically by sa bits, then written to the corresponding vector elements in destination register rt. The sa argument is interpreted as an unsigned three-bit integer taking values from zero to seven.

In the rounding variant of the instruction, a value of 1 is added at the most significant discarded bit position of each result prior to writing the rounded result to the destination register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

SHRA.QB
   ValidateAccessToDSP2Resources()
   tempD7..0 = ( GPR[rs]31)sa || GPR[rs]31..24+sa )
   tempC7..0 = ( GPR[rs]23)sa || GPR[rs]23..16+sa )
   tempB7..0 = ( GPR[rs]15)sa || GPR[rs]15..8+sa )
   tempA7..0 = ( GPR[rs]7)sa || GPR[rs]7..sa )
   GPR[rt]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
SHRA_R.QB
   ValidateAccessToDSP2Resources()
   if ( sa2..0 = 0 ) then
      tempD7..0 = GPR[rs]31..24
      tempC7..0 = GPR[rs]23..16
      tempB7..0 = GPR[rs]15..8
      tempA7..0 = GPR[rs]7..0
   else
      tempD8..0 = ( GPR[rs]31)sa || GPR[rs]31..24+sa-1 ) + 1
      tempC8..0 = ( GPR[rs]23)sa || GPR[rs]23..16+sa-1 ) + 1
      tempB8..0 = ( GPR[rs]15)sa || GPR[rs]15..8+sa-1 ) + 1
      tempA8..0 = ( GPR[rs]7)sa || GPR[rs]7..sa-1 ) + 1
   endif
   endif

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

x

1011110

101

6

5

5

5

1

7

3

Format:

SHRA_R.W rt, rs, sa

DSP

Shift Right Arithmetic Word with Rounding

Purpose:

Shift Right Arithmetic Word with Rounding

To execute an arithmetic right shift with rounding on a word by a fixed number of bits.

Description:

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.

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 = 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

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

To do an arithmetic right shift of a word in a register without rounding, use the MIPS32 SRA instruction.

Encoding:

P32A

001000

rt

rs

sa

001

111

111

111

6

5

5

4

3

3

3

3

Format:

SHRL.PH rt, rs, sa

DSP-R2

Shift Right Logical Two Halfwords

Purpose:

Shift Right Logical Two Halfwords

To execute a right shift of two independent halfwords in a vector data type by a fixed number of bits.

Description:

rt = (rs31..16 >> sa) || (rs15..0 >> sa)

The two halfwords in register rs are independently logically shifted right, inserting zeros into the bit positions emptied by the shift. The two halfword results are then written to the corresponding halfword elements in destination register rt.

The shift amount is provided by the sa field, which is interpreted as a four bit unsigned integer taking values between

0 and 15.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
tempB15..0 = 0sa || GPR[rs]31..sa+16 
tempA15..0 = 0sa || GPR[rs]15..sa 
GPR[rt]31..0 = tempB15..0 || tempA15..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

sa

1

100

001

111

111

6

5

5

4

1

3

3

3

3

Format:

SHRL.QB rt, rs, sa

DSP

Shift Right Logical Vector Quad Bytes

Purpose:

Shift Right Logical Vector Quad Bytes

Element-wise logical right shift of four independent bytes in a vector data type by a fixed number of bits.

Description:

rt = rs31..24 >> sa) || (rs23..16 >> sa) || (rs15..8 >> sa) || (rs7..0 >> sa)

The four byte values in register rs are each independently shifted right by sa bits and the sa most-significant bits of each value are set to zero. The four independent results are then written to the corresponding byte elements of destination register rt.

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()
tempD7..0 = shift8Right( GPR[rs]31..24, sa )
tempC7..0 = shift8Right( GPR[rs]23..16, sa )
tempB7..0 = shift8Right( GPR[rs]15..8, sa )
tempA7..0 = shift8Right( GPR[rs]7..0, sa )
GPR[rt]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
function shift8Right( a7..0, s2..0 )
   if ( s2..0 = 0 ) then
      temp7..0 = a7..0
   else
      temp7..0 = ( 0s || a7..s )
   endif
   return temp7..0
endfunction shift8Right

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

To do a logical left shift of a word in a register without saturation, use the MIPS32 SLL instruction.

Encoding:

P32A

001000

rt

rs

rd

x

1100010

101

6

5

5

5

1

7

3

Format:

SHRLV.PH rd, rt, rs

DSP-R2

Shift Variable Right Logical Pair of Halfwords

Purpose:

Shift Variable Right Logical Pair of Halfwords

To execute a right shift of two independent halfwords in a vector data type by a variable number of bits.

Description:

rd = (rt31..16 >> rs3..0) || (rt15..0 >> rs3..0)

The two halfwords in register rt are independently logically shifted right, inserting zeros into the bit positions emptied by the shift. The two halfword results are then written to the corresponding halfword elements in destination register

rd.

The shift amount is provided by the four least-significant bits of register rs, which is interpreted as a four bit unsigned integer taking values between 0 and 15. The remaining bits of rs are ignored.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ValidateAccessToDSP2Resources()
sa3..0 = GPR[rs]3..0
tempB15..0 = 0sa || GPR[rt]31..sa+16 
tempA15..0 = 0sa || GPR[rt]15..sa 
GPR[rd]31..0 = tempB15..0 || tempA15..0 

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

x

1101010

101

6

5

5

5

1

7

3

Format:

SHRLV.QB rd, rt, rs

DSP

Shift Right Logical Variable Vector Quad Bytes

Purpose:

Shift Right Logical Variable Vector Quad Bytes

Element-wise logical right shift of four independent bytes in a vector data type by a variable number of bits.

Description:

rd = (rt31..24 >> rs2..0) || (rt23..16 >> rs2..0) || (rt15..8 >> rs2..0) || (rt7..0 
>> rs2..0)

The four byte values in register rt are each independently shifte d right, inserting zeros into the most-significant bit positions emptied by the shift. The four independent results are then written to the corresponding byte elements of destination register rd.

The three least-significant bits of rs provide the shift value, interpreted as an unsigned integer; the remaining bits of rs are ignored.

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()
tempD7..0 = shift8Right( GPR[rt]31..24, GPR[rs]2..0 )
tempC7..0 = shift8Right( GPR[rt]23..16, GPR[rs]2..0 )
tempB7..0 = shift8Right( GPR[rt]15..8, GPR[rs]2..0 )
tempA7..0 = shift8Right( GPR[rt]7..0, GPR[rs]2..0 )
GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SUBQH.PH

0

1001001

101

P32A

001000

rt

rs

rd

SUBQH_R.PH

1

1001001

101

6

5

5

5

1

7

3

Format:

SUBQH[_R].PH 

Subtract Fractional Halfword Vectors And Shift Right to Halve Results

SUBQH.PH     rd, rs, rt

DSP-R2

Subtract Fractional Halfword Vectors And Shift Right to Halve Results

SUBQH_R.PH   rd, rs, rt

DSP-R2

Subtract Fractional Halfword Vectors And Shift Right to Halve Results

Purpose:

Subtract Fractional Halfword Vectors And Shift Right to Halve Results

Element-wise fractional subtr action of halfw ord vectors, with a right shift by one bit to halve each result, with optional rounding.

Description:

rd = round((rs31..16 - rt31..16) >> 1) || round((rs15..0 - rt15..0) >> 1)

Each element from the tw o halfword values in register rt is subtracted from the corresponding halfword element in register rs to create an interim 17-bit result.

In the non-rounding instruction variant, each interim result is then shifted right by one bit before being written to the corresponding halfword element of destination register rd.

In the rounding version of the instruction, a v alue of 1 is added at the least-significant bit position of each interim result; the interim result is then right-shifted by one bit and written to the destination register.

This instruction does not modify the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDQH.PH
   ValidateAccessToDSP2Resources()
   tempB15..0 = rightShift1SubQ16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = rightShift1SubQ16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
ADDQH_R.PH
   ValidateAccessToDSP2Resources()
   tempB15..0 = roundRightShift1SubQ16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = roundRightShift1SubQ16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
function rightShift1SubQ16( a15..0 , b15..0 )
   temp16..0 = (( a15 || a15..0 ) - ( b15 || b15..0 ))
   return temp16..1
endfunction rightShift1SubQ16
function roundRightShift1SubQ16( a15..0 , b15..0 )
   temp16..0 = (( a15 || a15..0 ) - ( b15 || b15..0 ))
   return temp16..1
endfunction roundRightShift1SubQ16

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SUBQH.W

0

1010001

101

P32A

001000

rt

rs

rd

SUBQH_R.W

1

1010001

101

6

5

5

5

1

7

3

Format:

SUBQH[_R].W 

Subtract Fractional Words And Shift Right to Halve Results

SUBQH.W     rd, rs, rt

DSP-R2

Subtract Fractional Words And Shift Right to Halve Results

SUBQH_R.W   rd, rs, rt

DSP-R2

Subtract Fractional Words And Shift Right to Halve Results

Purpose:

Subtract Fractional Words And Shift Right to Halve Results

Fractional subtraction of word vectors, with a right shift by one bit to halve the result, with optional rounding.

Description:

rd = round((rs31..0 - rt31..0) >> 1)

The word in register rt is subtracted from the word in register rs to create an interim 33-bit result.

In the non-rounding instruction variant, the interim result is then shifted right by one bit before being written to the destination register rd.

In the rounding version of the instruction, a value of 1 is added at the least-si gnificant bit position of the int erim result; the interim result is then right-shifted by one bit and written to the destination register.

This instruction does not modify the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDQH.W
   ValidateAccessToDSP2Resources()
   tempA31..0 = rightShift1SubQ32( GPR[rs]31..0 , GPR[rt]31..0 )
   GPR[rd]31..0 = tempA31..0
ADDQH_R.W
   ValidateAccessToDSP2Resources()
   tempA31..0 = roundRightShift1SubQ32( GPR[rs]31..0 , GPR[rt]31..0 )
   GPR[rd]31..0 = tempA31..0
function rightShift1SubQ32( a31..0 , b31..0 )
   temp32..0 = (( a31 || a31..0 ) - ( b31 || b31..0 ))
   return temp32..1
endfunction rightShift1SubQ32
function roundRightShifttSubQ32( a31..0 , b31..0 )
   temp32..0 = (( a31 || a31..0 ) - ( b31 || b31..0 ))
   temp32..0 = temp32..0 + 1
   return temp32..1
endfunction roundRightShift1SubQ32

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SUBQ.PH

0

1000001

101

P32A

001000

rt

rs

rd

SUBQ_S.PH

1

1000001

101

6

5

5

5

1

7

3

Format:

SUBQ[_S].PH 

Subtract Fractional Halfword Vector

SUBQ.PH   rd, rs, rt

DSP

Subtract Fractional Halfword Vector

SUBQ_S.PH rd, rs, rt

DSP

Subtract Fractional Halfword Vector

Purpose:

Subtract Fractional Halfword Vector

Element-wise subtraction of one vector of Q15 fractional halfword values from another to produce a vector of Q15 fractional halfword results, with optional saturation.

Description:

rd = sat16(rs31..16

-

rt31..16) || sat16(rs15..0 - rt15..0)

The two fractional halfwords in register rt are subtracted from the corresponding fractional halfword elements in register rs.

For the non-saturating version of this instruction, each result is written to the corresponding element in register rd. In the case of overflow or underflow, the result modulo 2 is written to register rd.

For the saturating version of the instruction, 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

(0x7FFF hexadecimal) or the smallest representable value (0x8000 hexadecimal), respectively, before being written to the destination register rd.

For both instructions, if any of the individual subtractions result 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:

SUBQ.PH:
   ValidateAccessToDSPResources()
   tempB15..0 = subtract16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = subtract16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
SUBQ_S.PH:
   ValidateAccessToDSPResources()
   tempB15..0 = sat16Subtract( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = sat16Subtract( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
function subtract16( a15..0, b15..0 ) 
   temp16..0 = ( a15 || a15..0 ) - ( b15 || b15..0 )
   if ( temp16 != temp15 ) then
   return temp15..0
endfunction subtract16
function sat16Subtract( a15..0, b15..0 )
   temp16..0 = ( a15 || a15..0 ) - ( b15|| b15..0 )
   if ( temp16 != temp15 ) then
      if ( temp16 = 0 ) then
          temp = 0x7FFF
      else
          temp = 0x8000
      endif
      DSPControlouflag:20 = 1
   endif
   return temp15..0
endfunction sat16Subtract

Exceptions:

Reserved Instruction, DSP Disabled

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

Encoding:

P32A

001000

rt

rs

rd

SUBUH.QB

0

1101001

101

P32A

001000

rt

rs

rd

SUBUH_R.QB

1

1101001

101

6

5

5

5

1

7

3

Format:

SUBUH[_R].QB 

Subtract Unsigned Bytes And Right Shift to Halve Results

SUBUH.QB    rd, rs, rt

DSP-R2

Subtract Unsigned Bytes And Right Shift to Halve Results

SUBUH_R.QB  rd, rs, rt

DSP-R2

Subtract Unsigned Bytes And Right Shift to Halve Results

Purpose:

Subtract Unsigned Bytes And Right Shift to Halve Results

Element-wise subtraction of two vectors of unsigned bytes, with a one-bit right shift to halve results and optional rounding.

Description:

rd = round((rs31..24 - rt31..24)>>1) || round((rs23..16 - rt23..16)>>1) || 
round((rs15..8 - rt15..8)>>1) || round((rs7..0 - rt7..0)>>1)

The four unsigned byte values in register rt are subtracted from the corresponding unsigned byte values in register rs.

Each unsigned result is then halved by shifting right by one bit position. The byte results are then written to the corresponding elements of destination register rd.

In the rounding variant of the instruction, a value of 1 is added to the result of each subtraction at the discarded bit position before the right shift.

The results of this instruction never overflow; no bits of the ouflag field in the DSPControl register are written.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

SUBUH.QB
   ValidateAccessToDSPResources()
   tempD7..0 = ( ( 0 || GPR[rs]31..24 ) - ( 0 || GPR[rt]31..24 )) >> 1
   tempC7..0 = ( ( 0 || GPR[rs]23..16 ) - ( 0 || GPR[rt]23..16 )) >> 1
   tempB7..0 = ( ( 0 || GPR[rs]15..8 ) - ( 0 || GPR[rt]15..8 )) >> 1
   tempA7..0 = ( ( 0 || GPR[rs]7..0 ) - ( 0 || GPR[rt]7..0 )) >> 1
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
SUBUH_R.QB
   ValidateAccessToDSPResources()
   tempD7..0 = ( ( 0 || GPR[rs]31..24 ) - ( 0 || GPR[rt]31..24 ) + 1) >> 1
   tempC7..0 = ( ( 0 || GPR[rs]23..16 ) - ( 0 || GPR[rt]23..16 ) + 1) >> 1
   tempB7..0 = ( ( 0 || GPR[rs]15..8 ) - ( 0 || GPR[rt]15..8 ) + 1) >> 1
   tempA7..0 = ( ( 0 || GPR[rs]7..0 ) - ( 0 || GPR[rt]7..0 ) + 1) >> 1
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SUBU.PH

0

1100001

101

P32A

001000

rt

rs

rd

SUBU_S.PH

1

1100001

101

6

5

5

5

1

7

3

Format:

SUBU[_S].PH 

Subtract Unsigned Integer Halfwords

SUBU.PH    rd, rs, rt

DSP-R2

Subtract Unsigned Integer Halfwords

SUBU_S.PH  rd, rs, rt

DSP-R2

Subtract Unsigned Integer Halfwords

Purpose:

Subtract Unsigned Integer Halfwords

Element-wise subtraction of pairs of unsigned integer halfwords, with optional saturation.

Description:

rd = sat16(rs31..16 - rt31..16) || sat16(rs15..0 - rt15..0)

The two unsigned integer halfwords in register rs are subtracted from the corresponding unsigned integer halfwords in register rt. The unsigned results are then written to the corresponding element in destination register rd.

In the saturating version of the instruction, if either subtraction results in an underflow the result is clamped to the minimum unsigned integer halfword value (0x0000 hexadecimal), before being written to the destination register rd.

For both instruction variants, if either subtraction causes an underflow the instruction writes a 1 t o bit 20 in the

DSPControl register in the ouflag field.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

SUBU.PH 
   ValidateAccessToDSP2Resources()
   tempB15..0 = subtractU16U16( GPR[rt]31..16 , GPR[rs]31..16 )
   tempA15..0 = subtractU16U16( GPR[rt]15..0 , GPR[rs]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
SUBU_S.PH 
   ValidateAccessToDSPResources()
   tempB15..0 = satU16SubtractU16U16( GPR[rt]31..16 , GPR[rs]31..16 )
   tempA15..0 = satU16SubtractU16U16( GPR[rt]15..0 , GPR[rs]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
function subtractU16U16( a15..0, b15..0 ) 
   temp16..0 = ( 0 || a15..0 ) - ( 0 || b15..0 )
   if ( temp16 = 1 ) then
      DSPControlouflag:20 = 1 
   endif
   return temp15..0
endfunction subtractU16U16 
function satU16SubtractU16U16( a15..0, b15..0 ) 
   temp16..0 = ( 0 || a15..0 ) - ( 0 || b15..0 )
   if ( temp16 = 1 ) then
      temp15..0 = 0x0000
      DSPControlouflag:20 = 1 
   endif
   return temp15..0
endfunction satU16SubtractU16U16

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

rs

rd

SUBU.QB

0

1011001

101

P32A

001000

rt

rs

rd

SUBU.QB

1

1011001

101

6

5

5

5

1

7

3

Format:

SUBU[_S].QB 

Subtract Unsigned Quad Byte Vector

SUBU.QB   rd, rs, rt

DSP

Subtract Unsigned Quad Byte Vector

SUBU_S.QB rd, rs, rt

DSP

Subtract Unsigned Quad Byte Vector

Purpose:

Subtract Unsigned Quad Byte Vector

Element-wise subtraction of one vector of unsigned byte values from another to produce a vector of unsigned byte results, with optional saturation.

Description:

rd = sat8(rs31..24 - rt31..24) || sat8(rs23..16 - rt23..16) || sat8(rs15..8 - 
rt15..8) || sat8(rs7..0 - rt7..0)

The four byte elements in rt are subtracted from the corresponding byte elements in register rs.

For the non-saturating version of the instruction, the result modulo 256 is written into the corresponding position in register rd.

For the saturating version of the instruction the subtraction is performed using unsigned saturating arithmetic. If the subtraction results in underflow, the value is clamped to the smallest representable value (0 decimal, 0x00 hexadecimal) before being written to the destination register rd.

For each instruction, if any of the individual subtractions result in underflow 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:

SUBU.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = subtractU8( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = subtractU8( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = subtractU8( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = subtractU8( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
SUBU_S.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = satU8Subtract( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = satU8Subtract( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = satU8Subtract( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = satU8Subtract( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
   if ( temp8 = 1 ) then
      DSPControlouflag:20 = 1
   endif
   return temp7..0
endfunction subtractU8
function satU8Subtract( a7..0, b7..0 )
   temp8..0 = ( 0 || a7..0 ) - ( 0 || b7..0 )
   if ( temp8 = 1 ) then
      temp7..0 = 0x00
      DSPControlouflag:20 = 1
   endif
   return temp7..0
endfunction satU8Subtract

Exceptions:

Reserved Instruction, DSP Disabled

Encoding:

P32A

001000

rt

mask

01

011

001

111

111

6

5

7

2

3

3

3

3

Format:

WRDSP rt, mask

DSP

Write Fields to DSPControl Register from a GPR

Purpose:

Write Fields to DSPControl Register from a GPR

To copy selected fields from the specified GPR to the special-purpose DSPControl register.

Description:

DSPControl = select(mask, GPR[rt])

Selected fields in the special register DSPControl are overwritten with the corresponding bits from the source GPR rt.

Each of bits 0 through 5 of the mask operand corresponds to a specific field in the DSPControl register. A mask bit value of 1 indicates that the field will be overwritten using the bits from the same bit positions in register rt, and a mask bit value of 0 indicates that the corresponding field will be unchanged. Bits 6 through 9 of the mask operand are ignored.

The table below shows the correspondence between the bits in the mask operand and the fields in the DSPControl register; mask bit 0 is the least-significant bit in mask.

ccond

ouflag

0

EFI C

scount

pos

4

3

5

2

1

0

For example, to overwrite only the scount field in DSPControl, the value of the mask operand used will be 2 decimal

(0x02 hexadecimal). After execution of the instruction, the scount field in DSPControl will have the value of bits 7 through 12 of the specified source register rt and the remaining bits in DSPControl are unmodified.

The one-operand version of the instruction provides a convenient assembly idiom that allows the programmer to write

, it is equivalent to specifying a mask all the allowable fields in the DSPControl register from the source GPR, i.e. value of 31 decimal (0x1F hexadecimal).

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()
newbits31..0 = 032
overwrite31..0 = 0xFFFFFFFF
if ( mask0 = 1 ) then
   overwrite5..0 = 06
   newbits5..0 = GPR[rt]5..0
endif
if ( mask1 = 1 ) then
   overwrite12..7 = 06
   newbits12..7 = GPR[rt]12..7
endif
if ( mask2 = 1 ) then
   newbits13 = GPR[rt]13
endif
if ( mask3 = 1 ) then
   overwrite23..16 = 08
   newbits23..16 = GPR[rt]23..16
endif
if ( mask4 = 1 ) then
   overwrite31..24 = 08
   newbits31..24 = GPR[rt]31..24
endif
if ( mask5 = 1 ) then
   overwrite14 = 0
   newbits14 = GPR[rt]14
endif
DSPControl = DSPControl and overwrite31..0
DSPControl = DSPControl or new31..0

Exceptions:

Reserved Instruction, DSP Disabled