V-Unit Co
V-Unit Co
V-Unit Co
UNIT-V
Pipelining: Basic Concepts
Pipelining is a technique for breaking down a sequential process into various sub-
operations and executing each sub-operation in its own dedicated segment that runs in
parallel with all other segments.
The most signi icant feature of a pipeline technique is that it allows several
computations to run in parallel in different parts at the same time.
By associating a register with every segment in the pipeline, the process of
computation can be made overlapping. The registers provide separation and isolation
among every segment, allowing each to work on different data at the same time.
An input register for each segment, followed by a combinational circuit, can be
used to illustrate the structure of a pipeline organisation. To better understand the
pipeline organisation, consider an example of a combined multiplication and addition
operation.
A stream of numbers is used to perform the combined multiplication and addition
operation, such as:
for i = 1, 2, 3, ……., 7
Ai* Bi + Ci
The operation to be done on the numbers is broken down into sub-operations, each of
which is implemented in a segment of a pipeline. We can de ine the sub-operations
performed in every segment of the pipeline as:
Input Ai, and Bi
R1 ← Ai, R2 ← Bi
Multiply, and input Ci
R3 ← R1 * R2, R4 ← Ci
Add Ci to the product
R5 ← R3 + R4
The combined and sub-operations conducted in each leg of the pipeline are depicted in
the block diagram below:
VSREDDY
2
R1, R2, R3, and R4 Registers hold the data. The combinational circuits then operate in a
certain segment.
The output of a given segment’s combinational circuit is used as an input register for the
next segment. The register R3 is used here as one of the input registers for a
combinational adder circuit, as shown in the block diagram.
the pipeline organization is applicable for two areas of computer design which includes:
1. Arithmetic Pipeline
2. Instruction Pipeline
Arithmetic Pipeline
Arithmetic Pipelines are mostly used in high-speed computers. They are used to
implement loating-point operations, multiplication of ixed-point numbers, and similar
computations encountered in scienti ic problems.
To understand the concepts of arithmetic pipeline in a more convenient way, let us
consider an example of a pipeline unit for loating-point addition and subtraction.
The inputs to the loating-point adder pipeline are two normalized loating-point binary
numbers de ined as:
X = A * 2a = 0.9504 * 103
Y = B * 2b = 0.8200 * 102
Where A and B are two fractions that represent the mantissa and a and b are the
exponents.
The combined operation of loating-point addition and subtraction is divided into four
segments. Each segment contains the corresponding suboperation to be performed in the
given pipeline. The suboperations that are shown in the four segments are:
The following block diagram represents the suboperations performed in each segment of
the pipeline.
VSREDDY
3
Instruction Pipeline
Pipeline processing can occur not only in the data stream but in the instruction stream
as well. Most of the digital computers with complex instructions require instruction
pipeline to carry out operations like fetch, decode and execute instructions.
In general, the computer needs to process each instruction with the following sequence
of steps.
1. Fetch instruction from memory.
VSREDDY
4
A four-segment instruction pipeline combines two or more different segments and makes
it as a single one. For instance, the decoding of the instruction can be combined with the
calculation of the effective address into one segment.
Segment 1:
The instruction fetch segment can be implemented using irst in, irst out (FIFO) buffer.
Segment 2:
The instruction fetched from memory is decoded in the second segment, and eventually,
the effective address is calculated in a separate arithmetic circuit.
Segment 3:
An operand from memory is fetched in the third segment.
Segment 4:
VSREDDY
5
The instructions are inally executed in the last segment of the pipeline organization.
Instruction hazards
Instruction hazards are a type of hazard that can occur in pipelined computer
architectures. These hazards arise when instructions are not executed in the correct order
or when the pipeline stages are not utilized ef iciently. In this essay, we will explore the
basics of instructional hazards, how they arise, and techniques used to mitigate them.
What are Instructional Hazards?
Instructional hazards are a type of hazard that occurs when instructions in a
pipelined architecture are not executed in the correct order. In a pipelined architecture,
instructions are broken down into several stages, and each stage of the pipeline is
responsible for a particular operation. These stages operate on different instructions in a
pipelined manner, such that one instruction is being executed while another instruction
is being fetched and decoded.
However, when instructions depend on the results of previous instructions,
instructional hazards can occur. For example, if instruction A and instruction B both
require the same pipeline stage to execute, then these instructions may need to be
executed in the correct order. If instruction B is executed before instruction A completes,
then the results of instruction A may not be available to instruction B.
Types of Instructional Hazards.
There are three types of instructional hazards that can occur in pipelined computer
architectures. These are:
1. Structural Hazards: Structural hazards occur when multiple instructions
require the same hardware resource. For example, if two instructions require the same
arithmetic logic unit (ALU), then only one instruction can be executed at a time. This can
lead to delays and decreased ef iciency in the pipeline.
2. Control Hazards: Control hazards occur when the pipeline is unable to predict
the outcome of a branch instruction. In this case, the pipeline may continue to execute
instructions that depend on the outcome of the branch instruction, even though the
branch instruction has not yet been resolved. This can lead to incorrect results and wasted
processing time.
3. Data Hazards: Data hazards, as discussed in the previous essay, occur when
instructions depend on the results of previous instructions. Data hazards can lead to
incorrect results and must be mitigated.
VSREDDY
6
Data hazards
Data hazards refer to a type of hazard that occurs in pipelined computer architectures.
These hazards arise when instructions that depend on the data produced by previous
instructions are not executed in the correct order. In this essay, we will explore the
basics of data hazards, how they arise, and techniques used to mitigate them.
What are Data Hazards?
Data hazards are a type of hazard that occurs when instructions in a pipelined
architecture require data produced by previous instructions. In a pipelined architecture,
instructions are broken down into several stages, and each stage of the pipeline is
responsible for a particular operation. These stages operate on different instructions in
a pipelined manner, such that one instruction is being executed while another
instruction is being fetched and decoded.
However, when instructions depend on the results of previous instructions, data hazards
can occur. For example, if instruction A is responsible for writing data to a register, and
instruction B is responsible for reading data from the same register, then instruction B
must wait for instruction A to complete before it can execute. If instruction B is executed
before instruction A completes, then the data read by instruction B may be incorrect.
Types of Data Hazards There are three types of data hazards that can occur in pipelined
computer architectures.
These are:
1. Read-After-Write (RAW) Hazards: RAW hazards occur when an instruction reads
data from a register that has not yet been written by a previous instruction. In this case,
the previous instruction must be completed before the instruction that reads the data
can execute.
2. Write-After-Read (WAR) Hazards: WAR hazards occur when an instruction writes
data to a register that has been read by a previous instruction. In this case, the previous
instruction must be completed before the instruction that writes the data can execute.
3. Write-After-Write (WAW) Hazards: WAW hazards occur when two instructions
attempt to write data to the same register. In this case, the second instruction must wait
for the irst instruction to complete before it can execute
VSREDDY
7
Influence on Instruction Sets: Some instructions are much better suited to pipelined
execution than other instructions. For example, instruction side effects can lead to
undesirable data dependencies. The machine instructions are influenced by addressing
modes and condition code flags.
• Addressing modes: Addressing modes should provide the means for accessing a
variety of data structures simply and efficiently. Useful addressing modes include
index, indirect, autoincrement, and autodecrement. Many processors provide
various combinations of these modes to increase the flexibility of their instruction
sets. Complex addressing modes, such as those involving double indexing, are
often encountered.
Two important considerations in this regard are the side effects of addressing
modes such as autoincrement and autodecrement and the extent to which
complex addressing modes cause the pipeline to stall. Another important factor is
whether a given mode is likely to be used by compilers.
• Condition modes
In many processors, the condition code flags are stored in the processor status
register. They are either set or cleared by many instructions, so that they can be
tested by subsequent conditional branch instructions to change the flow of
program execution. An optimizing compiler for a pipelined processor attempts to
reorder instructions to avoid stalling the pipeline when branches or data
dependencies between successive instructions occur. In doing so, the compiler
must ensure that reordering does not cause a change in the outcome of a
computation. The dependency introduced by the condition-code flags reduces the
flexibility available for the compiler to reorder instructions.
VSREDDY
8
2. The second approach is to con igure a system that contains a large number of
conventional processors. The individual processors do not have to be complex,
high-performance units. They can be standard microprocessors. The system
derives its high performance form the fact that many computations can proceed in
parallel.
VSREDDY
9
stream. This is the simplest type of computer architecture and is used in most
traditional computers.
VSREDDY
10
Array Processors
A processor that performs computations on a vast array of data is known as an array
processor. Multiprocessors and vector processors are other terms for array processors. It
only executes one instruction at a time on an array of data. They work with massive data
sets to perform computations. Hence, they are used to enhance the computer's
performance.
Classi ication of Array Processors
VSREDDY
11
This processor includes a master control unit and main memory. The master
control unit in the processor controls the operation of the processing elements. And also,
decodes the instruction & determines how the instruction is executed. So, if the
instruction is program control or scalar then it is executed directly in the master control
unit. Main memory is mainly used to store the program while every processing unit uses
operands that are stored in its local memory.
Advantages
The advantages of an array processor include the following.
VSREDDY
12
Multiprocessor
• A multiprocessor system is an interconnection of two or more CPU’s with
memory and input-output equipment.
VSREDDY
13
Characteristics of Multiprocessors:
o Symmetric shared memory: It introduces multiprocessor architecture
and shared memory machine design options. It explains the cache
coherence problem and the solutions that are accessible. It also contains
information on snooping protocols.
o Memory consistency models: It presents the memory consistency idea
and the sequential consistency paradigm. More lenient consistency models,
VSREDDY
14
VSREDDY
15
VSREDDY
16
Crossbar Switch
o Consists of a number of crosspoints that are placed at intersections between
processor buses and memory module paths.
o The small square in each crosspoint is a switch that determines the path from
a processor to a memory module.
o Adv.:
Supports simultaneous transfers from all memory modules
o Disadv.:
The hardware required to implement the switch can become quite
large and complex.
Below ig. shows the functional design of a crossbar switch
connected to one memory module.
VSREDDY
17
Crossbar switch
Important Questions
Small questions
1. Explain Arithmetic Pipeline.
2. Explain stages for Instruction Pipeline.
3. Explain Data hard.
4. Explain Instruction Hazard.
5. Explain Large Computer Systems.
6. Explain Attached Array Processor
7. Explain SIMD Array Processor
Large Questions
1. Explain Basic Pipeline Concept in Computer Organization.
2. Explain Hazards in pipeline.
3. What is Parallel processing? Explain forms of parallel processing.
4. Explain Array Processors in computer organization.
5. De ine the structure of general-purpose multiprocessors.
6. Explain interconnection structures.
Assignment questions
Small questions
1. Explain Arithmetic Pipeline.
2. Explain stages for Instruction Pipeline.
3. Explain Data hard.
VSREDDY
18
VSREDDY