lui

Load upper immediate

This instruction is defined by:

  • I, version >= 0

This instruction is included in the following profiles:

  • RVA20S64 (Mandatory)

  • RVA20U64 (Mandatory)

  • RVA22S64 (Mandatory)

  • RVA22U64 (Mandatory)

Encoding

svg

Assembly format

lui rd, imm

Synopsis

This instruction must have data-independent timing when extension Zkt is enabled.

Load the zero-extended imm into rd.

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<32> imm = {$encoding[31:12], 12'd0};
Bits<5> rd = $encoding[11:7];

Execution

  • IDL

  • Sail

X[rd] = imm;
{
  let off : xlenbits = sign_extend(imm @ 0x000);
  let ret : xlenbits = match op {
    RISCV_LUI   => off,
    RISCV_AUIPC => get_arch_pc() + off
  };
  X(rd) = ret;
  RETIRE_SUCCESS
}