Pipelining Concepts and Problems
Pipelining Concepts and Problems
Overview
Why Pipelining?
▪ Speed of execution of programs is influenced by many factors
▪ To improve performance – faster circuit technology to build processor and main memory
– Arrange the hardware so that more than one operation can be
performed at the same time
Pipelining is an implementation technique in which multiple instructions are overlapped in execution
• Pipelining is widely used in modern processors.
• Pipelining improves system performance in terms of throughput.
• Pipelined organization requires sophisticated compilation techniques.
Making the Execution of Programs Faster
• Use faster circuit technology to build the processor and the main memory.
• Arrange the hardware so that more than one operation can be performed at the same time.
• In the latter way, the number of operations performed per second is increased even though the
elapsed time needed to perform any one operation is not changed.
Use the Idea of Pipelining in a Computer
Fetch + Execution
F : Fetch
E : Execute T ime
I1 I2 I3
T ime
Clock cycle 1 2 3 4
F E F E F E
1 1 2 2 3 3 Instruction
I1 F1 E 1
(a) Sequential execution
I2 F2 E 2
Interstage buffer
B1
I3 F3 E 3
Instruction Ex ecution
fetch unit (c) Pipelined execution
unit
Instruction
I1 F1 D1 E1 W1
I2 F2 D2 E2 W2
I3 F3 D3 E3 W3
I4 F4 D4 E4 W4
Interstageuff
b ers
D : Decode
F : Fetch instruction E: Execute W : Write
instruction and f etch operation results
operands
B1 B2 B3
Fetch + Decode
+ Execution + Write
Instruction
I1 F1 D1 E1 W1
Pipeline Performance
I2 F2 D2 E2 W2
I3 F3 D3 E3 W3
I4 F4 D4 E4 W4
I5 F5 D5 E5
• The previous pipeline is said to have been stalled for two clock cycles.
• Any condition that causes a pipeline to stall is called a hazard.
• Data hazard – any condition in which either the source or the destination operands of an
instruction are not available at the time expected in the pipeline. So some operation has to
be delayed, and the pipeline stalls.
• Instruction (control) hazard – a delay in the availability of an instruction causes the pipeline
to stall.
• Structural hazard – the situation when two instructions require the use of a given hardware
resource at the same time.
Pipeline Performance
• Four instructions, the I2 takes two clock cycles for execution. Pls draw the figure for 4-stage
pipeline, and figure out the total cycles needed for the four instructions to complete.
Pipelining Problems
Pipeline Parameters
• Twp = n. 𝑘.tc n-No. of instruction, k - No of Pipeline stages
• Tp = ( n+ 𝑘 -1) tc
• η= n
( n+𝑘−1)
• S= 𝑘.η
Question 1