U-type Upper Immediate
LUI places the 20-bit U-immediate in the upper portion of rd and clears the low 12 bits. On RV64, the 32-bit result is sign-extended to XLEN.
RISC-V Unprivileged ISA, RV32I integer computational instructionsPlace the U-immediate in result bits 31:12, clear bits 11:0, and write rd
LUI uses the U-type format (opcode=0110111). Encoded imm[31:12] forms a 32-bit U-immediate: bits 31:12 come from that field and bits 11:0 are zero, then the result is written to rd. In RV64I, this 32-bit result is sign-extended to 64 bits. LUI commonly helps construct larger constants; an LUI encoding with rd=x0 is standard HINT space and does not change x0.
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
LUI places the U-immediate into the upper portion of rd and clears the low 12 bits, commonly as the first step when forming larger constants.
These notes are checked against the RISC-V Unprivileged ISA manual and summarize operation semantics, immediate ranges, and edge behavior.
LUI places the 20-bit U-immediate in the upper portion of rd and clears the low 12 bits. On RV64, the 32-bit result is sign-extended to XLEN.
RISC-V Unprivileged ISA, RV32I integer computational instructionsUnderstand this scenario with real code like «lui x5, 0x12345 # x5 = 0x12345 << 12 = 0x12345000».
No. LUI sets the upper 20 bits and clears the low 12 bits; a full constant usually needs a following instruction such as ADDI.
LUI forms a value from the immediate alone; AUIPC adds the upper-immediate offset to the current PC.