JAL
Jump and Link
JAL rd, offset
Jumps to an offset relative to PC and saves the return address (PC+4) to rd.
Details
JAL (Jump and Link) adds the sign-extended J-immediate (encoded in multiples of 2 bytes) to the PC of the JAL instruction to form the jump target, stores PC+4 into rd as a return address, then jumps. Plain unconditional jumps use rd=x0.
Pseudocode Operation
R[rd] = PC + 4; PC += sext(offset);
Example
JAL x1, loop_target
Encoding
Binary Layout
imm[20
10:1
11
31:30
19:12]
rd
29:25
1101111
24:18
Operands
-
rd
Return Address Dest -
offset
20-bit PC-relative Offset