Unit 5
Unit 5
Processor Organization
Unit 5. Processor Organization
• Instruction Cycle- The indirect cycle and Data flow.
• Instruction Pipelining- Pipelining Strategy, pipeline
performance, pipeline hazards, dealing with branches,
• Case Study- Intel 586 pipelining.
• Instruction level parallelism and superscalar processors-
Super scalar verses super pipelined, constraints,
• Design Issues instruction level and machine parallelism,
• Instruction issue policy, register renaming, machine
parallelism, branch prediction, superscalar execution &
implementation.
• Case Study- Pentium 4
11/08/2024 05:12 PM 2
Instruction Cycle
A program that exists inside a computer's
memory
performed.
memory.
system bus. : It is connected to the system bus Data Lines. It holds the
memory value to be stored, or the last value read from the memory.
fetched.
Instruction Cycle State Diagram
Fetch cycle
The address of the next instruction to execute is in the Program Counter(PC) at the
Step 1: The address in the program counter is transferred to the Memory Address
Register(MAR), as this is the only register that is connected to the system bus
address lines.
Step 2: The address in MAR is put on the address bus, now a Read order is
provided by the control unit on the control bus, and the result appears on the data
bus and is then copied into the memory buffer register. Program counter is
incremented by one, to get ready for the next instruction. These two acts can be
Indirect addressing (it can be obtained by any addressing mode, here it is done
process to store the result in main memory. Micro operations take place:
Step 1: The instruction address field is passed to the MAR. This is used to
Step 1: The address field of the instruction is transferred to the MAR. This is used to fetch the
Step 2: The address field of the IR is updated from the MBR.(So that it now contains a direct
Step 3: The IR is now in the state, as if indirect addressing has not been occurred. Note: Now
Advantages of instruction cycle
• Standardization: The instruction cycle provides a standard way for CPUs to execute
instructions, which allows software developers to write programs that can run on
multiple CPU architectures. This standardization also makes it easier for hardware
• Efficiency: By breaking down the instruction execution into multiple steps, the CPU
can execute instructions more efficiently. For example, while the CPU is performing
the execute cycle for one instruction, it can simultaneously fetch the next instruction.
• Pipelining: The instruction cycle can be pipelined, which means that multiple
instructions can be in different stages of execution at the same time. This improves
simultaneously.
Disadvantages of instruction cycle
• Overhead: The instruction cycle adds overhead to the execution of instructions, as
each instruction must go through multiple stages before it can be executed. This
• Complexity: The instruction cycle can be complex to implement, especially if the CPU
architecture and instruction set are complex. This complexity can make it difficult to
• Limited parallelism: While pipelining can improve the performance of the CPU, it
also has limitations. For example, some instructions may depend on the results of
previous instructions, which limits the amount of parallelism that can be achieved. This
can reduce the effectiveness of pipelining and limit the overall performance of the
CPU.
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.
• Pipelining is a technique where multiple instructions are
overlapped during execution.
• Pipeline is divided into stages and these stages are
connected with one another to form a pipe like structure.
• Instructions enter from one end and exit from another
end.
11/08/2024 05:12 PM 17
Pipelining
• Pipeline is divided into stages and these stages
are connected with one another to form a
pipe like structure.
• In a pipeline system, each stage/segment
consists of an input register followed by a
combinational circuit.
• The register is used to hold data and
combinational circuit perform operation on it.
11/08/2024 05:12 PM 18
Pipelining
11/08/2024 05:12 PM 19
Pipelining :Types
• It is divided into 2 categories:
1. Arithmetic Pipeline
2. Instruction Pipeline
• Arithmetic pipelines are usually found in most of
the computers. They are used for floating point
operations, multiplication of fixed point numbers
etc
• In Instruction Pipeline a stream of instructions
can be executed by overlapping fetch, decode and
execute phases of an instruction cycle
11/08/2024 05:12 PM 20
Instruction Pipeline
• In this a stream of instructions can be executed by overlapping fetch,
computer system.
pipeline.
• The pipeline will be more efficient if the instruction cycle is divided into
Instruction Pipeline
11/08/2024 05:12 PM 22
Instruction Pipelining : Decomposition
11/08/2024 05:12 PM 24
Instruction Pipelining : Branch Instruction
11/08/2024 05:12 PM 25
Instruction Pipelining : Branch Instruction
11/08/2024 05:12 PM 26
Instruction Pipelining
11/08/2024 05:12 PM 27
Example:
Cont..
• Here the instruction is fetched on first clock cycle in segment 1.
Now it is decoded in next clock cycle, then operands are fetched and finally the
instruction is executed. We can see that here the fetch and decode phase overlap
due to pipelining. By the time the first instruction is being decoded, next
instruction it may point to some other instruction when it is decoded. Thus fourth
instruction is kept on hold until the branched instruction is executed. When it gets
executed then the fourth instruction is copied back and the other phases continue as
Performance evolution factor for pipelined
computer
• clock period
• Speedup
• Efficiency
• Throughput
11/08/2024 05:12 PM 30
Performance of Pipelined Execution
The following parameters serve as criterion to
estimate the performance of pipelined execution.
1. Speed Up-
It gives an idea of “how much faster” the
pipelined execution is as compared to non-
pipelined execution.
It is calculated as:
2. Efficiency
The efficiency of pipelined execution is calculated as-
3. Throughput-
• We can swap the terms, dependencies and hazards since they are used
architecture are:
1. Structural (Resource)
2. Data
3. Control
Structural Hazard
• Hardware resource conflicts among the instructions in the pipeline cause
structural hazards.
• A resource hazard occurs when two (or more) instructions that are
• This resource conflict is said to occur when more than one instruction in
the pipe is requiring access to the same resource in the same clock cycle
• The result is that the instructions must be executed in serial rather than
11/08/2024 05:12 PM 38
Structural Hazard : Solution
• The pipeline may be increased to 5 or more stages and
suitably redefine the functionality of the stages and adjust the
clock frequency.
• This eliminates the issue of the hazard at every 4th instruction
in the 4-stage pipeline
• The memory may physically be separated as Instruction
memory and Data Memory.
• A Better choice would be to design as Cache memory in CPU,
rather than dealing with Main memory.
• IF uses Instruction memory and Result writing uses Data
Memory.
• These become two separate resources avoiding dependency.
• It is possible to have Multiple levels of Cache in CPU too.
11/08/2024 05:12 PM 39
Structural Hazard : Solution
• There is a possibility of ALU in resource
dependency. ALU may be required in IE machine
cycle by an instruction while another instruction
may require ALU in IF stage to calculate Effective
Address based on addressing mode. The solution
would be either stalling or have an exclusive ALU
for address calculation.
• Register files are used in place of GPRs. Register
files have multiport access with exclusive read and
write ports. This enables simultaneous access on
one write register and read register.
11/08/2024 05:12 PM 40
Data Hazards
• Data hazards in pipelining emerge when the execution of
one instruction is dependent on the results of another
instruction that is still being processed in the pipeline.
ADD AX,BX
SUB CX,AX
• The order of the READ or WRITE operations on the
register is used to classify data threats into three groups.
Data Hazards : Types
• Read after write (RAW), or true dependency: A hazard occurs if
the read takes place before the write operation is complete.
• Write after read (RAW), or antidependency: A hazard occurs if
the write operation completes before the read operation takes
place.
• Write after write (RAW), or output dependency: Two
instructions both write to the same location. A hazard occurs if
the write operations take place in the reverse order of the
intended sequence.
Control Hazards
• Branch hazards are caused by branch instructions and are known as control
languages for iterative loops and condition testing (correlate with while,
result, when the decision to execute one instruction is reliant on the result