c.jalr
Jump and Link Register
C.JALR (jump and link register) performs the same operation as C.JR, but additionally writes the address of the instruction following the jump (pc+2) to the link register, x1. C.JALR expands to jalr x1, 0(xs1).
Execution
if (implemented?(ExtensionName::C) && MISA_CSR_IMPLEMENTED && (CSR[misa].C == 1'b0)) {
reserved_instruction($encoding);
}
XReg addr = X[xs1];
XReg returnaddr;
returnaddr = $pc + 2;
X[1] = returnaddr;
jump(addr);
Exceptions
This instruction may result in the following synchronous exceptions:
-
IllegalInstruction
-
InstructionAddressMisaligned