Encoding:

POOL32A

000000

rt

rs

msbd

(size-1)

lsb

(pos)

EXT

101100

6

5

5

5

5

6

Format:

EXT rt, rs, pos, size

microMIPS

Extract Bit Field

Purpose:

Extract Bit Field

To extract a bit field from GPR rs and store it right-justified into GPR rt.

Description:

 GPR[rt] = ExtractField(GPR[rs], msbd, lsb)

The bit field starting at bit pos and extending for size bits is extracted from GPR rs and stored zero-extended and right-justified in GPR rt. The assembly language arguments pos and size are converted by the assembler to the instruction fields msbd (the most significant bit of the destination field in GPR rt), in instruction bits 15..11, and lsb

(least significant bit of the source field in GPR rs), in instruction bits 10..6, as follows:

msbd = 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+msbd > 31.

If GPR rs does not contain a sign-extended 32-bit value (bits 63..31 equal), then the result of the operation is

UNPREDICTABLE.

Operation:

if ((lsb + msbd) > 31) or (NotWordValue(GPR[rs])) then
   UNPREDICTABLE
endif
temp = sign_extend(032-(msbd+1) || GPR[rs]msbd+lsb..lsb)
GPR[rt] = temp

Exceptions:

Reserved Instruction