Outline. What Makes a Good ISA? Programmability. Implementability

Similar documents
Outline. What Makes a Good ISA? Programmability. Implementability. Programmability Easy to express programs efficiently?

Review: Procedure Call and Return

Systems Architecture I

Chapter 2: Instructions How we talk to the computer

Forecast. Instructions (354 Review) Basics. Basics. Instruction set architecture (ISA) is its vocabulary. Instructions are the words of a computer

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

Aspects of ISAs. Aspects of ISAs. Instruction Length and Format. The Sequential Model. Operations and Datatypes. Example Instruction Encodings

Computer Systems Laboratory Sungkyunkwan University

CIS 371 Computer Organization and Design

History of the Intel 80x86

Instruction Set Principles. (Appendix B)

Instruction Set Architectures. Part 1

Lecture 4: Instruction Set Architecture

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

Virtual Machines and Dynamic Translation: Implementing ISAs in Software

Instruction Set Architecture. "Speaking with the computer"

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit

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

ECE 486/586. Computer Architecture. Lecture # 8

Advanced Computer Architecture

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

Lecture 3: Instruction Set Architecture

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

EJEMPLOS DE ARQUITECTURAS

Review of instruction set architectures

RISC, CISC, and ISA Variations

Computer Architecture

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

RISC Principles. Introduction

Computer Architecture

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

ECE/CS 552: Introduction To Computer Architecture 1. Instructor:Mikko H. Lipasti. University of Wisconsin-Madison. Basics Registers and ALU ops

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2014, 1/17/2014

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

Unit 2: Instruction Set Architectures

EC-801 Advanced Computer Architecture

Computer System Architecture

CSE 533: Advanced Computer Architectures Instructor: Gürhan Küçük. Instructions. Instructions cont d. Forecast. Basics. Basics

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

An Overview of ISA (Instruction Set Architecture)

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

Hakim Weatherspoon CS 3410 Computer Science Cornell University

CHAPTER 5 A Closer Look at Instruction Set Architectures

Introduction to Machine/Assembler Language

CHAPTER 5 A Closer Look at Instruction Set Architectures

Memory Models. Registers

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

Homework. Reading. Machine Projects. Labs. Exam Next Class. None (Finish all previous reading assignments) Continue with MP5

RISC I from Berkeley. 44k Transistors 1Mhz 77mm^2

Instruction Set Architectures

Real instruction set architectures. Part 2: a representative sample

Lecture 4: Instruction Set Design/Pipelining

COSC 6385 Computer Architecture. Instruction Set Architectures

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

Communicating with People (2.8)

Instruction Set Architectures

Instruction Set Principles and Examples. Appendix B

COMPUTER ORGANIZATION & ARCHITECTURE

Complex Instruction Sets

Instruction Set Architectures

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

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

CS241 Computer Organization Spring Introduction to Assembly

administrivia final hour exam next Wednesday covers assembly language like hw and worksheets

Chapter 13 Reduced Instruction Set Computers

Lecture 4: RISC Computers

Lecture 40 - x86 Architecture. www-inst.eecs.berkeley.edu/~cs61c/

Big Picture (and Review)

EC 413 Computer Organization

CS429: Computer Organization and Architecture

CSEE 3827: Fundamentals of Computer Systems

ECE/CS 250 Computer Architecture. Summer 2016

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

Instruction Set Architecture (ISA)

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.)

Introduction to IA-32. Jo, Heeseung

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

Instruction Set Architectures

Alternate definition: Instruction Set Architecture (ISA) What is Computer Architecture? Computer Organization. Computer structure: Von Neumann model

Lecture 4: RISC Computers

INTRODUCTION TO IA-32. Jo, Heeseung

Complex Instruction Set Computer (CISC)

CISC Attributes. E.g. Pentium is considered a modern CISC processor

Instruction Set Architecture

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

INTEL Architectures GOPALAKRISHNAN IYER FALL 2009 ELEC : Computer Architecture and Design

Module 3 Instruction Set Architecture (ISA)

CS3350B Computer Architecture MIPS Instruction Representation

Typical Processor Execution Cycle

The Instruction Set. Chapter 5

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

Processor Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

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

administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions?

Review: What is a Computer?

Last Time: Floating Point. Intel x86 Processors. Lecture 4: Machine Basics Computer Architecture and Systems Programming ( )

Computer Organization CS 206 T Lec# 2: Instruction Sets

Transcription:

Outline Instruction Sets in General MIPS Assembly Programming Other Instruction Sets Goals of ISA Design RISC vs. CISC Intel x86 (IA-32) What Makes a Good ISA? Programmability Easy to express programs efficiently? Implementability Easy to design high-performance implementations (i.e., microarchitectures)? Compatibility Easy to maintain programmability as languages and programs evolve? Easy to maintain implementability as technology evolves? 66 67 Programmability Implementability Easy to express programs efficiently? For whom? Human Want high-level coarse-grain instructions As similar to HLL as possible This is the way ISAs were pre-1985 Compilers were terrible, most code was hand-assembled Compiler Want low-level fine-grain instructions Compiler can t tell if two high-level idioms match exactly or not This is the way most post-1985 ISAs are Optimizing compilers generate much better code than humans ICQ: Why are compilers better than humans? Every ISA can be implemented But not every ISA can be implemented well Bad ISA bad microarchitecture (slow, power-hungry, etc.) We d like to use some of these high-performance implementation techniques Pipelining, parallel execution, out-of-order execution We ll discuss these later in the semester Certain ISA features make these difficult Variable length instructions Implicit state Variable formats Coarse granularity 68 69

Compatibility Few people buy new hardware if it means they have to buy new software, too Intel was the first company to realize this ISA must stay stable, no matter what (microarch. can change) x86 is one of the ugliest ISAs EVER, but survives Intel then forgot this lesson: IA-64 (Itanium) is new ISA Backward compatibility: very important New processors must support old programs (can t drop features) Forward (upward) compatibility: less important Old processors must support new programs New processors only re-define opcodes that trapped in old ones Old processors emulate new instructions in low-level software Can also be used to ensure backwards compatibility RISC vs. CISC RISC: reduced-instruction set computer Coined by P+H in early 80 s (ideas originated earlier) CISC: complex-instruction set computer Not coined by anyone, term didn t exist before RISC Religious war (one of several) started in mid 1980 s RISC (MIPS, Alpha) won the technology battles CISC (IA32 = x86) won the commercial war Compatibility a stronger force than anyone (but Intel) thought Intel beat RISC at its own game more on this soon 70 71 The Setup The RISC Tenets Pre-1980 Bad compilers Complex, high-level ISAs Slow, complicated, multi-chip microarchitectures Around 1982 Advances in VLSI made single-chip microprocessor possible Speed by integration, on-chip wires much faster than off-chip but only for very small, very simple ISAs Compilers had to get involved in a big way RISC manifesto: create ISAs that Simplify single-chip implementation Facilitate optimizing compilation Single-cycle execution CISC: many multi-cycle ops Hardwired control CISC: microcode Load/store architecture Summary (1) Make it easy to implement in hardware (2) Make it easy for compiler to generate code CISC: register-memory and memory-memory instructions Few memory addressing modes CISC: many modes Fixed instruction format CISC: many formats and lengths Reliance on compiler optimizations CISC: hand assemble to get good performance 72 73

PowerPC ISA RISC-y, very similar to MIPS Some differences: Indexed addressing mode (register+register) lw $t1,$a0,$s3 # $t1 = mem[$a0+$s3] Update addressing mode lw $t1,4($a0) # $t1 = mem[$a0+4]; $a0 += 4; Dedicated counter register bc loop # ctr--; branch to loop if ctr!= 0 In general, though, similar to MIPS Intel 80x86 ISA (aka x86 or IA-32 now) Binary compatibility across generations 1978: 8086, 16-bit, registers have dedicated uses 1980: 8087, added floating point (stack) 1982: 80286, 24-bit 1985: 80386, 32-bit, new instrs GPR almost 1989-95: 80486, Pentium, Pentium II 1997: Added MMX instructions (for graphics) 1999: Pentium III 2002: Pentium 4 2004: Nocona 64-bit extension (to keep up with AMD) 2006: Core 2 74 75 Intel x86: The Penultimate CISC 80x86 Registers and Addressing Modes DEC VAX was ultimate CISC, but x86 (IA-32) is close Variable length instructions: 1-16 bytes Few registers: 8 and each one has a special purpose Multiple register sizes: 8,16,32 bit (for backward compatibility) Accumulators for integer instrs, and stack for FP instrs Multiple addressing modes: indirect, scaled, displacement Register-register, memory-register, and memory-register insns Condition codes Instructions for memory stack management (push, pop) Instructions for manipulating strings (entire loop in one instruction) Summary: yuck! Eight 32-bit registers (not truly general purpose) EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI Six 16-bit Registers for code, stack, & data 2-address ISA One operand is both source and destination NOT a Load/Store ISA One operand can be in memory 76 77

80x86 Addressing Modes Register Indirect mem[reg] not ESP or EBP register Base + displacement (8 or 32 bit) mem[reg + const] not ESP or EBP Base + scaled index mem[reg + (2 scale x index)] scale = 0,1,2,3 base any GPR, index not ESP Base + scaled index + displacement mem[reg + (2 scale x index) + displacement] scale = 0,1,2,3 base any GPR, index not ESP Condition Codes Both PowerPC and x86 ISA have condition codes Special HW register that has values set as side effect of instruction execution Example conditions Zero Negative Example use subi $t0, $t0, 1 bz loop 78 79 80x86 Instruction Encoding Decoding x86 Instructions Variable size 1-byte to 17-bytes Jump (JE) 2-bytes Push 1-byte Add Immediate 5-bytes W bit says 32-bits or 8-bits D bit indicates direction memory reg or reg memory movw EBX, [EDI + 45] movw [EDI + 45], EBX Is a &$%!# nightmare! Instruction length is variable from 1 to 17 bytes Prefixes, postfixes Crazy formats register specifiers move around But key instructions not terrible Yet, everything must work correctly 80 81

How Intel Won Anyway x86 won because it was the first 16-bit chip by 2 years IBM put it into its PCs because there was no competing choice Rest is historical inertia and financial feedback X86 is most difficult ISA to implement and do it fast but Because Intel (and AMD) sells the most processors It has the most money Which it uses to hire more and better engineers Which it uses to maintain competitive performance And given equal performance compatibility wins So Intel (and AMD) sells the most processors Moore s law has helped Intel in a big way Most engineering problems can be solved with more transistors Current Approach: Pentium Pro and beyond Instruction decode logic translates into μops Fixed-size instructions moving down execution path Execution units see only μops + Faster instruction processing with backward compatibility + Execution unit as fast as RISC machines like MIPS Complex decoding We work with MIPS to keep decoding simple/clean Learn x86 on the job! Learn exactly how this all works in ECE 252 82 83 Aside: Complex Instructions Concluding Remarks More powerful instructions not necessarily faster execution E.g., string copy or polynomial evaluation Option 1: use repeat prefix on memory-memory move inst Custom string copy Option 2: use a loop of loads and stores through registers General purpose move through simple instructions Option 2 is faster on same machine, e.g., Pentium III 1. Keep it simple and regular Uniform length instructions Fields always in same places 2. Keep it simple and fast Small number of registers 3. Make sure design can be pipelined (will learn soon) 4. Make the common case fast Compromises inevitable there is no perfect ISA 84 85

Outline Instruction Sets in General MIPS Assembly Programming Other Instruction Sets 86