Encoding:

POOL16E

011011

rd

Immediate

1

6

3

6

1

Format:

ADDIUR1SP rd, decoded_immediate_value

microMIPS

Add Immediate Unsigned Word One Register (16-bit instr size)

Purpose:

Add Immediate Unsigned Word One Register (16-bit instr size)

To add a constant to a 32-bit integer.

Description:

GPR[rd] = GPR[29] + zero_extend(immediate << 2) 

The 6-bit immediate field is first shifted left by two bits and then zero-extended. This amount is added to the 32-bit value in GPR 29 and the 32-bit arithmetic result is sign-extended and placed into GPR rd.

No Integer Overflow exception occurs under any circumstances.

Restrictions:

The 3-bit register fields can only specify GPRs $2-$7, $16, $17.

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 NotWordValue(GPR[rs]) then 
   UNPREDICTABLE 
endif
temp = GPR[29] + zero_extend(immediate || 02)
GPR[rd] = sign_extend(temp31..0)

Exceptions:

None

Programming Notes:

The term "unsigned" in the instruction name is a misnomer; this operation is 32-bit modulo arithmetic that does not trap on overflow. This instruction is appropriate for unsigned arithmetic, such as address arithmetic, or integer arithmetic environments that ignore overflow, such as C language arithmetic.