Download presentation
Presentation is loading. Please wait.
Published byAbraham Miles Modified over 9 years ago
1
Pipelining Enhancing Performance
2
Datapath as Designed in Ch. 5 Consider execution of: lw $t1,100($t0) lw $t2,200($t0) lw $t3,300($t0) Datapath segments 5 segments Instruction Fetch (IF) Register Read (ID) ALU Operation (EX) Data Access (MEM) Register Write (WB)
3
Timing Timing for each segment Note ms 10 -3, s 10 -6 (micro), ns 10 -9, ps 10 -12 Instruction ClassIFIDEXMEMWBTotal load word (lw)200ps100ps200ps 100ps800ps store word (sw)200ps100ps200ps 700ps R-Format200ps100ps200ps100ps600ps Branch200ps100ps200ps500ps
4
Sequential Instruction Execution Clock Cycle must be 800 ps (lw) Sequential Execution
5
Pipelined Execution Use separate segments on different instructions Each stage will take 200 ps
6
Analysis Non-pipelined desing 3 x 800 ps = 2400 ps Pipelined design 2 x 200 ps = 600 ps Timing Time non-pipelined Time pipelined = -------------------- Num. segments Expected speedup is: 5 Actual speedup is (5 ins): 4000/1800 = 2.22 Will not get theoretical value because of a variety of imperfect use of pipeline (see previous diagram)
7
Pipeline Hazards Hazards are events that prevent the next instruction from being executed in the next clock cycle. Three types Structural hazards Data hazards Control hazards
8
Structural Hazard Hardware cannot support the combination of instructions What if we had single memory? Every instruction fetch must read memory Some instructions must write to memory Cannot fetch one instruction from memory while another is trying to use the memory
9
Data Hazards Consider: add $s0,$t0,$t1 sub $t2,$s0,$t3 Solution: Forwarding (bypassing)
10
Data Hazards (2) Pipeline stall Rearranging instructions is one solution Rearranging not always possible More complex solutions are often needed
11
Control Hazards Need to make decision in one instruction based upon execution of another instruction. Consider: add $t4,$t5,$t6 beq $t1,$t2,40 other instructions including branch target Two sloutions Stall Predict
12
Stall on Branch
13
Predict on Branch Predict Branch Not Taken
14
The Pipelined Datapath
15
A Word On Control Two approaches to control Finite state machine Microprogramming Finite state machine Hardwired Complex controller is expensive to implement Microprogramming Break instruction down into micro-instructions Micro-instruction tells how to set control lines
16
IA-32 Architecture Complex instruction set Simple instructions require 3 or 4 clock cycles Complex instructions requiring 100s clock cycles Control for simple instructions is hardwired Control for complex instructions uses microprogramming All instructions are translated into a series of RISC like micro-instructions Micro-instructions are queued and executed
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.