04 Instruction Execution Cycle

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

1

Lecture No 4: Instruction Execution Cycle


Spring 2020, BESE-9 (A&B)
+
Basic Instruction Cycle

2
Instruction Format
Every Instruction has two ingredients:
 OpCode
 Explicitly Defined Operands: (1, 2 or 3)

3
Program Execution Example
In our example, every instruction has:
 OpCode
 Only one explicitly defined operand

4
Program Execution Example
Suppose the Instruction Set has 3 instructions only:
1. OpCode=(0001)2=1h: Load AC from the Data Memory

2. OpCode=(0010)2=2h: Store AC into the Data Memory

3. OpCode=(0101)2=5h: Add to AC from the Data Memory

Instruction Format:
OpCode + Address of the Data Memory Location

5
Step 1: Fetching Inst-1
Instruction Memory CPU Registers
300 1940 300 PC
AC
301 5941
302
1940 IR
2941

Data Memory

940 0003
941 0002

Load AC from the Data Memory Location 940

6
Step 2: Executing Inst-1
Instruction Memory CPU Registers
300 1940 301 PC

301 5941 0003 AC

302
1940 IR
2941

Data Memory

940 0003
941 0002

Load AC from the Data Memory Location 940


7
Step 3: Fetching Inst-2
Instruction Memory CPU Registers
300 1940 301 PC

301 5941 0003 AC

302
5941 IR
2941

Data Memory

940 0003
941 0002

Add to AC from Data Memory Location 941


8
Step 4: Executing Inst-2
Instruction Memory CPU Registers
300 1940 302 PC

301 5941 0005 AC

302
5941 IR
2941

Data Memory
3+2=5
940 0003
941 0002

Add to AC from Data Memory Location 941

9
Step 5: Fetching Inst-3
Instruction Memory CPU Registers
300 1940 302 PC

301 5941 0005 AC

302
2941 IR
2941

Data Memory

940 0003
941 0002

Store AC into the Data Memory Location 941

10
Step 6: Executing Inst-3
Instruction Memory CPU Registers
300 1940 303 PC

301 5941 0005 AC

302
2941 IR
2941

Data Memory

940 0003
941 0005

Store AC into the Data Memory Location 941

11
+
All Six Steps of the Example Program Execution

12
Instruction Cycle State Diagram

13
+
Classes of Interrupts

14
Program Flow Control

15
Transfer of Control via Interrupts

16
Instruction Cycle With Interrupts

17
+ Program Timing: Short I/O Wait

18
Program Timing: Long I/O Wait
+

19
Instruction Cycle State Diagram With Interrupts

20
Transfer of Control with Multiple Interrupts

21
Time Sequence of Multiple Interrupts

22
23

End of Lectures

You might also like