jal
Jump and link
This instruction is defined by:
-
I, version >= 0
This instruction is included in the following profiles:
-
RVA20S64 (Mandatory)
-
RVA20U64 (Mandatory)
-
RVA22S64 (Mandatory)
-
RVA22U64 (Mandatory)
Decode Variables
signed Bits<21> imm = sext({$encoding[31], $encoding[19:12], $encoding[20], $encoding[30:21], 1'd0});
Bits<5> rd = $encoding[11:7];
Execution
-
IDL
-
Sail
XReg retrun_addr = $pc + 4;
jump_halfword($pc + imm);
X[rd] = retrun_addr;
{
let t : xlenbits = PC + sign_extend(imm);
/* Extensions get the first checks on the prospective target address. */
match ext_control_check_pc(t) {
Ext_ControlAddr_Error(e) => {
ext_handle_control_check_error(e);
RETIRE_FAIL
},
Ext_ControlAddr_OK(target) => {
/* Perform standard alignment check */
if bit_to_bool(target[1]) & not(extension("C"))
then {
handle_mem_exception(target, E_Fetch_Addr_Align());
RETIRE_FAIL
} else {
X(rd) = get_next_pc();
set_next_pc(target);
RETIRE_SUCCESS
}
}
}
}