Computer Architecture and Organization: L06: Instruction Cycle

Similar documents
Basic Computer Organization and Design Part 2/3

Computer Organization (Autonomous)

UNIT:2 BASIC COMPUTER ORGANIZATION AND DESIGN

BASIC COMPUTER ORGANIZATION AND DESIGN

5-1 Instruction Codes

BASIC COMPUTER ORGANIZATION AND DESIGN

CHAPTER 5 Basic Organization and Design Outline Instruction Codes Computer Registers Computer Instructions Timing and Control Instruction Cycle

Basic Computer Organization - Designing your first computer. Acknowledgment: Most of the slides are adapted from Prof. Hyunsoo Yoon s slides.

BASIC COMPUTER ORGANIZATION AND DESIGN

csitnepal Unit 3 Basic Computer Organization and Design

Unit II Basic Computer Organization

Chapter 5. Computer Architecture Organization and Design. Computer System Architecture Database Lab, SANGJI University

COMPUTER ORGANIZATION

CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN

Computer Organization and Design

Programming Level A.R. Hurson Department of Computer Science Missouri University of Science & Technology Rolla, Missouri

Computer Architecture

Blog -

Midterm Examination # 2 Wednesday, March 18, Duration of examination: 75 minutes

Computer Organization and Architecture

Introduction. Machine Language. Assembly Language. Assembler. Program Loops. Programming Arithmetic and Logic Operations.

CHAPTER SEVEN PROGRAMMING THE BASIC COMPUTER

C.P.U Organization. Memory Unit. Central Processing Unit (C.P.U) Input-Output Processor (IOP) Figure (1) Digital Computer Block Diagram

COMPUTER ARCHITECTURE AND DIGITAL DESIGN

Computer architecture Assignment 3

Faculty of Engineering Systems & Biomedical Dept. First Year Cairo University Sheet 6 Computer I

Computer Architecture

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

Computer Architecture and Organization: L04: Micro-operations

Darshan Institute of Engineering & Technology for Diploma Studies Unit - 1

جامعة بنها - كمية العموم قسم الرياضيات المستوي الرابع )علوم حاسب( يوم االمتحان: االحد تاريخ االمتحان: 1024 / 21 / 12 المادة :

Chapter 16. Control Unit Operation. Yonsei University

Effective Approach for Teaching Computer System Architecture

Computer Architecture and Organization: L09: CPU Organization

REGISTER TRANSFER LANGUAGE

There are four registers involved in the fetch cycle: MAR, MBR, PC, and IR.

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

William Stallings Computer Organization and Architecture

Roll No TCS 402/TIT 402

M. Sc (CS) (II Semester) Examination, Subject: Computer System Architecture Paper Code: M.Sc-CS-203. Time: Three Hours] [Maximum Marks: 60

CHAPTER 8: Central Processing Unit (CPU)

Micro-Operations. execution of a sequence of steps, i.e., cycles

Assembly Language Programming of 8085

PSIM: Processor SIMulator (version 4.2)

Computer Organization II CMSC 3833 Lecture 33

Class Notes. Dr.C.N.Zhang. Department of Computer Science. University of Regina. Regina, SK, Canada, S4S 0A2

Credit Based Choice Based Curriculum for. Bachelor of Computer Applications (BCA) Programme 2016 Onwards

Mini-Computer PDP-8 ISA Simulator Design and Verification

SCRAM Introduction. Philipp Koehn. 19 February 2018

INSTRUCTION SET OF 8085

Computer Organization (Autonomous)

UNIT - V MEMORY P.VIDYA SAGAR ( ASSOCIATE PROFESSOR) Department of Electronics and Communication Engineering, VBIT

For Example: P: LOAD 5 R0. The command given here is used to load a data 5 to the register R0.

Register Transfer and Micro-operations

THE MICROPROCESSOR Von Neumann s Architecture Model

IA-32 architecture. PDP8/e architecture Arithmetic. IA-32 architecture (cont)

Chapter 3 : Control Unit

Magdy Saeb, Samy Salamah Arab Academy for Science, Technology & Maritime Transport School of Engineering, Computer Department Alexandria, Egypt

Blog -

COA. Prepared By: Dhaval R. Patel Page 1. Q.1 Define MBR.

CPU Structure and Function

Computer Architecture Programming the Basic Computer

CHAPTER 4: Register Transfer Language and Microoperations

STRUCTURE OF DESKTOP COMPUTERS

REGISTER TRANSFER AND MICROOPERATIONS

EE 3170 Microcontroller Applications

REGISTER TRANSFER AND MICROOPERATIONS

CPU Structure and Function

DC57 COMPUTER ORGANIZATION JUNE 2013

MICROPROGRAMMED CONTROL

Combinational and sequential circuits (learned in Chapters 1 and 2) can be used to create simple digital systems.

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

8085 INSTRUCTION SET INSTRUCTION DETAILS


MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT I THE 8085 & 8086 MICROPROCESSORS. PART A (2 Marks)

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

2 MARKS Q&A 1 KNREDDY UNIT-I

General purpose registers These are memory units within the CPU designed to hold temporary data.

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

COMPUTER ORGANIZATION AND ARCHITECTURE

CPU Design John D. Carpinelli, All Rights Reserved 1

Assembly Language Programming of 8085

Module 5 - CPU Design

Control Unit Implementation Hardwired Memory

MICROPROGRAMMED CONTROL

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.


Chapter 4 The Von Neumann Model

Microcomputer Architecture and Programming

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

20/08/14. Computer Systems 1. Instruction Processing: FETCH. Instruction Processing: DECODE

Fig: Computer memory with Program, data, and Stack. Blog - NEC (Autonomous) 1

Note that none of the above MAY be a VALID ANSWER.

Chapter 4 The Von Neumann Model

MICROPROGRAMMED CONTROL

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Introduction to Computers - Chapter 4

Transcription:

Computer Architecture and Organization: L06: Instruction Cycle By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, ah.abdulhafez@gmail.com 1

Outlines 1. Fetch and decode 2. Determine the Type of Instruction 3. Instruction set in details 4. End 2

Instruction Cycle A program residing in the memory unit of the computer consists of a sequence of instructions. The program is executed in the computer by going through a cycle for each instruction. Each instruction cycle in turn is subdivided into a sequence of subcycles or phases: 1. Fetch an instruction from memory 2. Decode the instruction 3. Read the effective address from memory if indirect 4. Execute the instruction 3

Fetch and Decode Initially PC is loaded with the address of the first instruction in the program SC is cleared to 0, providing T 0 timing signal. The microoperations for the fetch and decode phases are: T 0 : AR PC T 1 : IR M[AR], PC PC +1 T2 : D 0,...,D 7 decode IR(12-14), AR IR(0-11), I IR(15) Since only AR is connected to the address inputs of memory, it is necessary to transfer the address from PC to AR during the clock transition associated with T0. The instruction read from memory is then placed in the IR with the clock transition of T 1 At the same time PC is incremented by one to prepare it for the address of the next instruction of the program. At T 2, the Opcode in IR is decoded, I bit is transferred to Flip Flop I, and IR part (0-11) is transferred into AR. 4

Fetch and Decode T 0 : AR PC To provide the data path for the transfer of PC to AR, we must apply timing signal T 0 to achieve the following connection: 1. Place the content of PC onto the bus by making the bus selection inputs S 2 S 1 S 0 equal to 010 2. Transfer the content of the bus to AR by enabling the LD input of AR The next clock transition initiates the transfer from PC to AR since T 0 =1. (See Mano figure 5.8) 5

Fetch and Decode T 1 : IR M[AR], PC PC +1 For the second statemet, it is necessary to use timing signal T 1 to provide the following conditions in the bus system Enable the read input of memory Place the content of memory onto the bus by making S 2 S 1 S 0 = 111 Transfer the content of the bus to IR by enabling the LD input of IR Increment PC by enabling the INR input of PC The next clock transition initiates the read and increment operations since T 2 =1 (See Mano Fig 5.8) 6

T0: AR PC T1: IR M[AR], PC PC+1 T2: D7.D0 Decode IR(12-14), AR IR(0-11), I IR(15) T1 T0 10 1 0 10 1 10 S2 S1 S0 BUS Memory Unit 7 1 Read Address AR 1 1 0 10 01 0 1 LD T 0 T 1 T 15 PC 2 Decoder 1 INR 0 0 10 01 Sequence Counter 1 LD IR Clock 3 Clock Common Bus 7

Determine the Type of Instruction The timing signal that is active after decoding is T3. During time T3, the control unit determines the type of instruction that was just read from memory. See flowchart (at Mano Fig. 5.9) next slide. 8

Instruction Types The basic computer has three instruction code formats : (a) Memory reference instruction format 15 14 12 11 0 opcode address I (Opcode = 000 through 110) (b) Register reference instruction format 15 14 12 11 0 0 1 1 1 Register operation (Opcode = 111) (c) Input-output instruction format 15 14 12 11 0 1 1 1 1 I/O operation (Opcode = 111) 9

Start AR PC IR M[AR], PC PC+1 Decode operation code in IR (12-14) AR IR(0-11), I IR(15) T0 T1 T2 (Register or I/O) =1 D 7 =0 (Memory-reference) ( I/O ) =1 =0 (register) (indirect ) =1 =0 (direct ) I I D 7 I T3 Execute input-output Instruction T3 D 7 I T3 T3 D 7 I T3 T3 D 7 I T3 T3 Execute Register-refernce Instruction AR M[AR] Nothing Execute Memory-reference Instruction Flowchart for instruction cycle (initial configuration) 10

Register-Reference Instructions Register ref instructions are identified when D7=1 and I=0 Execution is started with timing signal T3 and takes one clock cycle. Register ref instruction is specified by bits (0-11) of IR which also transfer to AR during time T2. D7 I T3 = r (common for all register-refernce instructions) IR( I ) = Bi [bit in IR (0-11) that specifies the operation] r: SC 0 Clear SC CLA rb 11 : AC 0 Clear AC CLE rb 10 : E 0 Clear E CMA rb 9 : AC AC Complement AC CME rb 8 : E E Complement E HLT instruction clears a startstop flip-flop S and stops the SC from counting. To restore the operation of the computer, the start-stop flip-flop must be set manually. CIR rb 7 : AC shr AC, AC(15) E, E AC (0) Circulate right CIL rb 6 : AC shl AC, AC(0) E, E AC (15) Circulate left INC rb 5 : AC AC+1 Increment AC SPA rb 4 : If (AC (15)=0) then (PC PC+1) Skip if positive SNA rb 3 : If (AC (15)=1) then (PC PC+1) Skip if negative SZA rb 2 : If (AC =0) then (PC PC+1) Skip if AC zero SZE rb 1 : If (E=0) then (PC PC+1) Skip if E zero HLT rb 0 : S 0 (S is a start-stop flip-flop) Halt 11computer

Start AR PC IR M[AR], PC PC+1 Decode operation code in IR (12-14) AR IR(0-11), I IR(15) T0 T1 T2 (Register or I/O) =1 D 7 =0 (Memory-reference) ( I/O ) =1 =0 (register) (indirect ) =1 =0 (direct ) I I D 7 I T3 Execute input-output Instruction T3 D 7 I T3 T3 D 7 I T3 T3 D 7 I T3 T3 Execute Register-refernce Instruction AR M[AR] Nothing Execute Memory-reference Instruction Flowchart for instruction cycle (initial configuration) 12

Memory-Reference Instructions Memory ref instructions are identified when D7=0. The effective address of the instruction is in AR and was placed there during timing signal T2 for direct instruction and during T3 for the indirect instruction. The execution of all Memory instructions starts from timing signal T4. Symbol Operation decoder Symbolic description AND D 0 AC AC ^ M[AR] ADD D 1 AC AC + M[AR], E Cout LDA D 2 AC M[AR] STA D 3 M[AR] AC BUN D 4 PC AR BSA D 5 M[AR] PC, PC AR+1 ISZ D 6 M[AR] M[AR]+1, if M[AR]+1=0 then PC PC + 1 13

Memory-Reference Instructions AND to AC D 0 T 4 : DR M[AR] D 0 T 5 : AC AC ^ DR, SC 0 read operand from memory and store it in DR And AC with DR and save the result in AC ADD to AC D 1 T 4 : DR M[AR] read operand from memory and store it in DR D 1 T 5 : AC AC + DR, E Cout, SC 0 add AC with DR and save the result in AC. LDA: Load to AC D 2 T 4 : DR M[AR] D 2 T 5 : AC DR, SC 0 read operand from memory and store it in DR transferee DR to AC. STA: Store AC D 3 T 4 : M[AR] AC, SC 0 save content of AC in memory. 14

BUN: Branch Unconditionally This instruction transfers the program to the instruction specified by the effective address in AR. D 4 T 4 : PC AR, SC 0 transfer the address of the next instruction from AR to PC. Note: remember that PC holds the address of the next instruction. address instruction 100 BUN 135 101 SPA..... 135 CLA 15

BSA: Branch &save Address This instruction is useful for branching to a portion of the program called subroutine. When the subroutine is finished, the computer returns back to the next instruction after BSA instruction.. D 5 T 4 : M[AR] PC, AR AR+1 D 5 T 5 : PC AR, SC 0 16

Return Example of BSA instruction execution Memory Memory 020 0 BSA 135 020 0 BSA 135 PC=021 Next instruction 021 Next instruction.... Jump.... AR=135 136 Subroutine Save the next instruction address 135 PC=136 021 Subroutine 1 BUN 135 (a) Memory, PC, and AR at time T4 Indirect branch 1 BUN 135 (b) Memory, PC, and AR after 17 execution.

ISZ: Increment and skip if Zero D 6 T 4 : DR M[AR] D 6 T 5 : DR DR+1 D 6 T 6 : M[AR] DR, if (DR=0) then (PC PC+1), SC 0. This instruction increments the word specified by the effective address, and if the incremented value is zero, PC is incremented by 1 in order to skip the next instruction. Since it is not possible to increment a word inside the memory, it is necessary to read the word into DR, increment DR, and store the word back into memory. D 5 T 4 : M[AR] PC, AR AR+1 18

Flowchart for memory-reference instructions AND ADD LAD D 0 T4 D 1 T4 D 2 T4 DR M[AR] DR M[AR] DR M[AR] D 0 T5 D 1 T5 D 2 T5 AC AC DR AC AC + DR E Cout AC DR 19

Flowchart for memory-reference instructions STA BUN BSA ISZ D 3 T4 D 4 T4 D 5 T4 D 6 T4 M[AR] AC PC AR M[AR] PC AR AR+1 DR M[AR] PC AR D 5 T5 D 6 T5 DR DR+1 M[AR] DR IF (DR=0) Then (PC PC+1) D 6 T6 20

Start AR PC IR M[AR], PC PC+1 Decode operation code in IR (12-14) AR IR(0-11), I IR(15) T0 T1 T2 (Register or I/O) =1 D 7 =0 (Memory-reference) ( I/O ) =1 =0 (register) (indirect ) =1 =0 (direct ) I I D 7 I T3 Execute input-output Instruction T3 D 7 I T3 T3 D 7 I T3 T3 D 7 I T3 T3 Execute Register-refernce Instruction AR M[AR] Nothing Execute Memory-reference Instruction CAO, Flowchart by Dr. for A.H. instruction Abdul Hafez, cycle (initial CE Dept. configuration) HKU 21

Input-Output Configuration The terminal devices send and receive serial information. The INPR and OUTR communicate serially with terminals and in parallel with the AC. FGI and FGO are two single bit flip-flops needed to synchronize the timing rate difference between the terminals and the computer. 22

Input operation Initially, FGI is cleared to 0. When a key is struck in the keyboard, an 8-bit code is shifted into INPR and the input flag FGI IS SET TO 1. As long as the flag FGI=1, the content of INPR cannot be changed with a new code. The computer checks the FGI flag, if it is 1, the information in INPR is transferred into AC in parallel and the FGI is cleared to 0. Once the flag is cleared, new information code can be shifted into INPR by striking another key. FGO Printer Receiver interface OUTR AC Keyboard 00110110 01110111 Transmitter interface INPR FGI 01 23

Output operation Initially, FGO is set to 1. The computer checks the flag bit, if it is 1, the information from AC is transferred in parallel into OUTR and FGO is cleared to 0. The output device accepts the coded information, prints the corresponding character, and when the operation is completed, it sets FGO to 1. As long as the flag FGO is cleared, the computer does not load a new character code into OUTR. FGO 10 Printer Receiver interface OUTR AC 00110110 Keyboard Transmitter interface INPR FGI 0 24

Input-Output Instructions Input-output instructions are needed for transferring information to and from AC register, for checking the input and output flags and for controlling the interrupt facility. Input-output instructions have op-code 1111 and are recognized when D7=1 and I=1. The execution of all input-output instructions is done during timing signal T3. D7 I T3 =p (common for all input-output instructions) IR( I ) = Bi [bit in IR (6-11) that specifies the instructions] p: SC 0 Clear SC INP pb 11 : AC(0-7) INPR, FGI 0 Input character OUT pb 10 : OUTR AC (0-7), FGO 0 Output character SKI pb 9 : if (FGI=1) then (PC PC + 1) Skip on input flag SKO pb 8 : if (FGO=1) then (PC PC + 1) Skip on output flag ION pb 7 : IEN 1 Interrupt enable ON IOF pb 6 : IEN 0 Interrupt enable OFF 25

The end of the Lecture Thanks for your time Questions are welcome 26