Pipeline Part 2
Pipeline Part 2
Pipeline Part 2
Arithmetic pipeline
An arithmetic pipeline generally breaks an arithmetic operation into multiple
arithmetic steps.
So in arithmetic pipeline, an arithmetic operation like multiplication, addition,
etc. can be divided into series of steps that can be executed one by one in
stages in Arithmetic Logic Unit (ALU).
Processor pipeline
In processor pipeline processing of the same data stream is done by a cascade
of processors.
In this each cascade of processor is assigned and process a specific task.
The processors are pipelined to process the same data stream. The data stream
is processed by the first processor and the result is stored in the memory block.
The result in the memory block is accessed by the second processor. The second
processor reprocesses the result obtained by the first processor and the passes
the refined result to the third processor and so on.
Instruction pipeline
In instruction pipeline processor, the execution of a stream of instructions can
be pipelined by overlapping the execution of the current instruction with the
fetch, decode and operand fetch of subsequent instructions.
Suppose that we have 4 resources and 6 time-slices and the usage of resources is
as follows :
Often to make the table look simpler, the 0 entries are represented by blank and
1 entries are represented by a 'X'. We have followed this second approach when
we display the reservation table. The above table will look now like
The reservation table A reservation table is a very useful tool for analyzing
pipelines.
This would indicate that there are no collisions in the pipeline, and that we
could initiate a new instruction every clock periods.
Structural Hazards
• Suppose the IF (instruction fetch) stage and the OF (operand fetch) stages
both need to access main memory for their data.
• Suppose we only have one data path to main memory.
• We will not be able to execute an IF and an OF at the same time.
Time
t1 t2 t3 t4 t5 t6 t7 t8
I1 IF ID OF EX WB
I2 IF ID OF EX WB
I3 IF ID OF EX WB
Time
t1 t2 t3 t4 t5 t6 t7 t8
I1 IF ID OF EX WB
I2 IF ID OF EX WB
I3 -- IF ID OF EX WB
• In this case, stalling for one stage results in another conflict so we must stall
for two stages.
Time
t1 t2 t3 t4 t5 t6 t7 t8
I1 IF ID OF EX WB
I2 IF ID OF EX WB
I3 -- -- IF ID OF EX
Data Hazards
Consider the following 2-instruction code using our 5 stage pipeline:
I1: R3 := R1 + R2
I2: R4 := R3 + 10
Time
t1 t2 t3 t4 t5 t6 t7 t8
I1 IF ID OF EX WB
I2 IF ID OF EX WB
Instruction i has to modify register r1 first, and then j has to modify it.
Otherwise, there is a WAW hazard. There is a problem because of R1. If some
other register had been used, there will not be a problem
Solution is register renaming, that is, use some other register. The hardware
can do the renaming or the compiler can do the renaming