LUI
Load Upper Immediate
LUI rd, imm
Loads the 20-bit immediate into the upper 20 bits of the register (lower 12 bits are zero).
Details
LUI (Load Upper Immediate) places the 20-bit U-immediate into bits 31:12 of rd, filling bits 11:0 with zeros and sign-extending to XLEN bits. It is used together with ADDI to build arbitrary 32-bit constants.
Pseudocode Operation
R[rd] = imm << 12;
Example
LUI x10, 0x12345
Encoding
Binary Layout
imm[31:12]
31:12
rd
11:7
0110111
6:0
Operands
-
rd
Destination Register -
imm
20-bit Upper Immediate