COMPUTER ORGANIZATION & ARCHITECTURE

Similar documents
Instruction Sets: Characteristics and Functions

Instruction Sets: Characteristics and Functions Addressing Modes

Computer Organization CS 206 T Lec# 2: Instruction Sets

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Chapter 2 Instruction Set Architecture

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

17. Instruction Sets: Characteristics and Functions

Instruction Set Architecture

CHAPTER 5 A Closer Look at Instruction Set Architectures

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

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

Module 3 Instruction Set Architecture (ISA)

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

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

COS 140: Foundations of Computer Science

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 10 Instruction Sets: Characteristics and Functions

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

Chapter 11. Instruction Sets: Addressing Modes and Formats. Yonsei University

Instruction Sets Ch 9-10

Addressing Modes. Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack

Instruction Sets Ch 9-10

CHAPTER 5 A Closer Look at Instruction Set Architectures

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

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

Computer Organization and Technology Processor and System Structures

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

Introduction to Computers & Programming

Instruction Set. Instruction Sets Ch Instruction Representation. Machine Instruction. Instruction Set Design (5) Operation types

Computer System Architecture

Understand the factors involved in instruction set

EC-801 Advanced Computer Architecture

UNIT 2 PROCESSORS ORGANIZATION CONT.

Lecture 4: Instruction Set Architecture

Processing Unit CS206T

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

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Instruction Set Design

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

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

ECE 486/586. Computer Architecture. Lecture # 7

CHAPTER 5 A Closer Look at Instruction Set Architectures

Computer Architecture 1 ح 303

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

COSC 6385 Computer Architecture. Instruction Set Architectures

Typical Processor Execution Cycle

Instruction Set Architecture

We briefly explain an instruction cycle now, before proceeding with the details of addressing modes.

Digital System Design Using Verilog. - Processing Unit Design

TYPES OF INTERRUPTS: -

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Chapter 5. A Closer Look at Instruction Set Architectures

Instruction Set Architecture. "Speaking with the computer"

Evolution of ISAs. Instruction set architectures have changed over computer generations with changes in the

When an instruction is initially read from memory it goes to the Instruction register.

Chapter 5. A Closer Look at Instruction Set Architectures

Real instruction set architectures. Part 2: a representative sample

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

Instruction Set Principles and Examples. Appendix B

The Instruction Set. Chapter 5

3.0 Instruction Set. 3.1 Overview

Chapter 2 Data Manipulation

COMPUTER ORGANIZATION & ARCHITECTURE

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?

William Stallings Computer Organization and Architecture. Chapter 11 CPU Structure and Function

Instruc=on Set Architecture

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

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

THE MICROPROCESSOR Von Neumann s Architecture Model

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

DC57 COMPUTER ORGANIZATION JUNE 2013

Lecture 5: Instruction Set Architecture : Road Map

2. ADDRESSING METHODS

STRUCTURE OF DESKTOP COMPUTERS

CPU Structure and Function. Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition

Reminder: tutorials start next week!

Chapter 2: Instructions How we talk to the computer

EC 413 Computer Organization

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

COMPUTER HARDWARE. Instruction Set Architecture

Instructions: Language of the Computer

CS 101, Mock Computer Architecture

2. Define Instruction Set Architecture. What are its two main characteristics? Be precise!

Problem with Scanning an Infix Expression

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats

CS4617 Computer Architecture

Chapter 5. A Closer Look at Instruction Set Architectures

2.2 THE MARIE Instruction Set Architecture

CSCE 5610: Computer Architecture

Chapter 13 Reduced Instruction Set Computers

Computer Architecture

Assembly Language Programming of 8085

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

Instruction Set Architecture (ISA)

Assembly Language Design

Practical Malware Analysis

Transcription:

COMPUTER ORGANIZATION & ARCHITECTURE Instructions Sets Architecture Lesson 5a 1

What are Instruction Sets The complete collection of instructions that are understood by a CPU Can be considered as a functional spec for a CPU Implementing the CPU in large part is implementing the machine instruction set Machine Code is rarely used by humans Binary numbers / bits Machine code is usually represented by human readable assembly codes In general, one assembler instruction equals one machine instruction 2

The Instruction Set Architecture (ISA) view of a machine corresponds to the machine and assembly language levels. A compiler translates a high level language, which is architecture independent, into assembly language, which is architecture dependent. An assembler translates assembly language programs into executable binary codes. 3

Elements of an Instruction Each instruction must contain the information required by the processor for execution These elements are as follows: Operation code: Specifies the operation to be performed (e.g., ADD, I/O). The operation is specified by a binary code, known as the operation code, or opcode. Source operand reference: The operation may involve one or more source operands, that is, operands that are inputs for the operation. 4

Result operand reference: The operation may produce a result. Next instruction reference: This tells the processor where to fetch the next instruction after the execution of this instruction is complete Source and result operands can be in one of four areas: Main or virtual Memory Processor register Immediate I/O Device 5

THE FETCH-EXECUTE CYCLE The steps that the control unit carries out in executing a program are: (1) Fetch the next instruction to be executed from memory. (2) Decode the opcode. (3) Read operand(s) from main memory, if any. (4) Execute the instruction and store results, if any. (5) Go to step 1. This is known as the fetch-execute cycle. 6

Instruction Representation Within the computer, each instruction is represented by a sequence of bits. The instruction is divided into fields, corresponding to the constituent elements of the instruction. Opcodes are represented by abbreviations, called mnemonics, that indicate the operation. Common examples include ADD, SUB, MUL, DIV, LOAD, STOR 7

Instruction Types A machine language expresses operations in a basic form involving the movement of data to or from registers. The set of machine instructions must be sufficient to express any of the instructions from a high-level language. We can categorize instruction types as follows: Data processing: Arithmetic and logic instructions Data storage: Movement of data into or out of register and or memory locations Data movement: I/O instructions Control: Test and branch instructions 8

Number of Addresses Processor architecture can be describe in terms of the number of addresses contained in each instruction What is the maximum number of addresses one might need in an instruction? 9

3 Addresses Two source operand locations and a destination operand Not common Needs very long words to hold everything Assume we which to compute Y = (A - B)/[C + (D X E)] 10

2 Addresses One address doubles as operand and result. Reduces length of instruction. Requires some extra work. -Temporary storage to hold some results Compute Y = (A - B)/[C + (D X E)] 11

1 Address Implicit second address Usually a register (accumulator) Common on early machines Computing Y = (A - B) / [C + (D X E)], we have; 12

Try This 1. X = (A + B * C)(D - E * F) 2. A = B * C + D Using the various types of number addressing, represent the following as; -1 address -2 addresses -3 addresses 13

HOW MANY ADDRESSES? More addresses More complex (powerful?) instructions More registers Inter-register operations are quicker Fewer instructions per program Fewer addresses More instructions per program Less complex instructions hence requires a less complex processor Faster fetch/execution of instructions 14

There is some threshold between one-address and multiple address instructions. With one-address instructions, the programmer generally has available only one general-purpose register, the accumulator. With multiple-address instructions, it is common to have multiple general purpose registers. Allows some operations to be performed solely on registers because register references are faster than memory references. 15

Instruction Set Design Most interesting, and most analyzed, aspects of computer design Very complex because it affects so many aspects of the computer system Defines many of the functions performed by the processor 16

Operation repertoire Design Decision/Issues How many ops? What can they do? How complex are they? Data types Various types of data upon which operations are performed Instruction formats Length of op code field Number of addresses 17

Registers Design Decision/Issues cont Number of CPU registers available Which operations can be performed on which registers? Addressing modes RISC v CISC 18

Types of Operands Machine instructions uses data for its operations. The most general categories are; Addresses Numbers Integer/floating point Characters ASCII etc. Logical Data Bits or flags 19

INTEL x86 DATA TYPES The x86 can deal with data types of 8 bit Byte 16 bit word 32 bit (double word) 64 bit (quad-word) 128 bit (double quad-word) Addressing is by 8 bit unit The x86 supports a lot of specific data types. 20

21

TYPES OF OPERATIONS Number of different opcodes varies widely from machine to machine. Same general types of operations are found on all machines. Operations can be categorized as: -Data Transfer -Arithmetic -Logical -Conversion -I/O -System Control -Transfer of Control 22

DATA TRANSFER Data transfer instruction must specify several things -Source and Destination -Length of data -Amount of data May be different instructions for different movements e.g. IBM 370 Or one instruction and different addresses e.g. VAX 23

ARITHMETIC Most machines provide the basic arithmetic operations of add, subtract, multiply, and divide. These are invariably provided for signed integer (fixed-point) numbers. Often they are also provided for floating-point and packed decimal numbers. Other possible operations include a variety of single-operand instructions; for example, Absolute: Take the absolute value of the operand. Negate: Negate the operand. Increment: Add 1 to the operand. Decrement: Subtract 1 from the operand 24

25

LOGICAL Machines also provide a variety of operations for manipulating individual bits of a word This form of operation can be term as bit twiddling. They are based on Boolean operations like AND, OR, NOT, XOR, which are also used as operation names. Some other op names for logical operations are Test, Compare, Shift, Rotate, Set control variables. 26

CONVERSION These instructions are the one that change the format or operate on the format of the data. Examples are Translate, Convert An example of a more complex editing instruction is the EAS/390 Translate (TR) instruction This instruction can be used to convert from one 8- bit code to another, and it takes three operands: TR R1 (L), R2 27

ADDRESSING MODES A program operates on data that reside in the computer s memory. These data can be organized in a variety of ways Programmers use organizations called data structures to represent the data used in computations. These include lists, linked lists, arrays, queues, etc The different ways in which the location of an operand is specified in an instruction are referred to as addressing modes 28

ADDRESSING MODES Cont There are various categories of addressing modes. These include; Immediate Direct Indirect Register Register indirect Displacement Stack The following notations are used in the next slides; A = contents of an address field in the instruction (X) = contents of memory location X or register X EA = actual (effective) address of the location containing the referenced operand R = contents of an address field in the instruction that refers to a register 29

IMMEDIATE ADDRESSING MODE This is the simplest form of addressing where the operand value is present in the instruction Operand = A It is used to define and use constants or set initial values of variables For example, the instruction Move 200 immediate, R0 places the value 200 in register R0 In assembly language this can be represented as Move # 200,R0 30

IMMEDIATE ADDRESSING MODE cont Advantage No memory reference other than the instruction fetch is required to obtain from the operand, thus saving one memory or cache cycle in the instruction cycle Disadvantage The size of the number is restricted to the size of the address field, which, in most instruction sets, is small compared with the word length. 31

DIRECT ADDRESSING MODE A very simple form of addressing is direct addressing, in which the address field contains the effective address (EA) of the operand. EA = A It s a common technique used in earlier generations of computers but is not common on contemporary architectures. It requires only one memory reference and no special calculation. Its limitation is that it provides only a limited address space 32

33

INDIRECT ADDRESSING MODE In indirect addressing, the address field refer to the address of a word in memory, which in turn contains a full-length address of the operand. EA = (A) As defined earlier, the parentheses are to be interpreted as meaning contents of. 34

INDIRECT ADDRESSING MODE Advantage For a word length of N, an address space of 2N is now available. Disadvantage Instruction execution requires two memory references to fetch the operand, thus, one to get its address and a second to get its value Although the number of words that can be addressed is now equal to 2N the number of different effective addresses that may be referenced at any one time is limited to 2K where K is the length of the address field. 35

REGISTER ADDRESSING MODE Register addressing is similar to direct addressing. The only difference is that the address field refers to a register rather than a main memory address: EA = R Advantages Only a small address field is needed in the instruction No time-consuming memory references are required Disadvantage Address space is very limited. 36

REGISTER INDIRECT ADDRESSING MODE Register indirect addressing is similar to indirect addressing. The only difference is whether the address field refers to a memory location or a register. Thus, for register indirect address; EA = (R) Advantages and limitations of register indirect addressing is the same as for indirect addressing In addition, register indirect addressing uses one less memory reference than indirect addressing 37

38

DISPLACEMENT ADDRESSING MODE A very powerful mode of addressing combines the capabilities of direct addressing and register indirect addressing. It is known by a variety of names depending on the context of its use This is referred to as displacement addressing: EA = A + (R) 39

DISPLACEMENT ADDRESSING MODE Cont Displacement addressing requires that the instruction have two address fields, at least one of which is explicit. The value contained in one address field (value = A) is used directly. The other address field, or an implicit reference based on opcode, refers to a register whose contents are added to A to produce the effective address 40

41