IDT
Instruction Set
79RC32355 User Reference Manual
A - 27
November 4, 2002
Notes
BEQ
Format:
BEQ rs, rt, offset
MIPS32
Purpose:
To compare GPRs then do a PC-relative conditional branch
Description:
if rs = rt then branch
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-rela-
tive effective target address.
If the contents of GPR
rs
and GPR
rt
are equal, branch to the effective target address after the
instruction in the delay slot is executed.
Restrictions:
Processor operation is
UNPREDICTABLE
if a branch, jump, ERET, DERET, or WAIT instruction
is placed in the delay slot of a branch or jump.
Operation:
I:
target_offset
←
sign_extend(offset || 0
2
)
condition
←
(GPR[rs] = GPR[rt])
if condition then
PC
←
PC + target_offset
endif
I+1:
Exceptions:
None
Programming Notes:
With the 18-bit signed instruction offset, the conditional branch range is ± 128 Kbytes. Use jump
(J) or jump register (JR) instructions to branch to addresses outside this range.
BEQ r0, r0 offset, expressed as B offset, is the assembly idiom used to denote an unconditional
branch.
31
26 25
21 20
16 15
0
BEQ
000100
rs
rt
offset
6
5
5
16
Branch on Equal
BEQ