Branch And Branch With Link (B, Bl); The Link Bit; Instruction Cycle Times; Branch Instructions - Samsung S3C2501X User Manual

32-bit risc microprocessor
Table of Contents

Advertisement

S3C2501X

3.4 BRANCH AND BRANCH WITH LINK (B, BL)

The instruction is only executed if the condition is true. The various conditions are defined Table 3-2. The
instruction encoding is shown in Figure 3-3, below.
31
28
27
Cond
Branch instructions contain a signed 2's complement 24 bit offset. This is shifted left two bits, sign extended to 32
bits, and added to the PC. The instruction can therefore specify a branch of +/- 32Mbytes. The branch offset must
take account of the pre-fetch operation, which causes the PC to be 2 words (8 bytes) ahead of the current
instruction.

3.4.1 THE LINK BIT

Branch with Link (BL) writes the old PC into the link register (R14) of the current bank. The PC value written into
R14 is adjusted to allow for the pre-fetch, and contains the address of the instruction following the branch and link
instruction. Note that the CPSR is not saved with the PC and R14[1:0] are always cleared.
To return from a routine called by branch with link use MOV PC,R14 if the link register is still valid or LDM
Rn!,{..PC} if the link register has been saved onto a stack pointed to by Rn.

3.4.2 INSTRUCTION CYCLE TIMES

Branch and branch with link instructions take 2S + 1N incremental cycles, where S and N are defined as
sequential (S-cycle) and internal (I-cycle).
25
24
23
101
L
[24] Link Bit
0 = Branch
[31:28] Condition Field
Figure 3-3. Branch Instructions
Offset
1 = Branch with link
INSTRUCTION SET
0
3-7

Advertisement

Table of Contents
loading

Table of Contents