Computer Organization CS 206 T Lec# 2: Instruction Sets

Similar documents
Instruction Sets: Characteristics and Functions Addressing Modes

COMPUTER ORGANIZATION & ARCHITECTURE

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

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

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

Chapter 2 Instruction Set Architecture

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

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Instruction Sets: Characteristics and Functions

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

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

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

Module 3 Instruction Set Architecture (ISA)

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

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

SEN361 Computer Organization. Prof. Dr. Hasan Hüseyin BALIK (8 th Week)

Instruction Set Architecture

17. Instruction Sets: Characteristics and Functions

Computer Organization and Technology Processor and System Structures

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

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

Instruction Set Design

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

The Instruction Set. Chapter 5

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

CHAPTER 5 A Closer Look at Instruction Set Architectures

CHAPTER 5 A Closer Look at Instruction Set Architectures

CHAPTER 5 A Closer Look at Instruction Set Architectures

MARIE: An Introduction to a Simple Computer

TYPES OF INTERRUPTS: -

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

COS 140: Foundations of Computer Science

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

COSC 6385 Computer Architecture. Instruction Set Architectures

Digital System Design Using Verilog. - Processing Unit Design

UNIT 2 PROCESSORS ORGANIZATION CONT.

Processing Unit CS206T

Computer System Architecture

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

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

Understand the factors involved in instruction set

Instruction Set Architecture (ISA)

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

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

William Stallings Computer Organization and Architecture

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

COMPUTER HARDWARE. Instruction Set Architecture

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

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

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

EC 413 Computer Organization

Chapter 5. A Closer Look at Instruction Set Architectures

Chapter 17. Microprogrammed Control. Yonsei University

Lecture 4: Instruction Set Architecture

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

Chapter 2A Instructions: Language of the Computer

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

Assembly Language Design

Chapter 4. MARIE: An Introduction to a Simple Computer

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

Announcement. Computer Architecture (CSC-3501) Lecture 25 (24 April 2008) Chapter 9 Objectives. 9.2 RISC Machines

Chapter 13 Reduced Instruction Set Computers

Instruction Set Architecture. "Speaking with the computer"

CN310 Microprocessor Systems Design

COMPUTER ORGANIZATION & ARCHITECTURE

CS401 - Computer Architecture and Assembly Language Programming Glossary By

CHAPTER 8: Central Processing Unit (CPU)

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

MARIE: An Introduction to a Simple Computer

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

Chapter 3 : Control Unit

Real instruction set architectures. Part 2: a representative sample

Instructions: Language of the Computer

Chapter 4. MARIE: An Introduction to a Simple Computer 4.8 MARIE 4.8 MARIE A Discussion on Decoding

Computer Organisation CS303

Computer Architecture. The Language of the Machine

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Typical Processor Execution Cycle

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

Computer Architecture 1 ح 303

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

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

CC312: Computer Organization

Chapter 5. A Closer Look at Instruction Set Architectures

Instruction Set Architectures. CS301 Prof. Szajda

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

William Stallings Computer Organization and Architecture. Chapter 12 Reduced Instruction Set Computers

Chapter 4. Chapter 4 Objectives. MARIE: An Introduction to a Simple Computer

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

INSTRUCTION SET ARCHITECTURE

CS4617 Computer Architecture

STRUCTURE OF DESKTOP COMPUTERS

DC57 COMPUTER ORGANIZATION JUNE 2013

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

Reminder: tutorials start next week!

Introduction. 3 major parts of CPU : Fig Design Examples of simple CPU. In this chapter : Chap. 8. Chap. 8 Central Processing Unit

ECE 486/586. Computer Architecture. Lecture # 7

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 12 Processor Structure and Function

Transcription:

Computer Organization CS 206 T Lec# 2: Instruction Sets

Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode RISC & CISC

1. What is an Instruction Set? The operation of the processor is determined by the instruction it executes, referred to as machine instructions or computer instructions The complete collection of different instructions that the processor can execute is referred to as the processor instruction set Machine language: binary representation of operations and (addresses of) arguments Assembly language: mnemonic representation for humans, e.g., OP A,B,C (meaning A <- OP(B,C))

2. Elements of an Instruction Operation code (opcode): specifies the operation to be performed (binary code) Do this: ADD, SUB, MPY, DIV, LOAD, STOR Source operand reference: the operation may involve one or more source operand as input for the operation. To this: (address of) argument of op, e.g. register, memory location

2. Elements of an Instruction Result operand reference: the operation may produce a result. Put the result here (as above) Next instruction reference (often implicit): this tells the processor where to fetch the next instruction after complete the current one (in most cases the next instruction is immediately follow the current one). When you have done that, do this: BR

Instruction Cycle State Diagram

3. Instruction Formats An instruction format defines the layout of the bits of an instruction. An instruction format must include an opcode and, implicitly or explicitly, zero or operands. The format must implicitly or explicitly, indicate the addressing mode for each operand. Usually more than one instruction format in an instruction set

A simple Instruction Format (using two addresses)

3.1 Instruction Representation Each instruction is represented by a sequenced of bits. The instruction is divided into fields according to the constituent elements of the instruction.

3.2Instruction Length Affected by and affects: Memory size Memory organization - addressing Bus structure, e.g., width CPU complexity CPU speed Trade off between powerful instruction repertoire and saving space

4. Instruction Types Data transfer: registers, main memory, stack or I/O Data processing: arithmetic, logical Control: systems control, transfer of control Data Movement: I/O instruction.

5. Types of Operations The number of different opcodes varies widely from machine to machine. However, the same general types of operations are found on all machines.

5.1 Data Transfer Store, load, exchange, move, clear, set, push, pop Specifies: source and destination (memory, register, stack), amount of data May be different instructions for different (size, location) movements, e.g., IBM S/390: L (32 bit word, R<-M), LH (halfword, R<-M), LR (word, R<-R), plus floatingpoint registers LER, LE, LDR, LD Or one instruction and different addresses, e.g. VAX: MOV

5.2 Input/Output May be specific instructions, e.g. INPUT, OUTPUT (issue command to I/O module May be done using data movement instructions (memory mapped I/O) May be done by a separate controller (DMA): Start I/O, Test I/O

5.3 Arithmetic Add, Subtract, Multiply, Divide for signed integer (+ floating point and packed decimal) may involve data movement May include Absolute ( a ) Increment (a++) Decrement (a--) Negate (-a)

5.4 Logical Bitwise operations: AND, OR, NOT, XOR, TEST, CMP, SET Shifting and rotating functions, e.g. logical right shift for unpacking: send 8-bit character from 16-bit word arithmetic right shift: division and truncation for odd numbers arithmetic left shift: multiplication without overflow

5.5 Transfer of Control Update program counter Skip, e.g., increment and skip if zero: ISZ Reg1, cf. jumping out from loop, return, execute.

6. Types of Operand Addresses: immediate, direct, indirect, stack Numbers: integer or fixed point (binary, twos complement), floating point (sign, significand, exponent), (packed) decimal (246 = 0000 0010 0100 0110) Characters: ASCII (128 printable and control characters + bit for error detection) Logical Data: bits or flags, e.g., Boolean 0 and 1

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

8.1 Immediate Addressing Operand is part of instruction Operand = address field e.g., ADD #5 Add 5 to contents of accumulator 5 is operand No memory reference to fetch data Fast Limited range

8.2 Direct Addressing Address field contains address of operand Effective address (EA) = address field (A) e.g., ADD A Add contents of cell A to accumulator Look in memory at address A for operand Single memory reference to access data No additional calculations needed to work out effective address Limited address space (length of address field)

Direct Addressing Diagram Opcode Instruction Address A Memory Operand

8.3 Indirect Addressing (1) Memory cell pointed to by address field contains the address of the operand EA = (A) Look in A, find effective address and look there for operand E.g. ADD (A) Add content of cell pointed to by content of A to accumulator

Indirect Addressing (2) Large address space 2 n where n = word length May be nested, multilevel, cascaded e.g. EA = (((A))) Multiple memory accesses to find operand Hence slower

Indirect Addressing Diagram Instruction Opcode Address A Memory Pointer to operand Operand

8.4 Register Addressing (1) Operand is held in register named in address field EA = R Limited number of registers Very small address field needed Shorter instructions Faster fetch

Register Addressing (2) No memory access Very fast execution Very limited address space Multiple registers helps performance Requires good assembly programming or compiler writing see register renaming cf. direct addressing

Register Addressing Diagram Opcode Instruction Register Address R Registers Operand

8.5 Register Indirect Addressing Cf. indirect addressing EA = (R) Operand is in memory cell pointed to by contents of register R Large address space (2 n ) One fewer memory access than indirect addressing

Register Indirect Addressing Diagram Opcode Instruction Register Address R Memory Registers Pointer to Operand Operand

8.6 Displacement Addressing EA = A + (R) Address field holds two values A = base value R = register that holds displacement or vice versa See segmentation

Displacement Addressing Diagram Opcode Register R Instruction Address A Memory Registers Displacement + Operand

Instruction Set Architecture (ISA) CISC is an acronym for complex instruction set computer. E.g. x86 family RISC stands for reduced instruction set computer, e.g. Pentium and MIPS

RISC Reduced Instruction Set Computer Key features Large number of general purpose registers (or use of compiler technology to optimize register use) Limited and simple instruction set Emphasis on optimising the instruction pipeline

RISC Characteristics One instruction per cycle Register to register operations Few, simple addressing modes Few, simple instruction formats Also Hardwired design (no microcode) Fixed instruction format But More compile time/effort

9.2 RISC Machines The underlying philosophy of RISC machines is that a system is better able to manage program execution when the program consists of only a few different instructions that are the same length and require the same number of clock cycles to decode and execute. RISC systems access memory only with explicit load and store instructions. In CISC systems, many different kinds of instructions access memory, making instruction length variable and fetch-decode-execute time unpredictable. 36

9.2 RISC Machines The difference between CISC and RISC becomes evident through the basic computer performance equation: RISC systems shorten execution time by reducing the clock cycles per instruction. CISC systems improve performance by reducing the number of instructions per program. 37

9.2 RISC Machines It is becoming increasingly difficult to distinguish RISC architectures from CISC architectures. Some RISC systems provide more extravagant instruction sets than some CISC systems. Some systems combine both approaches. The following two slides summarize the characteristics that traditionally typify the differences between these two architectures. 38

9.2 RISC Machines RISC Multiple register sets. Three operands per instruction. Parameter passing through register windows. Single-cycle instructions. Hardwired control. Highly pipelined. Continued... CISC Single register set. One or two register operands per instruction. Parameter passing through memory. Multiple cycle instructions. Microprogrammed control. Less pipelined. 39

9.2 RISC Machines RISC Simple instructions, few in number. Fixed length instructions. Complexity in compiler. Only LOAD/STORE instructions access memory. Few addressing modes. CISC Many complex instructions. Variable length instructions. Complexity in microcode. Many instructions can access memory. Many addressing modes. 40

End of Slides Chapter 10: Instruction Sets: Characteristics and Functions Addressing Modes. Chapter 11: Instruction Sets: Addressing Modes and Format. Chapter 13: Reduced Instruction Set Computers (RISC).