Conditional Branches
Conditional Branches
Conditional Branches
BRANCHES IN PIPELINED
COMPUTERS
Presented by:-
Dilip Mathuria
M.Tech (VLSI)
OVERVIEW
In this presentation we are going to discuss about the :-
Arithmetic operation
BCS C=1 Carry set
gave carry out
Arithmetic operation
BCC C=1 Carry clear did not produce a
carry
Unsigned comparison
BHS C=1 Higher or same gave higher or same
result
Unsigned
BLO C=0 Lower comparison gave
lower result
Result is minus or
BMI N=1 Minus
negative
Result is positive
BPL N=0 Plus
(plus) or zero
Signed integer
BVS V=1 Overflow Set operation: overflow
occurred
Signed integer
BVC V=0 Overflow Clear operation: no
overflow occurred
((NOT C) OR Z) =0 Unsigned comparison
BHI Higher
{C set and Z clear} gave higher
((NOT C) OR Z) =1 Unsigned comparison
BLS Lower or same
{C set or Z clear} gave lower or same
(N EOR V) =0 Signed integer
BGE {(N and V) set or (N Greater or Equal comparison gave
and V) clear} greater than or equal
(N EOR V) =1
Signed integer
{(N set and V clear)
Effect of conditional branch on
instruction pipeline operation
Conditional branch instructions
Assume that the instruction 3 is a conditional branch to
instruction 15.
Until the instruction is executed there is no way of
knowing which instruction will come next
The pipeline will simply loads the next instruction in the
sequence and execute.
Branch is not determined until the end of time unit 7.
During time unit 8,instruction 15 enters into the
pipeline.
No instruction complete during time units 9 through 12.
This is the performance penalty incurred because we
could not anticipate the branch.
Dealing with Branches
A major problem in designing an instruction pipeline is
assuring a steady flow of instructions to the initial stages of
the pipeline.
Multiple streams
Pre fetch branch target.
Loop buffer
Branch prediction
Delayed branch
Multiple streams
In simple pipeline, it must choose one of the two
instructions to fetch next and may make wrong choice.
In multiple streams allow the pipeline to fetch both
instructions making use of two streams.
Problems with this approach
With multiple pipelines there are contention delays for the
access to the registers and to memory.
Additional branch instructions may enter the pipeline(either
stream)before the original branch decision is resolved. Each
such instructions needs an additional branch.
Examples:
IBM 370/168 AND IBM 3033.
Prefetch Branch Target
When a conditional branched is recognized, the target of the
branch is prefetched, in addition to the instruction following
the branch.
Branch address
8 Instruction to be
Loop buffer decoded in case of
hit (256 bytes)