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

Similar documents
Instruction Set Architectures

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

The von Neumann Machine

Assembly Language Each statement in an assembly language program consists of four parts or fields.

The von Neumann Machine

Instruction Set Architectures

Registers. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth

Binghamton University. CS-220 Spring x86 Assembler. Computer Systems: Sections

x86 Programming I CSE 351 Winter

Credits and Disclaimers

Instruction Set Architecture (ISA) Data Types

Introduction to Machine/Assembler Language

Assembly I: Basic Operations. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS 261 Fall Machine and Assembly Code. Data Movement and Arithmetic. Mike Lam, Professor

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

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

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

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

CS241 Computer Organization Spring 2015 IA

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

x86 64 Programming I CSE 351 Autumn 2018 Instructor: Justin Hsia

CS Bootcamp x86-64 Autumn 2015

How Software Executes

Machine/Assembler Language Putting It All Together

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Lecture 3: Instruction Set Architecture

Advanced Microprocessors

Hardware and Software Architecture. Chapter 2

Addressing Modes on the x86

EEM336 Microprocessors I. The Microprocessor and Its Architecture

MACHINE-LEVEL PROGRAMMING I: BASICS COMPUTER ARCHITECTURE AND ORGANIZATION

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Module 3 Instruction Set Architecture (ISA)

CS 16: Assembly Language Programming for the IBM PC and Compatibles

x86 Programming I CSE 351 Autumn 2016 Instructor: Justin Hsia

Instruction Set Architectures

Systems Architecture I

Lecture 4 CIS 341: COMPILERS

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

The x86 Architecture

EEM336 Microprocessors I. Addressing Modes

Introduction to IA-32. Jo, Heeseung

Today: Machine Programming I: Basics

INTRODUCTION TO IA-32. Jo, Heeseung

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 4

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

Overview of the MIPS Architecture: Part I. CS 161: Lecture 0 1/24/17

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Chapter 2: The Microprocessor and its Architecture

x86 assembly CS449 Fall 2017

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

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

Machine Language CS 3330 Samira Khan

Assembly II: Control Flow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS241 Computer Organization Spring Introduction to Assembly

Assembly Language Programming 64-bit environments

Assembly II: Control Flow

C to Assembly SPEED LIMIT LECTURE Performance Engineering of Software Systems. I-Ting Angelina Lee. September 13, 2012

Real instruction set architectures. Part 2: a representative sample

CS429: Computer Organization and Architecture

MACHINE-LEVEL PROGRAMMING I: BASICS

Instruction Set Architecture

CSE351 Spring 2018, Midterm Exam April 27, 2018

Instruction Set Architecture

Instruction Set Architectures Part I: From C to MIPS. Readings:

A4 Sample Solution Ch3

Intel Architecture. Compass Security Schweiz AG Werkstrasse 20 Postfach 2038 CH-8645 Jona

Carnegie Mellon. 5 th Lecture, Jan. 31, Instructors: Todd C. Mowry & Anthony Rowe

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

x86 assembly CS449 Spring 2016

How Software Executes

Machine Level Programming I: Basics

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

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

Instruction Set Architecture. Hung-Wei Tseng

Credits and Disclaimers

UNIT 2 PROCESSORS ORGANIZATION CONT.

COSC 6385 Computer Architecture. Instruction Set Architectures

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

Process Layout and Function Calls

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

CS165 Computer Security. Understanding low-level program execution Oct 1 st, 2015

Processor Architecture

Today: Machine Programming I: Basics. Machine Level Programming I: Basics. Intel x86 Processors. Intel x86 Evolution: Milestones

Von Neumann Architecture. Machine Languages. Context of this Lecture. High-Level Languages. Assembly Language: Part 1. Princeton University.

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

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

Computer Organization: A Programmer's Perspective

Access. Young W. Lim Fri. Young W. Lim Access Fri 1 / 18

Instruction Set Principles. (Appendix B)

+ Machine Level Programming: x86-64 History

The x86 Architecture. ICS312 - Spring 2018 Machine-Level and Systems Programming. Henri Casanova

Machine Program: Procedure. Zhaoguo Wang

CS 107 Lecture 10: Assembly Part I

x86 architecture et similia

Lecture 3 CIS 341: COMPILERS

Function Calls and Stack

The Instruction Set. Chapter 5

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

Microprocessor (COM 9323)

Transcription:

The Case for RISC

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

MIPS: A Classic RISC ISA Instructions 4 bytes (32 bits) 4-byte aligned Instructions operate on memory and registers Memory Data types (also aligned) Bytes -- 8 bits Half words -- 16 bits Words -- 32 bits Registers 32 4-byte registers in the register file 3

The MIPS Register File Where a register is needed any register will work $zero is the zero register It is always zero. Writes to it have no effect. Name number use Callee saved $zero 0 zero n/a $at 1 Assemble Temp no $v0 - $v1 2-3 return value no $a0 - $a3 4-7 arguments no $t0 - $t7 8-15 temporaries no $s0 - $s7 16-23 saved temporaries yes $t8 - $t9 24-25 temporaries no $k0 - $k1 26-27 Res. for OS yes $gp 28 global ptr yes $sp 29 stack ptr yes $fp 30 frame ptr yes $ra 31 return address yes

Instruction Formats Arithmetic: Register[rd] = Register[rs] + Register[rt] Register indirect jumps: PC = PC + Register[rs] Arithmetic: Register[rd] = Register[rs] + Imm Branches: If Register[rs] == Register[rt], goto PC + Immediate Memory: Memory[Register[rs] + Immediate] = Register[rt] Register[rt] = Memory[Register[rs] + Immediate] Direct jumps: PC = Address Syscalls, break, etc. 5

RISC Characteristics of MIPS All instructions have <= 1 arithmetic op <= 1 memory access <= 2 register reads <= 1 register write <= 1 branch It needs a small, fixed amount of hardware. Instructions operate on memory or registers not both Load/Store Architecture Decoding is easy Uniform opcode location Uniform register location Always 4 bytes -> the location of the next PC is to know. Uniform execution algorithm Fetch Decode Execute Memory Write Back Compiling is easy No complex instructions to reason about No special registers The HW is simple A skilled undergrad can build one in 10 weeks. 33 instructions can run complex programs.

MIPS Processor 7

Mostly RISC: ARM ARM is somewhere in between Four instruction formats. Fixed length. General purpose registers (except the condition codes) Moderately complex instructions, but they are still regular -- all instructions look more or less the same. ARM targeted embedded systems Code density is more important Performance (and clock speed) is less critical Both of these argue for more complex instructions. But they can still be regular, easy to decode, and crafted to minimize hardware complexity An ARM pipeline has more components, but it is not really any more complex than MIPS. It does a very good job of balancing RISC and CISC 8

x86 Assembly 9

x86 ISA Caveats x86 is a poorly-designed ISA It breaks almost every rule of good ISA design. There is nothing regular or predictable about its syntax. We don t have time to learn how to write x86 with any kind of thoroughness. It is the most widely used ISA in the world today. It is the ISA you are most likely to see in the real world So it s useful to study. 10

The CISC of x86 x86 instructions can operate on memory or registers or both x86 is a two address ISA Both arguments are sources. One is also the destination A = A + B Lots of copying to preserve values x86 has (lots of) special-purpose registers A single instruction can include many arithmetic operations and memory accesses x86 has variable-length instructions Between 1 and 15 bytes Where s the next instruction? Added >1 instruction/week since its creation 11

Registers 8-bit 16-bit 32-bit 64-bit Description Notes %AL %AX %EAX %RAX The accumulator register %BL %BX %EBX %RBX The base register %CL %CX %ECX %RCX The counter %DL %DX %EDX %RDX The data register %SPL %SP %ESP %RSP Stack pointer %SBP %BP %EBP %RBP Points to the base of the stack frame %RnB %RnW %RnD %Rn (n = 8...15) General purpose registers %SIL %SI %ESI %RSI Source index for string operations %DIL %DI %EDI %RDI Destination index for string operations %IP %EIP %RIP Instruction Pointer %FLAGS Condition codes These can be used more or less interchangeably, like the registers in MIPS. Different names (e.g. %AX vs. %EAX vs. %RAX) refer to different parts of the same register %RAX (64 bits) %EAX (32 bits) %AX %AL 12

Arguments/Addressing Modes MIPS MIPS MIPS x86 x86 x86 Type Syntax Meaning Example Register %<reg> R[%reg] %RAX Immediate $nnn constant $42 Displacement n(%reg) Mem[R[%reg] + n] -42(%RAX) Base-Offset (%r1, %r2) Mem[R[%r1] + %R[%r2]] (%RAX,%AL) Scaled Offset (%r1, %r2, 2 n ) Mem[R[%r1] + %R[%r2] * 2 n ] (%RAX,%AL, 4) Scaled Offset Displacement k(%r1, %r2, 2 n ) Mem[R[%r1] + %R[%r2] * 2 n + k] -4(%RAX,%AL, 2) 13

RISCing the CISC Everyone believes that RISC ISAs are better for building fast processors. So, how do Intel and AMD build fast x86 processors? Despite using a CISC ISA, these processors are actually RISC processors inside Internally, they convert x86 instructions into MIPS-like micro-ops (uops), and feed them to a RISC-style processor x86 Code movb $0x05, %al movl -4(%ebp), %eax movl %eax, -4(%ebp) movl %R0, -4(%R1,%R2,4) movl %R0, %R1 uops ori $t0, $t0, 5 lw $t0, -4($t1) sw $t0, -4($t1) slr $at, $t2, 2 add $at, $at, $t1 sw $t0, k($at) ori $t0, $t0, $zero 14

VLIWing the CISC We can also get rid of x86 with software. Transmeta did this. They built a processor that was completely hidden behind a soft implementation of the x86 instruction set. Their system would translate x86 instruction into an internal VLIW instruction set and execute that instead. Originally, their aim was high performance. That turned out to be hard, so they focused low power instead. Transmeta eventually lost to Intel Once Intel decided it cared about power, it started producing very efficient CPUs. Watch out ARM! 15