c.jalr
Jump and Link Register.
This instruction is defined by:
Synopsis
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(rs1).
Execution
-
Pruned, XLEN == 64
-
Original
if ((%%LINK%csr_field;misa.C;CSR[misa].C%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
XReg returnaddr;
returnaddr = $pc + 2;
%%LINK%func;jump;jump%%(X[rs1]);
X[1] = returnaddr;
if (%%LINK%func;implemented?;implemented?%%(ExtensionName::C) && (%%LINK%csr_field;misa.C;CSR[misa].C%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
XReg returnaddr;
returnaddr = $pc + 2;
%%LINK%func;jump;jump%%(X[rs1]);
X[1] = returnaddr;