c.addi
Add a sign-extended non-zero immediate
This instruction is defined by:
Synopsis
C.ADDI adds the non-zero sign-extended 6-bit immediate to the value in register rd then writes the result to rd.
C.ADDI expands into addi rd, rd, imm
.
C.ADDI is only valid when rd ≠ x0 and imm ≠ 0.
The code points with rd=x0 encode the C.NOP instruction; the remaining code points with imm=0 encode HINTs.
Execution
-
Pruned, XLEN == 64
-
Original
X[rd] = X[rd] + imm;
if (implemented?(ExtensionName::C) && (CSR[misa].C == 1'b0)) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
X[rd] = X[rd] + imm;