Lecture # 8B
Lecture # 8B
Lecture # 8
Course Instructor: Dr. Noshina
Outline
• Pipeline and ISA design
• Pipeline hazards
• Structural hazard
• Data hazard
• Control hazard
• Pipeline summary
Pipelining and ISA Design
– Load/store addressing
• Can calculate address in 3rd stage, access memory
in 4th stage
– Alignment of memory operands
• Memory access takes only one cycle
Pipeline Hazards
I n s tr u c tio n D a ta
ld x9 , 4 0 0 ( x22 ) R eg AL U R eg
2 ns f e tc h acces s
2 ns 2 ns 2 ns 2 ns 2 ns
• Reordered code:
ld x6, 0(x22)
ld x8, 4(x22)
sd x9, 4(x22)
sd x8, 0(x22) Interchanged
Control Hazards
Prediction
correct
Prediction
incorrect
More-Realistic Branch Prediction
• Static branch prediction
– Based on typical branch behavior
– Example: loop and if-statement branches
• Predict backward branches taken
• Predict forward branches not taken
• Dynamic branch prediction
– Hardware measures actual branch behavior
• e.g., record recent history of each branch
– Assume future behavior will continue the trend
• When wrong, stall while re-fetching, and update history
Pipeline Summary
The BIG Picture