li
Load Immediate
li RT, SIM
Loads a 16-bit signed immediate into a register. (Alias for 'addi RT, 0, SIM').
Details
The Load Immediate instruction loads an immediate value into a general-purpose register.
Pseudocode Operation
R[T] ← IMM
Programming Note
The `li` instruction is commonly used for initializing or resetting registers to specific values. Ensure the immediate value fits within the 32-bit signed integer range to avoid unexpected behavior. This instruction operates at user privilege level and does not generate exceptions unless there are issues with the instruction encoding.
Example
li r3, 4
Encoding
Binary Layout
14
0
RT
6
0
11
SIM
16
Operands
-
RT
Target -
SIM
Immediate