Encoding:

SPECIAL3

011111

rs

rt

0

00000

0

00000

INSV

001100

6

5

5

5

5

6

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.

If either register rs or register rt does not contain sign-extended 32-bit values (bits 63..31 equal), then the result of the operation is UNPREDICTABLE.

Operation:

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

Exceptions:

Reserved Instruction, DSP Disabled