Unit1 1.7 Instr Cycle
Unit1 1.7 Instr Cycle
Unit1 1.7 Instr Cycle
7
INSTRUCTION CYCLE AND INSTRUCTION PIPELINE
1
Outline
2
Computer Components
• All contemporary computer designs are based on concepts developed by John von
Neumann at the Institute for Advanced Studies, Princeton U.
• Such a design is referred to as the von Neumann architecture and based on 3
concepts:
– Data and instructions are stored in a single read-write memory
– The contents of this memory are addressable by location, without regard to
type of data contained there
– Execution occurs in a sequential fashion from one instruction to the next.
3
Components
• The Control Unit and the Arithmetic and Logic Unit constitute the
Central Processing Unit
• Data and instructions need to get into the system and results out
– Input/output
• Temporary storage of code and results is needed
– Main memory
4
Top Level View
5
CPU Functions and Organization
– Temporary storage
– Means to move data and instructions in and around the CPU
7
Registers
8
Register Organization
9
User Visible Registers
• General Purpose
• Data
• Address
• Condition Codes
10
General Purpose Registers
12
Condition Code Registers
13
Control and Status Register
• Used by the control unit to control the operations of the CPU and by the
privileged operating systems programs to control program execution
• The four essential registers for instruction execution:
1. Program Counter (PC)
2. Instruction Decoding Register (IR)
3. Memory Address Register (MAR)
4. Memory Buffer Register (MBR)
14
Program Status Word
• All CPU design include a set of registers (PSW) that contain status
information
• Common fields or flags include:
– Sign of last result
– Zero
– Carry
– Equal
– Overflow
– Interrupt enable/disable
– Supervisor
15
Example Register Organization
16
Example Register Organization (2)
17
Instruction Cycle
18
Fetch Cycle
• In typical processor, Program Counter (PC) register holds address of next instruction to be
fetched next
• Processor fetches instruction from memory location pointed to by PC
• Increment PC
– Unless told otherwise
• The fetched instruction is loaded into Instruction Register (IR) register
19
Execute Cycle
• The processor interprets the instruction and performs required actions. In general, these actions fall into
four categories:
– Processor-memory
• data transfer between CPU and main memory
– Processor I/O
• Data transfer between CPU and I/O module
– Data processing
• Some arithmetic or logical operation on data
– Control
• Alteration of sequence of operations
20
• e.g. jump
– Combination of above
Example of Program Execution
21
Data Flow
1. IR is examined
24
2. If indirect addressing, indirect cycle is performed
– Right most N bits of MBR transferred to MAR
– Control unit requests memory read
– Result (address of operand) moved to MBR
Execute Cycle – Data Flow
• The execute cycle may take many forms, depending on the instruction being
executed
• May include
– Memory Read/Write
– Input/Output
– Register transfer
– ALU operations
25
Pre-Fetch
• Strict sequential instruction execution does not permit high levels of H/W efficiency
– Solution is to operate the instruction execution cycle like an assembly line:
• Perform all tasks concurrently, but on different (sequential) instructions
– The result is temporal parallelism: the instruction pipeline
• We have considered an instruction execution consisting of two stages
– Fetch Instruction
– Execute Instruction
27
4 stage pipeline
28
Non Pipelined Vs Pipelined
29
Pipelining Overview
30
31
Advantages of Instruction Pipeline
• Increased Throughput: Pipelining enhance the throughput capacity of a CPU and enables
a number of instruction to be processed at the same time at different stages. This leads to the
improvement of the amount of instructions accomplished in a given period of time, thus
improving the efficiency of the processor.
32
• Higher Instruction Throughput: Pipelining occurring because when one particular
instruction is in the execution stage it is possible for other instructions to be at varying
stages of fetch, decode, execute, memory access, and write-back. In this manner there
is concurrent processing going on and the CPU is able to process more number of
instructions in a given time frame than in non pipelined processors.
• Better Performance for Repeated Tasks: Pipelining is particularly effective when all
the tasks are accompanied by repetitive instructions, because the use of the pipeline
shortens the amount of time each task takes to complete.
34
THANK YOU
35