Pipeline - Instr - Super Branch
Pipeline - Instr - Super Branch
405
Module - 5 Part - 1
Instruction Pipeline Design
Data Hazard Classification - RAW
• Three types of data hazards
• Instruction i comes before instruction j
– RAW : Read After Write R(I)∩ D(J) ≠ ɸ
(flow dependence)
• j tries to read a source before i writes it, so j incorrectly
gets the old value. Solve via forwarding.
Data Hazard Classification - WAW
– WAW : Write After Write R(I)∩ R(J) ≠ ɸ
(output dependence)
• j tries to write an operand before it is written by i, so
we end up writing values in the wrong order
• Only occurs if there are writes in multiple stages
– Not a problem with single cycle integer
instructions
Data Hazard Classification - WAR
• WAR : Write After Read D(I) ∩ R(J) ≠ ɸ
• (anti dependence)
– j tries to write a destination before it is read by i, so i incorrectly gets
the new value
– For this to happen we need a pipeline that writes results early in the
pipeline, and then other instruction read a source later in the pipeline
Add1
Add2 Mult1
Add3 Mult2
Reservation To Mem
Stations
FP
FPadders
adders FP
FPmultipliers
multipliers
• Reservation stations
– Instructions advance past integer control flow operations
– buffer old values of registers - avoiding WAR stall in scoreboard.
Tomasulo
• For IBM 360/91 (before caches!)
• Goal: High Performance without special compilers
• Small number of floating point registers (4 in 360)
prevented interesting compiler scheduling of
operations
– Tomasulo: how to get more effective registers — renaming in hardware!
If b= k-1 = 7
Pipeline performance can be degraded by 46% with branching when
instruction stream is sufficiently long .
Branch Handling Techniques
Dynamic Hardware Prediction
The buffer is indexed by the last few bits of address of the branch
instructions.
Buffer read in the “D” phase. Penalty for wrong prediction depends on
when the PC is calculated.
Dynamic Branch Prediction
• Performance = ƒ(accuracy, cost of misprediction)
• Branch History Lower bits of PC address index table of 1-bit values
– Says whether or not branch taken last time
• Problem: in a loop, 1-bit BHT will cause two mis-predictions:
– End of loop case, when it exits instead of looping as before
– First time through loop on next time through code, when it predicts
exit instead of looping
P
Address 0 r
e
d
31 1 Bits 13 - 2 i
c
t
1023 i
o
n
Dynamic Branch Prediction
• A 1-bit scheme for dynamic branch prediction
for (i =10, i > 0, i =i - 1)
x := x+1