Professional Documents
Culture Documents
An Introductory Analysis of Pipelines: I I I I I Clock Cycles Æ
An Introductory Analysis of Pipelines: I I I I I Clock Cycles Æ
Discussion-03
ID
EX
WB
stages
A time-space diagram is used to describe the progress of instructions through the pipeline.
WB
M
EX
ID
IF
I1
1
I1
I2
2
I1 I2 I3
I1 I2 I3 I4
I1 I2 I3 I4 I5
I2 I3 I4 I5 I6
I3 I4 I5 I6 I7
3
4
5
6
7
Clock Cycles
(Pipelined Execution)
I4
I5
I6
I7
I8
8
I5
I6
I7
I8
I9
9
I6
I7
I8
I9
I10
10
Weve assumed that every stage takes one clock cycle and there are no hazards in the instruction stream.
Instruction Latency (the time it takes to complete an instruction) = 5 cycles
Instruction Throughput = 6/10 IPC = 0.6 IPC
In order to gain better appreciation of pipelined execution, we draw time-space diagram for non-pipelined
execution as shown below:
WB
M
EX
ID
IF
I2
I1
I1
I2
I1
I1
I1
1
I2
I2
I2
4
5
6
7
8
Clock Cycles
(Non-Pipelined Execution)
3
10
----------(1)
S=
=
nk
(k 1 + n )
nk
=
(3)
k 1+ n
=
Clearly, for a given pipeline, greater speedup is achieved, as more and more instructions are executed. We can
compute the upper bound on speedup as follows:
Lim
S ideal = n
k
k 1
+1
n
=k
We regard it as ideal speedup because its derivation is based on the assumption of no pipeline hazards. As can be
seen, even ideal speedup cannot go beyond pipeline depth (i.e. number of pipeline stages).
Instruction Throughput
Instruction throughput is defined as the number of instructions executed per unit time. This is calculated as:
=
(k 1 + n )
(4)
Multiplying numerator and denominator of (4) by k, we can express in terms of speedup S as:
=
S
k
1
k
+ 1
= 1/
CPI
Cycles per instruction (CPI) of pipelined execution can be found as:
CPI =
(k 1 + n )
n
k 1
=
+1
n
=1
******
Page - 2 - of 2