




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















Chapter 6.1 - Pipelining
Moore’s Law says that the number of processors on a chip doublesabout every 18 months.Given the data on the following two slides, is this true?
docsity.com
Chapter 6.1 - Pipelining
Chapter 6.1 - Pipelining
docsity.com
Chapter 6.1 - Pipelining
docsity.com
Chapter 6.1 - Pipelining
-^ Laundry Example •^ Ann, Brian, Cathy, Daveeach have one load of clothesto wash, dry, and fold •^ Washer takes 30 minutes •^ Dryer takes 40 minutes •^ “Folder” takes 20 minutes
docsity.com
Chapter 6.1 - Pipelining
docsity.com
Chapter 6.1 - Pipelining
-^ Pipelining doesn’t helplatency of single task, it helpsthroughput of entire workload •^ Pipeline rate limited byslowest pipeline stage •^ Multiple tasks operatingsimultaneously usingdifferent resources •^ Potential speedup = Numberpipe stages •^ Unbalanced lengths of pipestages reduces speedup •^ Time to “fill” pipeline andtime to “drain” it reducesspeedup •^ Stall for Dependences
docsity.com
Chapter 6.1 - Pipelining
Cycle 1^
Cycle 2^
Cycle 3^
Cycle 4^
Cycle 5
Ifetch^
Reg/Dec^
Exec^
Mem^
Wr
docsity.com
Chapter 6.1 - Pipelining
-^ Single-Cycle Datapath; Colored lines show flow of data backwards. •^ What do we need to add to split the datapath into stages? (^4) Address^ Instruction^ memory
32
AddAdd resultShift left 2 0
0 M^ u^ x 1 Add Instruction PC
0 Write data
1 M^ u^ x
Read register 1Read^ data 1Read register 2RegistersReadWrite^ data 2 registerWrite data^16 Sign^ extend
Read^ data AddressData^ memory ZeroALUALU resultM u x 1
IF: Instruction fetch
ID: Instruction decode/^ register file read
EX: Execute/ address calculation
MEM: Memory access
WB: Write back
docsity.com
Chapter 6.1 - Pipelining
-^ Pipeline registers (colored), separate the datapath stages. •^ Must be wide enough to store data, control and conditions as they flowdownstream.
(^4) Address^ Instruction^ memory
32
AddAdd resultShift left 2 0
IF/ID^ Instruction
EX/MEM^
MEM/WB
0 M^ u^ x 1 Add PC
0 Write data
1 M^ u^ x
Read register 1Read^ data 1Read register 2RegistersReadWrite^ data 2^ registerWrite^ data^16 Sign^ extend
Read^ data
ID/EX ZeroALUALU^ resultM^ u^ x^1
AddressData^ memory
docsity.com
Chapter 6.1 - Pipelining
-^ Yes: Pipeline Hazards^ – structural hazards: attempt to use the same resource two different waysat the same time -^ e.g.
, combined washer/dryer would be a structural hazard or folderbusy doing something else (watching TV)
e.g. , washing football uniforms and need to get proper detergentlevel; need to see after dryer before next load in• branch instructions
e.g. , one sock of pair in dryer and one in washer; can’t fold until getsock from washer through dryer• instruction depends on result of prior instruction still in the pipeline
-^ Can always resolve hazards by waiting^ – pipeline control must detect the hazard– take action (or delay action) to resolve hazards
docsity.com
Chapter 6.1 - Pipelining
Mem
Mem^ Reg
Mem^
Reg ALU Mem^ Reg
Mem^
Reg ALU Mem^ Reg
Mem^
Reg ALU Reg^
Mem^
Reg ALU Mem^ Reg
Mem^
Reg
docsity.com
Chapter 6.1 - Pipelining
-^ Stall: wait until decision is clear (conditionalbranching). •^ Impact
: 2 lost cycles (
i.e. , 3 clock cycles per branch
Mem^ Reg
Mem^
Reg ALU Mem^ Reg
Mem^
Reg
Reg^
Mem^
Reg
Mem
docsity.com
Chapter 6.1 - Pipelining
-^ Predict: guess one direction then back up if wrong •^ Impact: 0 lost cycles per branch instruction if right, 1 if wrong(right 50% of time)^ – Need to “Squash” and restart following instruction if wrong– Produce CPI on branch of (
^ .5 + 2
^ .5) = 1.
^ .2 + 1
^ .8 = 1.1 (20% branch)
Mem^ Reg
Mem^
Reg ALU Mem^ Reg
Mem^
Reg Mem
Reg^
Mem^
Reg
docsity.com