Instruction Sets Ch 9-10

Similar documents
Instruction Sets Ch 9-10

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

Instruction Set Principles and Examples. Appendix B

Lecture 4: Instruction Set Architecture

17. Instruction Sets: Characteristics and Functions

COMPUTER ORGANIZATION & ARCHITECTURE

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?

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

Instruction Sets: Characteristics and Functions Addressing Modes

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

Lecture 6: Instruction sets

CSCE 5610: Computer Architecture

EC-801 Advanced Computer Architecture

CS4617 Computer Architecture

Instruction Set Architecture. "Speaking with the computer"

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

Instruction Set Design

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

Computer Organization CS 206 T Lec# 2: Instruction Sets

Instruction Set Architecture (ISA)

COSC 6385 Computer Architecture. Instruction Set Architectures

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

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

Graduate Computer Architecture. Chapter 2. Instruction Set Principles

Instruction Set (ISA) Design and Addressing Modes

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

CPU Architecture and Instruction Sets Chapter 1

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

Reminder: tutorials start next week!

ECE 486/586. Computer Architecture. Lecture # 7

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

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

Instruction Set Architecture

Chapter 13 Reduced Instruction Set Computers

Lecture 4: Instruction Set Design/Pipelining

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

Lecture 4: Instruction Set Architectures. Review: latency vs. throughput

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

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

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

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

CS/ECE/752 Chapter 2 Instruction Sets Instructor: Prof. Wood

2. ADDRESSING METHODS

Chapter 2. Instruction Set Design. Computer Architectures. software. hardware. Which is easier to change/design??? Tien-Fu Chen

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

Computer Organization

RISC Architecture Ch 12

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Instruction Set Principles. (Appendix B)

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

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

Micro-programmed Control Ch 15

Micro-programmed Control Ch 17

Machine Instructions vs. Micro-instructions. Micro-programmed Control Ch 15. Machine Instructions vs. Micro-instructions (2) Hardwired Control (4)

Micro-programmed Control Ch 15

Instruction Set Architectures

Hardwired Control (4) Micro-programmed Control Ch 17. Micro-programmed Control (3) Machine Instructions vs. Micro-instructions

ISA: The Hardware Software Interface

General Purpose Processors

Lecture 3: Instruction Set Architecture

CA226 Advanced Computer Architecture

Lecture 5: Instruction Set Architectures II. Take QUIZ 2 before 11:59pm today over Chapter 1 Quiz 1: 100% - 29; 80% - 25; 60% - 17; 40% - 3

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

The MIPS Instruction Set Architecture

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

Introduction to Computers & Programming

Understand the factors involved in instruction set

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

CPE300: Digital System Architecture and Design

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

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

COS 140: Foundations of Computer Science

Instruction Set Architectures. Part 1

INSTRUCTION SET ARCHITECTURE

Emulation. Michael Jantz

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

CMSC Computer Architecture Lecture 2: ISA. Prof. Yanjing Li Department of Computer Science University of Chicago

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

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

Chapter 5. A Closer Look at Instruction Set Architectures

Superscalar Processors Ch 13. Superscalar Processing (5) Computer Organization II 10/10/2001. New dependency for superscalar case? (8) Name dependency

CPE300: Digital System Architecture and Design

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

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

From CISC to RISC. CISC Creates the Anti CISC Revolution. RISC "Philosophy" CISC Limitations

Review: What is a Computer?

Typical Processor Execution Cycle

Assembly Language Design

Chapter 2: Instructions How we talk to the computer

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

Instructions: Language of the Computer

Lecture 4: RISC Computers

Chapter 2. Instruction Set Principles and Examples. In-Cheol Park Dept. of EE, KAIST

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

CHAPTER 5 A Closer Look at Instruction Set Architectures

CHAPTER 2: INSTRUCTION SET PRINCIPLES. Prepared by Mdm Rohaya binti Abu Hassan

Instruction Set Architecture

Transcription:

Instruction Sets Ch 9-10 Characteristics Operands Operations Addressing Instruction Formats 1 Instruction Set (käskykanta) Collection of instructions that CPU understands Only interface to CPU from outside CPU executes a program CPU executes given instructions one at a time fetch-execute cycle Fig. 9.1 2 Chapters 9-10, Instruction Sets 1

Opcode Machine Instruction Fig. 9.1 What should I do? Math? Move? Jump? Source operand references Where is the data to work on? Reg? Memory? Result operand reference Where should I put the result? Reg? Memory? Next instruction reference Where is the next instruction? Default? Jump? 3 Instruction Representation Bit presentation: binary program Assembly language symbolic program 0x2465A080 Opcode, operands LOAD R1,=0x6678 Symbolic opcode Symbolic assembly language LOAD R1,TotalSum Fig. 9.11 Symbolic value? Virtual or physical address? 4 Chapters 9-10, Instruction Sets 2

Instruction Set Design (5) Operation types (operaatiotyyppi) How many? What type? Simple? Complex? Data types (tietotyyppi) Just a few? Many? Instruction format (käskyn muoto) fixed length? Varying length? Nr of operands? Number of addressable registers too many too long instructions? too few too hard to optimise code? Addressing (tiedon osoitus) What modes to use to address data and when? 5 Good Instruction Set (2) Good target to compiler Easy to compile? Possible to compile code that runs fast? Easy to compile code that runs fast? Allows fast execution of programs How many meaningless instructions per second? MIPS? GFLOPS? How fast does my program run? Solve linear system of 1000 variables? Set of data base queries? Connect a phone call in reasonable time? 6 Chapters 9-10, Instruction Sets 3

Good Instruction Set (contd) (5) Beautiful & Aesthetic Orthogonal (ortogonaalinen) Simple, no special registers, no special cases, any data type or addressing mode can be used with any instruction (täydellinen) Lots of operations, good for all applications (säännöllinen) Specific instruction field has always same meaning Complete Regular Streamlined (virtaviivainen) Easy to define what resources are used 7 Good Instruction Set (contd) (2) Easy to implement 18 months vs. 36 months? Who will be 1 st in market? Who will get development monies back and who will not? Scalability Speed up clock speed 10X, does it work? Double address length, does design extend? E.g., 32 bits 64 bits 128 bits? (skaalautuva) 8 Chapters 9-10, Instruction Sets 4

Number of Operands? (4) 3? ADD A,B,C Normal case now 2? 1 operand and result the same 1? ADD A 1 operand and result in implicit accumulator 0? All operands and ADD 54 result in implicit stack Mem(A) mem(b) + mem(c) ADD R1, R2, R3 r1 r2+r3 ADD R1, R2 r1 r1+r2 acc acc+mem(a) 33 22... 87 22... 9 Instruction Set Architecture (ISA) Basic Classes Accumulator Stack General Purpose Register only one type of registers, good for all 2 or 3 operands Load/Store only load/store instructions access memory 3 operand ALU instructions LOAD R3, C LOAD R2,B ADD R1,R2,R3 STORE R1,A 10 Chapters 9-10, Instruction Sets 5

Big vs. Little Endian (3) How are multi-byte values stored 0x1200: Word address 0x1200 0x1201 0x1202 0x1203 Store 0x11223344?? Byte addresses Big-Endian: most sign. byte has smallest address Little-Endian: least sign. byte has smallest address 0x11 0x22 0x33 0x44 0x1200 0x1201 0x1202 0x1203 0x44 0x33 0x22 0x11 11 Big vs. Little Endian Address of multi-byte data items is the same in both representations Only internal byte order varies Must decide one way or the other Math circuits must know which presentation used Little-Endian may be faster. Must consider when moving data via network Power-PC: bi-endian - both modes at use can change it per process basis kernel mode selected separately 12 Chapters 9-10, Instruction Sets 6

Data (Operands, Result) Location Register acc r2, r8 close, fast register stack f4, f15 limited number of them need to load/store values from/to memory sometimes (often) Big problem! 50% of compiler time to decide register allocation problem Memory far away memory stack (hw regs have mem addresses) only possibility for large data sets vectors, arrays, sets, tables, objects,... 0x345670 13 Aligned Data (4) 2 byte (16-bit) half-word has byte address: 0010 10010 4 byte (32-bit) word has byte address: 0010 10100 8 byte (64-bit) doubleword has byte address: 0010 11000 Aligned data faster memory access 32-bit data loaded as one memory load Non-aligned data saves mem, more bus traffic! 11 22 33 44 11 22 33 44 32-bit non-aligned data requires 2 memory loads (each 4 bytes) and combining data into one 32-bit data item 14 Chapters 9-10, Instruction Sets 7

Data Types (8) Address Integer 16b, 32b, 64b? Floating point Decimal Character String Logical data Vector, array, record,. 16b, 32b, 64b, 128b? 32b, 64b, 80b? 18 digits (9 bytes) packed decimal? 1 byte = 8b IRA = ASCII, EBCDIC? finite, arbitrary length? 1 bit (Boolean value, bit field)? 15 Size of Operand 1 word, 32 bits 2 words, 64 bits 4 words, 128 bits 1 byte (8 bits) 2 bytes 1 bit int, float, addr double float, addr addr char short int logical values 16 Chapters 9-10, Instruction Sets 8

Pentium II Data Types General data types 8-bit byte 16-bit word 32-bit doubleword 64-bit quadword Not aligned Little Endian Specific data types Numerical data types Table 9.2 Figure 9.4 17 Operation Types Data transfer CPU memory ALU operations INT, FLOAT, BOOLEAN, SHIFT, CONVERSION I/O read from device, start I/O operation Transfer of control jump, branch, call, return, IRET, NOP System control Table 9.3 HALT, SYSENTER, SYSEXIT, Table 9.4 CPUID returns current HW configuration size of L1 & L2 caches, etc 18 Chapters 9-10, Instruction Sets 9

Data References (2) Where is data? in memory in registers in instruction itself How to refer to data? various addressing modes multi-phase data access how is data location determined (addressing mode) compute data address (register? effective address?) access data 19 20 Chapters 9-10, Instruction Sets 10

Addressing Modes (Ch 10) Immediate Direct Indirect Register Register Indirect Displacement Stack Fig. 10.1 Table. 10.1 Data in instruction Memory address of data in instruction Address of memory address of data in instruction (pointer) Data in register (best case?) Register has memory address (pointer) Addr = reg value + constant Data is stack pointed by some register 21 Displacement Address Effective address = (R1) + A Contents of R1 Constant from instruction Constant is often small (8 bits, 16 bits?) Many uses JUMP -40(PC) PC relative Base register address CALL Summation(BX) Array index ADDF F2, F2, Table(R5) Record field MUL F4, F6, Salary(R8) Stack references STORE F2, -4(FP) 22 Chapters 9-10, Instruction Sets 11

More Addressing Modes Autoincrement E.g., R pointer to an array Autodecrement E.g., R pointer to an array Autoincrement deferred E.g., R pointer to an array of pointers Scaled EA = (R), R (R) + S R (R) - S, EA = (R) size of operand EA = Mem(R), R (R) + S EA = A + (R j ) + (R i ) * S E.g., item (R i, R j ) in 2-dimensional array A[i,j] 23 Pentium II Addressing Modes Immediate 1, 2, 4 bytes Register operand 1, 2, 4, 8 byte registers not all registers with every instruction Operands in Memory Fig. 10.2 compute effective address and combine with segment register to get linear address (virtual address) Table 10.2 24 Chapters 9-10, Instruction Sets 12

Instruction Format (4) How to represent instructions in memory? How long instruction Descriptive or dense? Code size? Fast to load? In many parts? One operand description at a time? Fast to parse (I.e., split into logical components)? All instruction same size & same format? Very few formats? 25 Instruction Format (contd) (3) How many addressing modes? Fewer is better, but harder to compile to How many operands? 3 gives you more flexibility, but takes more space How many registers? 16 regs need 4 bits to name it 256 regs need 8 bits to name it need at least 16-32 for easy register allocation How many registers, that can be referenced in one instruction vs. referenced overall? 26 Chapters 9-10, Instruction Sets 13

Instruction Format (contd) (3) How many register sets? A way to use more registers without forcing long instructions for naming them One register set for each subroutine call? One for indexing, one for data? Address range, number of bits in displacement more is better, but it takes space Address granularity byte is better, but word address is shorter 27 Pentium II Instruction Set (5) CISC - Complex Instruction Set Computer At most one memory address Everything is optional Nothing is fixed Difficult to parse all latter fields and their interpretation depend on earlier fields Fig. 10.8 28 Chapters 9-10, Instruction Sets 14

Pentium II Instruction Prefix Bytes (4) Instruction prefix (optional) Fig. 10.8 (a) LOCK - exclusive use of shared memory REP - repeat instruction for string characters Segment override (optional) override default segment register default is implicit, no need to store it every instruction Address size (optional) use the other (16 or 32 bit) address size Operand size (optional) use the other (16 or 32 bit) operand size 29 Pentium II Instruction Fields (3) Opcode specific bit for byte size data Mod r/m (optional) data in reg (8) or in mem? which addressing mode of 24? can also specify opcode further for some opcodes SIB (optional) Scale/Index/Base extra field needed for some addressing modes scale for scaled indexing index register base register Fig. 10.8 (b) 30 Chapters 9-10, Instruction Sets 15

Pentium II Instruction Fields (contd) (2) Displacement (optional) for certain addressing modes 1, 2, or 4 bytes Immediate (optional) for certain addressing modes 1, 2, or 4 bytes Fig. 10.8 (b) 31 PowerPC Instruction Format (7) RISC - Reduced Instruction Set Computer Fixed length, just a few formats Fig. 10.9 Only load/store instructions access memory Only 2 addressing modes for data 32 general purpose registers can be used everywhere Fixed data size no string ops Simple branches CR-field determines which register to compare L-bit determines whether a subroutine call A-bit determines if branch is absolute or PC-relative 32 Chapters 9-10, Instruction Sets 16

-- End of Chapters 9-10: Instruction Sets -- (Hennnessy-Patterson, Computer Architecture, 2nd Ed, 1996) 33 Chapters 9-10, Instruction Sets 17