Session6-Pipelining approach
Session6-Pipelining approach
6.2 INTRODUCTION
So far, you have came across with lots of the interesting topics of
computer organization like addressing modes, instruction formats, ALU
and CU organizations etc. Whatever you have learnt from the previous
units - the main objective in the mind of the researchers is to design
a computer system with highest performance by using those tech-
niques. In this unit, we will discuss one of the most important tech-
nique called pipelining, which is used in the modern computers to
achieve extreme performance.
Now let us see, how the idea of pipelining can be used in computers.
We know that the processor executes a program by fetching and
executing instructions, one after the other. In the following figure, shows
two hardware unit of a processor, one for fetching the instructions and
the other for executing instructions. The intermediate storage buffer B1
stores the instruction fetched by the fetch unit. This buffer is needed
to enable the execution unit to execute the instruction while the fetch
unit is fetching the next instruction. Thus, with pipelining, the computer
architecture allows the next instructions to be fetched while the pro-
cessor is performing execution of the first instruction, holding them in
a buffer close to the processor until each instruction operation can be
performed.
Instruction Execution
fetch unit unit
But what will happen without pipelining ? Without a pipeline, a com- NOTE
puter processor gets the first instruction from memory, performs the
operation it calls for, and then goes to get the next instruction from The IBM 7030, also
memory, and so forth. While fetching (getting) a instruction, the execut- known as Stretch,
ing part of the processor will remain idle. It must wait until it gets the was IBM’s f i rst
next instruction. Thus, it results slower in execution because less transistorized super-
number of instructions will be executed during a given time slot. com puter in 1961.
Ori ginal pri ced was
Thus, the Pipelining is used to obtain improvements in processing time
$13.5 mill ion. Ev en
that would be unobtainable with existing non-pipelined technology. The
though the 7030 was
IBM 7030 (the Stretch Computer) had attained its over-all peprformance
much slower t han
of 100 times by using the pipelining technique, whereas circuit im-
expected, it was the
provements would only give a factor-of-10 improvement. This goal could
fastest computer in the
only be met with overlapping instructions, i.e. pipelining.
world from 1961 until the
John Hayes provides a definition of a pipeline as it applies to a computer first CDC 6600 became
processor. operational in 1964.
Clock cycle 1 2 3 4
Instruction
I1 F1 E1
F2 E2
I2
F3 E3
I3
Thus, the above fetch and execute unit constitute a two stage pipeline.
Both the fetch and execute units are kept busy all the time after each
clock pulse and also new information is loaded into the buffer after
each clock pulse.
So, it will need four different hardware units as shown in Fig 5.3 for
performing each of these steps simultaneously and without interfering
with one another (because for two steps we get two hardware unit as
shown in the fig. 6.1).
B1 B2 B3
Fig. 8.3 Hardware units need for Instruction Processing
Time
Clock cycle 1 2 3 4 5 6 7
Instruction
I1 F1 D1 E1 W1
F2 D2 E2 W2
I2
F3 D3 E3 W3
I3
F4 D4 E4 W4
I4
Information is passed from one unit to the next unit through a storage
buffer. The information in the buffers at the clock pulse 4 is given in
the following table :
Buffers Contents
Time
Clock cycle 1 2 3 4 5 6 7 8 9
Instruction
I1 F1 D1 E1 W1
I2
F2 D2 E2 W2
I3 F3 D3 E3 W3
I4
F4 D4 E4 W4
I5 F5 D5 E5
Fig. 6.5 Execution stage taking more than one clock cycle
Thus, the normal pipeline operation interrupted for two clock cycle,
which is called stalled. In stalled situation, the normal pipeline opera-
tion halt for more than one clock cycle. In the figure, we see that,
pipeline functioning resumes normally from the clock cycle 7.
Pipeline hazards are situations that prevent the next instruction in the
instruction stream from executing during its assigned clock cycle. Then,
the instruction is said to be stalled. When an instruction is stalled, all
instructions later in the pipeline than the stalled instruction are also
stalled. Instructions earlier than the stalled one can continue. No new
instructions are fetched during the stall. This condition is clearly
illustrated in the Fig. 5.5. Thus, the hazards reduces the performance
gained by pipelining.
a) Structural hazards
b) Data hazards
c) Control hazards
a) Structural hazards :
b) Data hazards :
Data hazard arises when the output of one instruction is fed to the
input of the next instruction. A data hazard is any condition in which
either the source or the destination operands of an instruction are
not available at the time expected in the pipeline. As a result, some
operation has to be delayed, and the pipeline stalls. We have already
discussed a situation (in Fig. 6.5) where the normal pipeline operations
were halted for two clock cycle. That was happened due to the data
hazards only.
c) Control hazards :
Clock cycle 1 2 3 4 5 6 7 8 9
Instruction
I1 F1 D1 E1 W1
I2 F2 D2 E2 W2
I3 F3 D3 E3 W3
Pipelining does not help in all cases. There are several possible
disadvantages. An instruction pipeline is said to be fully pipelined if it
can accept a new instruction at every clock cycle. A pipeline that is not
fully pipelined has wait cycles that delay the progress of the pipeline.
Advantages of Pipelining:
Disadvantages of Pipelining:
LET US KNOW