c.li

Load the sign-extended 6-bit immediate

This instruction is defined by:

  • anyOf:

    • C, version >= 0

    • Zca, version >= 0

This instruction is included in the following profiles:

Encoding

svg

Assembly format

c.li rd, imm

Synopsis

C.LI loads the sign-extended 6-bit immediate, imm, into register rd. C.LI expands into addi rd, x0, imm. C.LI is only valid when rd ≠ x0; the code points with rd=x0 encode HINTs.

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<6> imm = {$encoding[12], $encoding[6:2]};
Bits<5> rd = $encoding[11:7];

Execution

  • IDL

if (implemented?(ExtensionName::C) && (CSR[misa].C == 1'b0)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
X[rd] = imm;

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction