Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

lui

The RISC-V instruction that puts a number into the upper part of a register, ready for addi to fill in the low 12 bits.

lui rd, imm20 writes imm20 << 12, sign-extended to 64 bits on RV64, to rd; lui followed by addi builds any 32-bit signed constant (the li pseudo-instruction expands to such sequences).

Examples

  • lui a0, 0x12345 sets a0 to 0x12345000; addi a0, a0, 0x678 then gives 0x12345678.

Read the full section →