B
Branch Using a Displacement
3-40
Syntax
B (.unit) label
.unit = .S1 or .S2
Opcode map field used...
For operand type...
Unit
cst
scst21
.S1, .S2
Opcode
21
z
6
0
cst
0
0
1
0
0
s
p
31
creg
29 28 27
7
1
3
1
1
Description
A 21-bit signed constant specified by
cst is shifted left by 2 bits and is added
to the address of the first instruction of the fetch packet that contains the
branch instruction. The result is placed in the program fetch counter (PFC).
The assembler/linker automatically computes the correct value for
cst by the
following formula:
cst = (label – PCE1)
>>
2
If two branches are in the same execute packet and both are taken, behavior
is undefined.
Two conditional branches can be in the same execute packet if one branch
uses a displacement and the other uses a register, IRP, or NRP. As long as only
one branch has a true condition, the code executes in a well-defined way.
Execution
if (cond)
cst
<<
2 + PCE1
→
PFC
else
nop
Notes:
1) PCE1 (program counter) represents the address of the first instruction
in the fetch packet in the E1 stage of the pipeline. PFC is the program
fetch counter.
2) The execute packets in the delay slots of a branch cannot be interrupted.
This is true regardless of whether the branch is taken.
3) See section 3.5.2 on page 3-15 for information on branching into the
middle of an execute packet.