jal

Jump and link

This instruction is defined by:

Encoding

svg

Synopsis

Jump to a PC-relative offset and store the return address in rd.

Access

M

HS

U

VS

VU

Always

Always

Always

Always

Always

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

  • Pruned, XLEN == 64

  • Original

XReg retrun_addr = $pc + 4;
jump_halfword($pc + imm);
X[rd] = retrun_addr;
XReg retrun_addr = $pc + 4;
jump_halfword($pc + imm);
X[rd] = retrun_addr;