PC-relative Branch Range
Conditional branches use the B-type immediate, a signed PC-relative offset in 2-byte units, giving an approximate reach of +/-4 KiB from the current PC.
RISC-V Unprivileged ISA, RV32I control transfer instructionsBranch to PC-relative offset if rs1 is not equal to rs2
BNE (B-type, opcode=1100011, funct3=001) compares rs1 and rs2 and takes the branch if they are not equal. The B-immediate encodes a signed 12-bit offset in multiples of 2, giving a ±4 KiB range. When the condition is false, fallthrough execution occurs.
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.
BNE is a conditional branch: when rs1 and rs2 satisfy the not equal condition, the PC branches to the current PC plus the B-type offset; otherwise execution falls through.
These notes are checked against the RISC-V Unprivileged ISA manual and summarize operation semantics, immediate ranges, and edge behavior.
Conditional branches use the B-type immediate, a signed PC-relative offset in 2-byte units, giving an approximate reach of +/-4 KiB from the current PC.
RISC-V Unprivileged ISA, RV32I control transfer instructionsConditional branches only update the PC based on the comparison result. They do not write rd or save a return address; use JAL/JALR forms for calls and returns.
RISC-V Unprivileged ISA, RV32I control transfer instructionsUnderstand this scenario with real code like «bne x3, x4, label # if x3 != x4, branch to label».
Conditional branches use a B-type immediate, giving an approximate reach of +/-4 KiB from the current PC.
BLT/BGE compare as signed integers; BLTU/BGEU compare as unsigned integers. BEQ/BNE only test equality of the bit patterns.