c.lui
Load the non-zero 6-bit immediate field into bits 17-12 of the destination register
This instruction is defined by:
Synopsis
C.LUI loads the non-zero 6-bit immediate field into bits 17-12 of the destination register, clears the bottom 12 bits, and sign-extends bit 17 into all higher bits of the destination.
C.LUI expands into lui rd, imm
.
C.LUI is only valid when rd≠x0 and rd≠x2, and when the immediate is not equal to zero.
The code points with imm=0 are reserved; the remaining code points with rd=x0 are HINTs; and the remaining code points with rd=x2 correspond to the C.ADDI16SP instruction
Decode Variables
Bits<18> imm = {$encoding[12], $encoding[6:2], 12'd0};
Bits<5> rd = $encoding[11:7];
Execution
-
Pruned, XLEN == 64
-
Original
X[rd] = imm;
if (implemented?(ExtensionName::C) && (CSR[misa].C == 1'b0)) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
X[rd] = imm;