Webcentive RISC-V Reference

jal

Jump and link

Extension
RV32I/RV64I base integer
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
jal xd, imm
Length
32-bit

Encoding

RV32 and RV64 form

31121176210
imm[20|10:1|11|19:12]rd1101111

Match 0x0000006f, mask 0x0000007f. Source: jal rd jimm20 6..2=0x1b 1..0=3 in riscv-opcodes/extensions/rv_i.

FieldBitsriscv-opcodes name
imm[20|10:1|11|19:12]31:12jimm20
rd11:7rd

RV32 and RV64 form; listed in riscv-opcodes as a pseudo-op of jal

31121176210
imm[20|10:1|11|19:12]000011101111

Match 0x000000ef, mask 0x00000fff. Source: $pseudo_op rv_i::jal jal jimm20 11..7=0x01 6..2=0x1b 1..0=3 in riscv-opcodes/extensions/rv_i.

FieldBitsriscv-opcodes name
imm[20|10:1|11|19:12]31:12jimm20

Description

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

Description from riscv-unified-db, reformatted.

Operation

XReg return_addr = $pc + 4;

X[xd] = return_addr;
jump_halfword($pc + $signed(imm));

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages