Target Address Calculation
JALR forms the target from rs1 plus a sign-extended 12-bit immediate, then clears the least-significant bit of the target address before jumping.
RISC-V Unprivileged ISA, RV32I control transfer instructionsJump to rs1 + sign-extended 12-bit immediate (LSB cleared), storing return address in rd
JALR (I-type, opcode=1100111, funct3=000) computes the target address as rs1 + sign-extended 12-bit immediate, with the LSB always cleared to zero. PC+4 is stored in rd. When rd=x0, it acts as an indirect jump (pseudo JR). When rd=x0, rs1=x1, imm=0, it is a return (pseudo RET). LSB clearing simplifies hardware and allows auxiliary info in function pointer LSB. rd/rs1 combinations of x1/x5 provide implicit RAS hints.
Uses the same rhythm as the ADDI page: machine-code fields, fixed-field identification, operand reads, instruction-specific execution, and ISA-visible state update.
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
JALR is register-indirect jump-and-link: the target is rs1 plus a sign-extended 12-bit immediate, with bit 0 cleared before jumping, and pc+4 written to rd.
These notes are checked against the RISC-V Unprivileged ISA manual and summarize operation semantics, immediate ranges, and edge behavior.
JALR forms the target from rs1 plus a sign-extended 12-bit immediate, then clears the least-significant bit of the target address before jumping.
RISC-V Unprivileged ISA, RV32I control transfer instructionsLike JAL, JALR writes pc+4 to rd. The ret pseudo-instruction commonly expands to jalr x0, 0(ra), so it does not write a link register.
RISC-V Unprivileged ISA, RV32I control transfer instructionsUnderstand this scenario with real code like «jalr x1, 0(x5) # jump to x5, x1 = pc+4».
Understand this scenario with real code like «jalr x1, 0(x5) # jump to x5, x1 = pc+4».
The official manual says this simplifies hardware and allows auxiliary information in the low bit of function pointers.
A common return form is jalr x0, 0(ra): it writes no return address and jumps to the address in ra.