AUIPC
Add Upper Immediate to PC
AUIPC rd, imm
Adds a 20-bit upper immediate to the Program Counter, used for PC-relative addressing.
Encoding
Binary Layout
imm20
31:12
rd
11:7
0010111
6:0
Operands
-
rd
Destination Register -
imm
20-bit Upper Immediate
Example
AUIPC x10, 0x1000
// Adds 0x1000000 to the current PC and stores in x10.
Related
More in RV32I
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
AUIPC (Add Upper Immediate to PC) forms a 32-bit offset from the 20-bit U-immediate (filling the low 12 bits with zeros), adds it to the PC of the AUIPC instruction, and places the result in rd. It is used for PC-relative addressing.
Operation
R[rd] = PC + (imm << 12);