Title: Instruction Fetch Execute Cycle Tutorial
1Instruction Fetch Execute Cycle Tutorial
2Key Points
- Once started, a computer continuously performs
the following
- Fetch next instruction from memory
- Special purpose registers used
- PC Program Counter to hold address of next
instruction to be fetched
- MBR Memory Buffer Register for value to be
read/written from/to memory
- IR Instruction Register to contain opcode of the
last Instruction
3Basic Instruction Cycle
Memory
Fetching
CPU
Execution
4Fetch Cycle
PC
PC
Memory
IR
MBR
Memory Buffer Register
5Execute Cycle
e.g Execute a simple instruction Load A, 1234H
IR
Memory
A
MBR
6Walkthrough of Instruction Fetch Execute Cycle
Control Unit
ALU
PC 1000H
Memory
1000H add 512H, 435H, 867H
PC initialized to 1000H which holds the
instruction
Add values stored in addresses 512H and 435H and
store result in 867H
7Fetch Cycle Example
Move instruction from memory to Control Unit
Control Unit
ALU
PC 1000
add 512H, 435H, 867H
Memory
1000H add 512H, 435H, 867H
8Decode Cycle Example
Decode instruction by parsing the addresses of
operands
ALU
512H 435H 867H
9Decode Cycle (contd.)
Fetch the stored value of operands from
corresponding memory address
Determine the type of operation to be performed
Control Unit
ALU
PC 1001
512H 5 435H 2 867H
add 512H, 435H, 867H
Memory
512H 5 467H 2
10Execute Cycle Example
Execute the instruction
ALU
512H 5 435H 2
11Execute Cycle (contd.)
Store the result back in memory
ALU
867H 7
Memory
867H 7
12Basic Instruction Cycle (contd.)
Begin
Fetch Next Instruction
Decode Instruction
Execute Instruction
13Complete Instruction Cycle
Begin
Fetch Instr. from PC
- Raise Exception/Interrupt
- Save PC
- Load PC with pre-determined value
- Set us bit 1
IR Instruction
Increment PC
No
Decode Instruction
Yes
No
Yes
Execute Instruction
No
Yes
14System Bootup
Boot Loader
Power On
ROM
Fetch Instr. from PC
Boot Loader Running
DISK
MEMORY
OS
LILO/GRUB
MBR
OS loads itself to memory now
Master Boot Record