Professional Documents
Culture Documents
Instruction Pipelining
Control Hazards
Pipelining hazards
Control hazards
5-stage pipeline
Time
I1 FI DI FO EI WO
I2 FI DI FO EI WO
I3 FI DI FO EI WO
Pipeline hazards
Resource hazards
Data Hazards
Control Hazards
JL 100 FI DI FO EI WO
MOV R3,8 FI DI FO EI WO
MOV R4,9 FI DI FO EI WO
NOP FI DI FO EI
NOP FI DI FO
100: ADD R2,R1 FI DI
Different types:
Static prediction: Prediction does not change
Predict a branch is never taken
Predict a branch is always taken
Predict backward is taken, forward is not taken
Dynamic prediction: Prediction changes based on branch
history
Last time prediction (single bit)
Two-bit counter based prediction
Zelalem Birhanu, AAiT 10
Branch Never Taken
MOV R1,0
100: ADD R2, R1
INC R1
CMP R1,1000 Backward branch,
103: JL 100 branch is taken
0 1
Actually
not taken
Actually Predict
Predict
not taken not
not
Actually taken
taken Actually
not taken
taken
00 01
Actually
not taken Actually
Predict Predict
taken Actually
taken taken
taken
Actually
11 not taken 10
Zelalem Birhanu, AAiT 17
Two-bit Counter Based Predictioncntd