Instruction Set Principles. (Appendix B)

Similar documents
Review of instruction set architectures

CS654 Advanced Computer Architecture. Lec 1 - Introduction

Computer Architecture. MIPS Instruction Set Architecture

Systems Architecture I

Computer Architecture

Instruction Set Architectures

CS61CL Machine Structures. Lec 5 Instruction Set Architecture

Instruction Set Architecture (ISA)

Computer Architecture. The Language of the Machine

The MIPS Instruction Set Architecture

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC)

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

CS3350B Computer Architecture MIPS Instruction Representation

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

Lecture 4: Instruction Set Architecture

Computer Systems Laboratory Sungkyunkwan University

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

CENG3420 Lecture 03 Review

Instructions: Language of the Computer

Chapter 2A Instructions: Language of the Computer

Lecture Topics. Announcements. Today: The MIPS ISA (P&H ) Next: continued. Milestone #1 (due 1/26) Milestone #2 (due 2/2)

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers

MIPS Instruction Set

Instructions: Language of the Computer

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

EE108B Lecture 3. MIPS Assembly Language II

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

INSTRUCTION SET COMPARISONS

2.7 Supporting Procedures in hardware. Why procedures or functions? Procedure calls

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

B649 Graduate Computer Architecture. Lec 1 - Introduction

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

Lecture 3: Instruction Set Architecture

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

Course Administration

MIPS Reference Guide

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

MIPS Memory Access Instructions

Instruction Set Architecture. "Speaking with the computer"

MOTIVATION. B649 Parallel Architectures and Programming

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

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

Project Part A: Single Cycle Processor

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Communicating with People (2.8)

MIPS%Assembly% E155%

CS 4200/5200 Computer Architecture I

CS352H: Computer Systems Architecture

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

MACHINE LANGUAGE. To work with the machine, we need a translator.

ECE 486/586. Computer Architecture. Lecture # 7

ISA: The Hardware Software Interface

Reminder: tutorials start next week!

Midterm. Sticker winners: if you got >= 50 / 67

Mark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA

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

All instructions have 3 operands Operand order is fixed (destination first)

ECE 486/586. Computer Architecture. Lecture # 8

History of the Intel 80x86

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

Today s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA.

Lecture Topics. Branch Condition Options. Branch Conditions ECE 486/586. Computer Architecture. Lecture # 8. Instruction Set Principles.

Laboratory Exercise 6 Pipelined Processors 0.0

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

M2 Instruction Set Architecture

Computer Architecture

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

ECE468 Computer Organization & Architecture. MIPS Instruction Set Architecture

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

Concocting an Instruction Set

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

CPS311 - COMPUTER ORGANIZATION. A bit of history

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

Procedure Calling. Procedure Calling. Register Usage. 25 September CSE2021 Computer Organization

Computer Organization MIPS ISA

1 5. Addressing Modes COMP2611 Fall 2015 Instruction: Language of the Computer

CS3350B Computer Architecture

Instruction Set Principles and Examples. Appendix B

Outline. What Makes a Good ISA? Programmability. Implementability

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

RISC, CISC, and ISA Variations

Lecture 4: MIPS Instruction Set

EE 109 Unit 13 MIPS Instruction Set. Instruction Set Architecture (ISA) Components of an ISA INSTRUCTION SET OVERVIEW

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

ECE Exam I February 19 th, :00 pm 4:25pm

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

Assembly Language. Prof. Dr. Antônio Augusto Fröhlich. Sep 2006

Assembly Programming

Instructions: MIPS arithmetic. MIPS arithmetic. Chapter 3 : MIPS Downloaded from:

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

Transcription:

Instruction Set Principles (Appendix B)

Outline Introduction Classification of Instruction Set Architectures Addressing Modes Instruction Set Operations Type & Size of Operands Instruction Set Encoding Size of Register File CISC vs. RISC DLX Architecture EE 524 / CptS 561 2

Computer Architecture s Changing Definition 1950s to 1960s: Computer Architecture Course Computer Arithmetic 1970s to mid 1980s: Computer Architecture Course Instruction Set Design, especially ISA appropriate for compilers 1990s: Computer Architecture Course Design of CPU, memory system, I/O system, Multiprocessors 2000s: Computer Architecture Course Design of CPU (Performance & Power), Memory system, I/O, embedded systems, wireless, multi-core systems. EE 524 / CptS 561 3

Instruction Set Architecture (ISA) instruction set EE 524 / CptS 561 4

Interface Design (ISA) A good interface: Lasts through many implementations (portability, compatibility) Is used in many different ways (generality) Provides convenient functionality to higher levels Permits an efficient implementation at lower levels use use Interface imp 1 imp 2 time use imp 3 EE 524 / CptS 561 5

Evolution of Instruction Sets Single Accumulator (EDSAC 1950) Accumulator + Index Registers (Manchester Mark I, IBM 700 series 1953) Separation of Programming Model from Implementation High-level Language Based Concept of a Family (B5000 1963) (IBM 360 1964) General Purpose Register Machines Complex Instruction Sets Load/Store Architecture (VAX, Intel 432 1977-80) (CDC 6600, Cray 1 1963-76) RISC (Reduced Instruction Set Computer) (Mips,Sparc,HP-PA,IBM RS6000,...1987) EE 524 / CptS 561 6

Evolution of Instruction Sets Major advances in computer architecture are typically associated with landmark instruction set designs Ex: Stack vs GPR (System 360) Design decisions must take into account: technology machine organization programming languages compiler technology operating systems And they in turn influence these EE 524 / CptS 561 7

Classification of ISAs Stack Architecture Only data structure: Stack Accumulator Architecture Only one register: Accumulator General Purpose Register (GPR) Architecture Set or Registers (Register File) 3 sub-architectures: Reg-Reg (Load/Store) Reg-Mem or Mem-Reg Mem-Mem EE 524 / CptS 561 8

Operand location for ISAs EE 524 / CptS 561 9

Example: MIPS r0 r1 r31 PC lo hi 0 Programmable storage Data types? 2^32 x bytes Format? 31 x 32-bit GPRs (R0=0) Addressing Modes? 32 x 32-bit FP regs (paired DP) HI, LO, PC Arithmetic logical Add, AddU, Sub, SubU, And, Or, Xor, Nor, SLT, SLTU, AddI, AddIU, SLTI, SLTIU, AndI, OrI, XorI, LUI SLL, SRL, SRA, SLLV, SRLV, SRAV Memory Access LB, LBU, LH, LHU, LW, LWL,LWR SB, SH, SW, SWL, SWR Control 32-bit instructions on word boundary J, JAL, JR, JALR BEq, BNE, BLEZ,BGTZ,BLTZ,BGEZ,BLTZAL,BGEZAL EE 524 / CptS 561 10

Data Format / Alignment Data formats: Bytes, Half words, words and double words Some issues Byte addressing Big Endian 0 1 2 3 vs. Little Endian 3 2 1 0 Word alignment Suppose the memory is organized in 32-bit words. Can a word address begin only at 0, 4, 8,...? 0 1 2 3 4 5 6 7 EE 524 / CptS 561 11

Instruction Types Need to decode type before rest of fields Can decode all types in parallel and select after decoding type, but this is costly if more than a few types If type specifies execution unit, then can pipeline (dispatch then decode) EE 524 / CptS 561 12

How many types? 2 (1 bit) forces unrelated operations into the same type 4 (2 bits) corresponds to arithmetic, load/store, jump, other (w/ subtypes) 8 (3 bits) can add FP/ integer, jump/ branch, immediate types More bits in type = fewer other bits EE 524 / CptS 561 13

Intel Operands / Instructions 8, 16, 32, 48, 64, or 80 bits Strings One byte to 12 bytes First byte(s) contains opcode, mode, register fields Later bytes contain addresses or immediate values EE 524 / CptS 561 14

Instruction Set Encoding Instructions generally contain: Instruction type Address(es) of operand(s) or target Operation code One type may have immediate data EE 524 / CptS 561 15

Variety of Instruction Formats Two address formats: the destination is same as one of the operand sources (Reg x Reg) to Reg R I (R I ) + (R J ) (Reg x Mem) to Reg R I (R I ) + M[x] x could be specified directly or via a register; effective address calculation for x could include index, indirect, Three operand formats: One destination and up to two operand sources per instruction (Reg x Reg) to Reg R I (R J ) + (R K ) (Reg x Mem) to Reg R I (R J ) + M[x] many different possible formats! EE 524 / CptS 561 16

Some Problems Should all addressing modes be provided for every operand? regular vs. irregular instruction formats Separate instructions to manipulate Accumulators Index registers Base registers A large number of instructions Instructions contained implicit memory references several contained more than one very complex control EE 524 / CptS 561 17

Variable Length Instructions Make it difficult to decouple memory fetches Fetch part, then decide whether to fetch more, and maybe miss in cache before instruction is completed. Fixed length allows full instruction to be fetched in one access EE 524 / CptS 561 18

Impact of Increasing Register Count Reduces memory references Increases instruction word size Greater demand on compiler to schedule registers Increases cost (time) for context switching EE 524 / CptS 561 19

Necessary Registers Stack machines (0- address) use none Accumulator machines (1- address) use 1 Register bank machines (2- address or 3- address) use N Memory- memory machines (3- address) need 0, use N EE 524 / CptS 561 20

Sufficient Registers Most arithmetic expressions can fit in 8 registers 16 are almost always enough for a basic block or function body More than 16 enables interprocedural register scheduling EE 524 / CptS 561 21

Evolution of Register Sets Early machines could afford just one register (accumulator) Added specialized registers (accumulator extension, index, etc.) Specialized registers cost as much as any register, but limited in use More efficient to make registers general purpose, simpler scheduling EE 524 / CptS 561 22

Scalability of General Registers Adding more alters instruction set in a straightforward manner Much harder to scale up specialized registers General registers lead to orthogonal and regular instruction sets EE 524 / CptS 561 23

Inevitable Special Cases Program counter Configuration Program status etc. Sometimes accessed by special instructions Sometimes mapped to GP registers EE 524 / CptS 561 24

Intel x86 (IA32) EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP (general purpose) First four can be 16 or 32 bits, lower 16 bits are divided into named bytes CS, SS, DS, ES, FS, GS (segment) Instruction pointer (16/ 32) Flags EE 524 / CptS 561 25

Intel x86 (IA32) Other Control registers CR0 - CR4 Floating point R0 - R7 (80 bits) FP Control, Status (16 bits each) Tag word (2 bits/ FP reg: 16 total) FP Instruction pointer (48 bits) FP Data pointer (48 bits) Debug D0 - D8, first 5 are breakpoint, other 4 control, status EE 524 / CptS 561 26

PowerPC General Purpose GPR0 - GPR31 Link (32 bits) Condition (32 bits) Count (32 bits) Exception (32 bits) Real- time clock (64 bits) Floating point FPR0 - FPR31 (64) FP status and control (32 bits) EE 524 / CptS 561 27

CISC vs. RISC First computers were RISC Cray supercomputers were RISC Complexity was added in the 70s and 80s Return to simplicity in 80 s and 90 s EE 524 / CptS 561 28

Why Return to RISC? CISC provides too many possibilities Compilers can t choose optimal encoding 70 instructions = 99% of code 50 instructions = 95% of code EE 524 / CptS 561 29

Why Did CISC Happen? Fetch- Execute cycle Limited memory Reduce fetches and memory by packing multiple ops into each instruction Observe common sequences of ops and turn them into instructions EE 524 / CptS 561 30

CISC Features Memory accesses and address arithmetic are tightly bound to instructions Rely on few registers, more memory references Note that memory hasn t kept pace with processor clock rate EE 524 / CptS 561 31

Reduced Instruction Set Computers (Cocke, IBM; Patterson, UC Berkeley; Hennessy, Stanford) Compilers have difficulty using complex instructions VAX: 60% of microcode for 20% of instructions, only responsible for 0.2% execution time IBM retargets 370 compiler to use ISA subset - generated code faster! Simple instruction sets do not need microcode Use fast memory near processor as cache, not microcode storage Design ISA for simple pipelined implementation Fixed length, fixed format instructions Load/store architecture with up to one memory access/instruction Few addressing modes, synthesize others with code sequence Register-register ALU operations Delayed branch EE 524 / CptS 561 32

Benefits of RISC Reduced CPI Reduced decoding delay Simpler core design enables more chip area to be used for performance But today, CISC architectures like Intel use a RISC core for a subset of instructions Why are RISC designs still faster? EE 524 / CptS 561 33

Code Expansion RISC does less with each instruction Large code size (1.3 to 1.6 X) Larger number of memory fetches Partly alleviated by larger cache Still generates more memory traffic than CISC Compressed instruction blocks? EE 524 / CptS 561 34

Common RISC Features Load/ Store designs Few addressing modes Fixed instruction size Few instruction formats Few operand sizes Use more registers, separate memory operations EE 524 / CptS 561 35

MIPS R2000 (One of first commercial RISCs, 1986) Load/Store architecture 32x32-bit GPR (R0 is wired), HI & LO SPR (for multiply/divide) 74 instructions Fixed instruction size (32 bits), only 3 formats PC-relative branches, register indirect jumps Only base+displacement addressing mode No condition bits, compares write GPRs, branches test GPRs Delayed loads and branches Five-stage instruction pipeline Fetch, Decode, Execute, Memory, Write Back CPI of 1 for register-to-register ALU instructions 8 MHz clock Tightly-coupled off-chip FP accelerator (R2010) EE 524 / CptS 561 36

RISC/CISC Comparisons R2000 vs VAX 8700 [Bhandarkar and Clark, 91] R2000 has ~2.7x advantage with equivalent technology Intel 80486 vs Intel i860 (both 1989) Same company, same CAD tools, same process i860 2-4x faster - even more on some floating-point tasks DEC nvax vs Alpha 21064 (both 1992) Same company, same CAD tools, same process Alpha 2-4x faster EE 524 / CptS 561 37

A "Typical" RISC 32-bit fixed format instruction (3 formats) 32 32-bit GPR (R0 contains zero, DP take pair) 3-address, reg-reg arithmetic instruction Single address mode for load/store: base + displacement no indirection Simple branch conditions Delayed branch See: SPARC, MIPS, HP PA-Risc, DEC Alpha, IBM PowerPC, CDC 6600, CDC 7600, Cray-1, Cray-2, Cray-3 EE 524 / CptS 561 38

Example: MIPS Register-Register 31 26 25 21 20 16 15 11 10 6 5 0 Op 31 26 25 21 20 16 15 0 Op Op Rs1 Register-Immediate Branch Op Rs2 Rs1 Rd immediate 31 26 25 0 target Rd Opx 31 26 25 21 20 16 15 0 Jump / Call Rs1 Rs2/Opx immediate EE 524 / CptS 561 39

Concluding Remarks ISA: GPR with Load/Store Addressing modes: Displacement (12 to 16 bits) Immediate (8 to 16 bits) Register deferred Instruction Set Operations: Load, store Arithmetic, logic, shift, compare Branch (PC-relative 8 bit), jump, call, return Type & Size of Operands: Integer 8, 16 and 32 bit Floating-point (IEEE 754) 32 and 64 bit EE 524 / CptS 561 40

Concluding Remarks (cont d) Instruction Set Encoding: Fixed encoding Hybrid encoding Size of Register File: At least 16 GP registers Separate integer (32 bit) and FP (64 bit) register files CISC vs. RISC: Pros. and cons Intel: typical CISC Alpha: typical RISC DLX Architecture EE 524 / CptS 561 41