Encoding:

POOL32A

000000

rt

rs

msbd

(pos+size-1)

lsb

(pos)

INS

001100

6

5

5

5

5

6

Format:

INS rt, rs, pos, size

microMIPS

Insert Bit Field

Purpose:

Insert Bit Field

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

Description:

 GPR[rt] = InsertField(GPR[rt], GPR[rs], msb, lsb)

The right-most size bits from GPR rs are merged into the value from GPR rt starting at bit position pos. The result is placed back in GPR rt. The assembly language arguments pos and size are converted by the assembler to the instruction fields msb (the most significant bit of the field), in instruction bits 15..11, and lsb (least significant bit of the field), in instruction bits 10..6, as follows:

msb = pos+size-1
lsb = pos

The values of pos and size must satisfy all of the following relations:

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

Restrictions:

In implementations prior to Release 2 of the architecture, this instruction resulted in a Reserved Instruction exception.

The operation is UNPREDICTABLE if lsb > msb.

If either GPR rs or GPR 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] = sign_extend(GPR[rt]31..msb+1 || GPR[rs]msb-lsb..0 || GPR[rt]lsb-1..0)

Exceptions:

Reserved Instruction