Computer Architecture Lecture No.4 5-Instruction Set Architecture and Design 5-1 Memory locations and Operations. word

Similar documents
Chapter 04: Instruction Sets and the Processor organizations. Lesson 18: Stack-based processor Organisation

CHAPTER 8: Central Processing Unit (CPU)

2. ADDRESSING METHODS

COSC 6385 Computer Architecture. Instruction Set Architectures

Chapter 2 Instruction Set Architecture

EC-801 Advanced Computer Architecture

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

INSTRUCTION SET ARCHITECTURE AND DESIGN. Danang Wahyu Utomo

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

STRUCTURE OF DESKTOP COMPUTERS

tokens parser 1. postfix notation, 2. graphical representation (such as syntax tree or dag), 3. three address code

Instruction Sets: Characteristics and Functions Addressing Modes

Computer Architecture and Organization: L09: CPU Organization

CDA 3103 Computer Organization Homework #7 Solution Set

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Lecture 4: Instruction Set Architecture

UNIT-III ASSEMBLY LANGUAGE PROGRAMMING. The CPU can access data in various ways, which are called addressing modes

Instruction content (2/2) Instruction content (1/2) The Instruction Set. Chapter 9. Each instruction must contain 4 basic pieces of information

Computer Architecture 2/26/01 Lecture #

Instruction Set Design

PESIT Bangalore South Campus

Overview. EE 4504 Computer Organization. Much of the computer s architecture / organization is hidden from a HLL programmer

17. Instruction Sets: Characteristics and Functions

COMPUTER ORGANIZATION & ARCHITECTURE

add R1,x add R1,500 add R1,[x] The answer is: all of these instructions implement adding operation on R1 and all of them have two addresses.

TYPES OF INTERRUPTS: -

Lecture V Toy Hardware and Operating System

Tutorial 1: Programming Model 1

8051 Overview and Instruction Set

Review: What is a Computer?

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Computer Organization

The MIPS Instruction Set Architecture

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

Expectations. Why learn Assembly Language? Administrative Issues. Assignments. CSC 3210 Computer Organization and Programming

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

COMP2121: Microprocessors and Interfacing

Computer Architecture 1 ح 303

Programmable Machines

Programmable Machines

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

Introduction to Digital Logic

IR Lowering. Notation. Lowering Methodology. Nested Expressions. Nested Statements CS412/CS413. Introduction to Compilers Tim Teitelbaum

Instruction Set Architectures

Lecture 3: Instruction Set Architecture

Lesson 2. Instruction set design

Application Software For Learning CPU Process of Interrupt and I/O Operation

Computer Organization CS 206 T Lec# 2: Instruction Sets

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 19: Efficient IL Lowering 5 March 08

MPID MICROPROCESSOR AND ITS INTERFACING DEVICES EEE III II SEMESTER OBJECTIVE QUESTIONS

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Lecture 3 Machine Language. Instructions: Instruction Execution cycle. Speaking computer before voice recognition interfaces

Addressing Modes on the x86

Q. Classify the instruction set of 8051 and list out the instructions in each type.

Typical Processor Execution Cycle

Computer Organization and Technology Processor and System Structures

55:132/22C:160, HPCA Spring 2011

Chapter 9. Programming Framework

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK

Processor Organization and Performance

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

Microprocessor Architecture

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

Interfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?

Lectures 3-4: MIPS instructions

Advanced Computer Architecture-CS501. Vincent P. Heuring&Harry F. Jordan Chapter 2 Computer Systems Design and Architecture

4- MACHINE LANGUAGE CODING 4-1THE INSTRUCTION SET:

Virtual machines. Virtual machines. Abstractions for computers. Abstractions for computers. Virtual machines

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 153) Pass Marks: 24

Microcontroller Intel [Instruction Set]

Instruction Sets: Characteristics and Functions

8051 Addressing Modes

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

COSC 6385 Computer Architecture - Instruction Set Principles

Lecture 5. EEE3410 Microcontroller Applications Department of Electrical Engineering Assembly Language Programming (1)

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

CENG 450: Instruction Set (16-bit)

Basic ARM InstructionS

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

Assembly Language programming (2)

ELEG3924 Microprocessor

High Performance Computing

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

Chapter 15. ARM Architecture, Programming and Development Tools

Programming of 8085 microprocessor and 8051 micro controller Study material

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

ECE260: Fundamentals of Computer Engineering

COSC 6385 Computer Architecture. Defining Computer Architecture


Assembly Language. Lecture 2 x86 Processor Architecture

8051 Microcontroller

Digital System Design Using Verilog. - Processing Unit Design

JNTUWORLD. 1. Discuss in detail inter processor arbitration logics and procedures with necessary diagrams? [15]

Chapter Two MIPS Arithmetic

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

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

STACKS. A stack is defined in terms of its behavior. The common operations associated with a stack are as follows:

Course Administration

Transcription:

5-Instruction Set Architecture and Design There are basic principles involved in instruction set architecture and design. Therefore, this section includes many important issues will discuss. 5-1 Memory locations and Operations. The main memory can be modeled as an array of millions of adjacent cells, each capable of storing a binary digit (bit), having value of 1 or 0. These cells are organized in the form of groups of fixed number, say n, of cells that can be dealt with as an atomic entity. An entity consisting of 8 bits is called a byte. In many systems, the entity consisting of n bits that can be stored and retrieved in and out of the memory using one basic memory operation is called a word (the smallest addressable entity). Typical size of a word ranges from 16 to 64 bits. It is, however, customary to express the size of the memory in terms of bytes. For example, the size of a typical memory of a personal computer is 256 Mbytes, that is, 256 * 2 20 = 2 28 bytes. ( where 265 = 2 8 and Mbytes = 2 20 ) In order to be able to move a word in and out of the memory, a distinct address has to be assigned to each word. This address will be used to determine the location in the memory in which a given word is to be stored. This is called a memory write operation. Similarly, the address will be used to determine the memory location from which a word is to be retrieved from the memory. This is called a memory read operation (as mentioned in lecture 2). The number of bits, l, needed to distinctly address M words in a memory is given by l = log 2 M. For example, if the size of the memory is 64 M (read as 64 mega words), then the number of bits in the address is log 2 (64 * 2 20 ) = log 2 (2 26 ) = 26 bits. Alternatively, if the number of bits in the address is l, then the maximum memory size (in terms of the number of words that 24

can be addressed using these l bits) is M = 2 l. Figure (4.1) illustrates the concept of memory words and word address as explained above. Figure (4.1) Illustration of the main memory addressing 5.2 Instruction formats. Any instruction issued by the processor must carry at least two types of information. These are the operation to be performed, encoded in what is called the op-code field, and the address information of the operand on which the operation is to be performed, encoded in what is called the address field. 25

5.3 Instructions Types Instructions can be classified based on the number of operands as: 5.3.1 Three Address Instructions In instruction that have three operands, one of the operand specifies the destination as an address where the result is to be saved. The other two operands specify the source either as addresses of memory location or constants. Example 1: Execute the following instruction using three address format: Sol : the solution is shown below, together with comments that explain the register transfer operation of each instruction. 1 mul R1,c,b R1 c*b 2 sub R2,r,d R2 r-d 3 div X, R1,R2 X r1/r2 The advantage of the three-address format is that it results in short programs when evaluating arithmetic expressions. 5.3.2.Two'Address Instructions In this type both operands specify sources. The first operand also specifies the destination address after the result is to be saved. The first operand must be an address in memory, but the second may be an address or a constant. Example 2 : Execute the following instruction using two address format : Sol : the solution is shown below, together with comments that explain the register transfer operation of each instruction. 26

1 mov R1,c R1 c 2 mul R1,b R1 R1*b 3 Mov R2,r R2 r 4 Sub R2,d R2 R2-d 5 Div R1,R2 R1 R1/R2 6 Mov x,r1 x R1 Note that : In this type of instruction we can use (mov) beside the arithmetic operations. This method requires more steps than previous method to represent the same instruction. For temporary storage use a register. 5.3.3.One'Address Instructions Some computer has only one general purpose register, usually called Ac "Accumulator". It is implied as one of the source operands and the destination operand in memory instruction the other source operand is specified in the instruction as location in memory. Example 3 : Execute the following instruction using one address format : Sol : the solution is shown below, together with comments that explain the register transfer operation of each instruction. 1 load r Ac r 2 Sub d Ac Ac-d 3 Store t T Ac 4 load c Ac c 5 Mul b Ac Ac*b 6 Div t Ac Ac/t 7 Store x X Ac 27

Note that : In this type of instruction we can use (load) and (store) beside the arithmetic operations. This method requires more steps than previous methods to represent the same instruction. For temporary storage use a memory location and is not a register. Why? 5.3.4.Zero'Address Instructions Some computers have arithmetic instruction in which all operands are implied, these zero operand instruction use a stack. A stack is a list structure in which all insertion and deletion occur at one end, the element on a stack may be removed only in the reverse of the order in which they were entered. The process of inserting an item is called Pushing, removing an item is called Popping. Example: Execute the following instruction using Zero-address format: Sol : 1 Push d TOS d "TOP :Top OF Stack" 2 Push r TOS r 3 Sub Pop d Pop r Sub them TOS (r-d) 4 Push b TOS b 5 Push c TOS c 6 Mul Pop c Pop b multiply them TOS (c*b) 7 Div Pop (c*b) Pop (r-d) 28

Divide TOS (c*b) / (r-d) 8 Pop x X TOS Home Work: Execute the following instruction using all previous instruction format types: 1- X = (A + B)* (C + D) 2- S = F-(C*B)+M 3- N= (A+B*C)/ (F*E) 5.4 Instruction Length Instruction length is the number of bits or bytes which defines an instruction. This can be done simply by specifying how many bits in each field in the instruction. The length of pcode field is inferred from the (No. of instructions) supported by the processor. By convert the No. of instruction supported by the processor to the form 2 n, n will be the No. of bits for (opcode field). Example : If the CPU can do 64 instruction, then the no. of bits in the opcode field will be : 64 2 6 n=6.therefore the no. of bits =6. The length of address field is inferred from memory which is formulated as follow: 2 n B 2 n W (30 KW, 256 MB, 1GB..) Where n will be the No. of bits in each address field. 29

Example : Memory size = 1 KB 1K = 2 10 n= 10 Address bits =10 Example: A Computer have memory size 16 kw where word is 16 bit. The instruction stored in one location (word) the instruction have three parts : operation code field, and address field. 1- How many bit in each field? 2- Draw the instruction format and indicate the No. of bits. 3- Specify the No. of operation in this computer. SOL: 1- Memory size = 16 kw 16 k = 2 4 2 10 = 2 14 14 bit address line. No. of bit for operand field = 14. Now: The instruction stored in one location (word) and the word =16 bit No. of bit for opcode field = 16 14 = 2 2- Opcode Operand (address) 2 bit 14 bit 3-The No. of bit for operation = 2 No. of bit for opcode field = 2 2 = 4 operations 30