Professional Documents
Culture Documents
Introduction-
1. Non-Pipelined Execution
2. Pipelined Execution
1. Non-Pipelined Execution-
In non-pipelined architecture,
● All the instructions of a program are executed sequentially one after the other.
● A new instruction executes only after the previous instruction has executed
completely.
● This style of executing the instructions is highly inefficient.
Example-
Consider a program consisting of three instructions.
In a non-pipelined architecture, these instructions execute one after the other as-
2. Pipelined Execution-
In pipelined architecture,
What is Pipelining?
Pipelining is the process of accumulating instruction from the
processor through a pipeline. It allows storing and executing
instructions in an orderly process. It is also known as pipeline
processing.
● Memory Organization
● Volatile Memory: This loses its data, when power is switched off.
● Non-Volatile Memory: This is a permanent storage and does not
lose any data when power is switched off.
Memory Hierarchy
Hit Ratio
● FIFO - First in First out. Oldest item is replaced with the latest
item.
● LRU - Least Recently Used. Item which is least recently used by
CPU is removed.
Virtual Memory
1. SISD
2. SIMD
3. MISD
4. MIMD
They are highly specialized computers. They are basically used for
numerical problems that are expressed in the form of vector or matrix.
But they are not suitable for other types of computations
Types of Pipeline
1. Arithmetic Pipeline
2. Instruction Pipeline
3. Processor Pipelining
4. Unifunction Vs. Multifunction Pipelining
5. Static vs Dynamic Pipelining
6. . Scalar vs Vector Pipelining
Arithmetic Pipeline
Arithmetic pipelines are usually found in most of the computers. They
are used for floating point operations, multiplication of fixed point
numbers etc. For example: The input to the Floating Point Adder
pipeline is:
X = A*2^a
Y = B*2^b
Registers are used for storing the intermediate results between the
above operations.
Instruction Pipeline
3. Processor Pipelining
Here, 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.
The static pipeline performs a fixed-function each time. The static pipeline is
unifunctional. The static pipeline executes the same type of instructions
continuously. Frequent change in the type of instruction may vary the
performance of the pipelining.
Scalar pipelining processes the instructions with scalar operands. The vector
pipeline processes the instruction with vector operands.
Pipeline Conflicts
There are some factors that cause the pipeline to deviate its normal
performance. Some of these factors are given below:
1. Timing Variations
All stages cannot take same amount of time. This problem generally
occurs in instruction processing where different instructions have
different operand requirements and thus different processing time.
2. Data Hazards
3. Branching
In order to fetch and execute the next instruction, we must know what
that instruction is. If the present instruction is a conditional branch,
and its result will lead us to the next instruction, then the next
instruction may not be known until the current one is processed.
4. Interrupts
5. Data Dependency
Pipelining Hazards
Whenever a pipeline has to stall due to some reason it is called pipeline
hazards. Below we have discussed four pipelining hazards.
1. Data Dependency
But the Sub instruction need the value of the register R2 at the cycle t3. So
the Sub instruction has to stall two clock cycles. If it doesn’t stall it will
generate an incorrect result. Thus depending of one instruction on other
instruction for data is data dependency.
2. Memory Delay
3. Branch Delay
Suppose the four instructions are pipelined I1, I2, I3, I4 in a sequence. The
instruction I1 is a branch instruction and its target instruction is Ik. Now,
processing starts and instruction I1 is fetched, decoded and the target address
is computed at the 4th stage in cycle t3.
But till then the instructions I2, I3, I4 are fetched in cycle 1, 2 & 3 before the
target branch address is computed. As I1 is found to be a branch instruction,
the instructions I2, I3, I4 has to be discarded because the instruction Ik has to
be processed next to I1. So, this delay of three cycles 1, 2, 3 is a branch
delay.
Prefetching the target branch address will reduce the branch delay. Like if the
target branch is identified at the decode stage then the branch delay will
reduce to 1 clock cycle.
4. Resource Limitation
If the two instructions request for accessing the same resource in the same
clock cycle, then one of the instruction has to stall and let the other instruction
to use the resource. This stalling is due to resource limitation. However, it
can be prevented by adding more hardware.
Advantages of Pipelining
● Instruction throughput increases.
● Increase in the number of pipeline stages increases the number of
instructions executed simultaneously.
● Faster ALU can be designed when pipelining is used.
● Pipelined CPU’s works at higher clock frequencies than the RAM.
● Pipelining increases the overall performance of the CPU.
Disadvantages of Pipelining
● Designing of the pipelined processor is complex.
● Instruction latency increases in pipelined processors.
● The throughput of a pipelined processor is difficult to predict.
● The longer the pipeline, worse the problem of hazard for branch
instructions.
Key Takeaways
● Pipelining divides the instruction in 5 stages instruction fetch, instruction
decode, operand fetch, instruction execution and operand store.
● The pipeline allows the execution of multiple instructions concurrently
with the limitation that no two instructions would be executed at the
same stage in the same clock cycle.
● All the stages must process at equal speed else the slowest stage
would become the bottleneck.
● Whenever a pipeline has to stall for any reason it is a pipeline hazard.
This is all about pipelining. So, basically the pipelining is used to improve the
performance of the system by improving its efficiency.