BEQ 000100 |
0 00000 |
0 00000 |
offset |
6 |
5 |
5 |
16 |
B offset |
MIPS32, Assembly Idiom |
Unconditional Branch |
Unconditional Branch
To do an unconditional branch.
B offset is the assembly idiom used to denote an unconditional branch. The actual instruction is interpreted by the hardware as BEQ r0, r0, offset.
An 18-bit signed offset (the 16-bit offset field shifted left 2 bits) is added to the address of the instruction following the branch (not the branch itself), in the branch delay slot, to form a PC-relative effective target address.
Control Transfer Instructions (CTIs) should not be placed in branch delay slots or Release 6 forbidden slots. CTIs
include all branches and jumps, NAL, ERET, ERETNC, DERET, WAIT, and PAUSE.
Pre-Release 6: Processor operation is UNPREDICTABLE if a control transfer instruction (CTI) is placed in the delay slot of a branch or jump.
Release 6: If a control transfer instruction (CTI) is executed in the delay slot of a branch or jump, Release 6 implementations are required to signal a Reserved Instruction exception.
I: target_offset = sign_extend(offset || 02) I+1: PC = PC + target_offset
None
With the 18-bit signed instruction offset, the conditional branch range is ± 128 Kbytes. Use jump (J) or jump register
(JR) or the Release 6 branch compact (BC) instructions to branch to addresses outside this range.