Computer Systems Laboratory Sungkyunkwan University

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

EJEMPLOS DE ARQUITECTURAS

Two processors sharing an area of memory. P1 writes, then P2 reads Data race if P1 and P2 don t synchronize. Result depends of order of accesses

LECTURE 2: INSTRUCTIONS

COE608: Computer Organization and Architecture

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

Computer Architecture. Chapter 2-2. Instructions: Language of the Computer

CS3350B Computer Architecture MIPS Procedures and Compilation

Chapter 2. Baback Izadi Division of Engineering Programs

Rechnerstrukturen. Chapter 2. Instructions: Language of the Computer

Chapter 2. Instructions: Language of the Computer. Jiang Jiang

Review of instruction set architectures

Systems Architecture I

Computer Architecture Computer Science & Engineering. Chapter 2. Instructions: Language of the Computer BK TP.HCM

Instruction Set Principles. (Appendix B)

ECE 486/586. Computer Architecture. Lecture # 8

MIPS ISA-II: Procedure Calls & Program Assembly

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

Chapter 2. Instructions: Language of the Computer

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 2. Instructions: Language of the Computer

Chapter 2. Instructions: Language of the Computer

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

Computer Architecture

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 2. Instructions: Language of the Computer

Chapter 2. Instructions: Language of the Computer. Baback Izadi ECE Department

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

Instruction Set. The MIPS Instruction Set. Chapter 2

Computer Architecture

Chapter 2. Instructions: Language of the Computer

Chapter 2. Instructions: Language of the Computer

CS3350B Computer Architecture MIPS Instruction Representation

CSCI 402: Computer Architectures. Instructions: Language of the Computer (4) Fengguang Song Department of Computer & Information Science IUPUI

Architecture I. Computer Systems Laboratory Sungkyunkwan University

Thomas Polzer Institut für Technische Informatik

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

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

Instructions: Language of the Computer. Euiseong Seo Computer Systems Laboratory Sungkyunkwan University

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

Chapter 2. Instructions: Language of the Computer

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

Computer Architecture. MIPS Instruction Set Architecture

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

Chapter 2A Instructions: Language of the Computer

Computer Architecture, RISC vs. CISC, and MIPS Processor

Instructions: Language of the Computer

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

CS3350B Computer Architecture

Computer Architecture. Lecture 2 : Instructions

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

Chapter 2. Instructions: Language of the Computer

Processor Architecture

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

Instruction Set Architecture. "Speaking with the computer"

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

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

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

Lecture 3: Instruction Set Architecture

CS222: MIPS Instruction Set

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

COMPUTER ORGANIZATION AND DESIGN

Communicating with People (2.8)

Lecture 4: Instruction Set Architecture

Advanced d Instruction Level Parallelism. Computer Systems Laboratory Sungkyunkwan University

Instruction Set Design and Architecture

CS3350B Computer Architecture MIPS Introduction

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

Outline. What Makes a Good ISA? Programmability. Implementability

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.)

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)

Computer Organization MIPS ISA

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

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

EN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design

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

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

Computer Architecture. The Language of the Machine

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

ISA: The Hardware Software Interface

Architecture II. Computer Systems Laboratory Sungkyunkwan University

EEC 581 Computer Architecture Lecture 1 Review MIPS

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

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

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

Chapter 2. Instructions: Language of the Computer

Instruction Set Architectures

MIPS Instruction Set

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

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

Reduced Instruction Set Computer (RISC)

Chapter 2. Instructions:

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

CENG3420 Lecture 03 Review

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

Reduced Instruction Set Computer (RISC)

Topic Notes: MIPS Instruction Set Architecture

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

Transcription:

ARM & IA-32 Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

ARM (1) ARM & MIPS similarities ARM: the most popular embedded core Similar basic set of instructions to MIPS ARM MIPS Date announced 1985 1985 Instruction size 32 bits 32 bits Address space 32 bit flat 32 bit flat Data alignment Aligned Aligned Data addressing modes 9 3 Registers 15 32 bit 31 32 bit Input/output p Memory Memory mapped mapped 2

ARM (2) Compare and branch in ARM Uses condition codes for result of an arithmetic/logical instruction Negative, zero, carry, overflow Compare instructions to set condition codes without keeping the result Each instruction can be conditional Top 4 bits of instruction word: condition value Can avoid branches over a single instruction 3

ARM (3) Instruction encoding 4

IA-32 (1) Evolution with backward compatibility 8080 (1974): 8-bit microprocessor Accumulator, plus 3 index-register pairs 8086 (1978): 16-bit extension to 8080 Complex instruction set (CISC) 8087 (1980): floating-point coprocessor Adds FP instructions and register stack 80286 (1982): 24-bit addresses, MMU Segmented memory mapping and protection 80386 (1985): 32-bit extension (now IA-32) Additional addressing modes and operations Paged memory mapping as well as segments 5

IA-32 (2) Further evolution... i486 (1989): pipelined, on-chip caches and FPU Compatible competitors: AMD, Cyrix Pentium (1993): superscalar, 64-bit datapath Later versions added MMX instructions The infamous FDIV bug Pentium Pro (1995), Pentium II (1997) New microarchitecture: P6 Pentium III (1999) Added SSE and associated registers Pentium 4 (2001) New microarchitecture: NetBurst Added SSE2 instructions 6

IA-32 (3) And further... AMD64 (2003): extended architecture to 64 bits EM64T Extended Memory 64 Technology (2004) AMD64 adopted by Intel (with refinements) Added SSE3 instructions Intel Core (2006) Added SSE4 instructions, virtual machine support AMD64 (announced 2007): SSE5 instructions Intel declined to follow, instead Advanced d Vector Extension (announced 2008) Longer SSE registers, more instructions Technical elegance market success 7

IA-32 (4) Basic x86 registers 8

IA-32 (5) Basic x86 addressing modes Two operands per instruction Source/dest operand Second source operand Register Register Register Immediate Register Memory Memory Register Memory Immediate Memory addressing modes Address in register Address = R base + displacement Address = R base + 2 scale R index (scale = 0, 1, 2, or 3) Address = R base + 2 scale R index + displacement 9

IA-32 (6) x86 instruction encoding Variable length encoding Postfix bytes specify addressing mode Prefix bytes modify operations Operand length, repetition, locking,... 10

IA-32 (7) Register or extended opcode Register or simple addressing modes: [R], disp32, ([R] X)+disp8/disp32, X Lock and repeat Segment override & Branch hints Operand size override Address size override complex addressing modes: X = [Rb+Ri*(1 2 4 8)] 11

IA-32 (8) Implementing IA-32 Complex instruction set makes implementation difficult Hardware translates instructions to simpler μ operations» Simple instructions: 1 1» Complex instructions: ti 1 many Microengine similar to RISC Market share makes this economically viable Comparable performance to RISC Compilers avoid complex instructions 12

IA-32 (9) Peculiarities Segmented memory model 8 GPRs only Can be partially accessed Many memory accesses, short life time Causes lots of anti- and output dependences One set of condition codes Modified d by most ALU operations Various operations affect various flags Short generate/use distance Explicit stack Little endian 13

IA-32 (10) CISC(Complex Instruction Set Computer)-style Huge number of assembly instructions Variable instruction lengths Up to 17 bytes (~ 3 bytes on average) Instructions may reside in any byte address Arithmetic operations can read/write memory Multiple complex addressing modes Support for complex data types likes strings The longer the string, the more cycles the instruction takes Registers associated with specific operations Implicit operands: MUL EBX EAX = EAX * EBX 14

IA-32 (11) x86 overhead Major sources Microcode ROMs: for decoding large, complex instructions Prefetch logic: instructions are not a uniform size and hence can straddle cache lines Segmented memory model: the decode logic has to check for and enforce code segment limits with its own dedicated address calculation hardware Transistor budget spent on x86 legacy support ~ 30% for Pentium ~ 40% for Pentium Pro < 10% for Pentium 4 The percentage is even smaller for the very latest processors 15

Fallacies (1) Powerful instruction higher performance Fewer instructions required But complex instructions are hard to implement May slow down all instructions, including simple ones Compilers are good at making fast code from simple instructions Use assembly code for high performance But modern compilers are better at dealing with modern processors More lines of code more errors and less productivity 16

Fallacies (2) Backward compatibility instruction set doesn t change But they do accrete more instructions x86 instruction set 17

Pitfalls Sequential words are not at sequential addresses Increment by 4, not by 1! Keeping a pointer to an automatic variable after procedure returns e.g., passing pointer back via an argument Pointer becomes invalid when stack popped 18

CISC Instruction Sets Complex Instruction Set Computer Dominant style through mid-80 s Stack-oriented instruction set Use stack to pass arguments, save program counter Explicit push and pop instructions Arithmetic instructions can access memory Requires memory read and write Complex address calculation l Condition codes Set as side effect of arithmetic and logical instructions Philosophy Add instructions to perform typical programming tasks 19

RISC Instruction Sets Reduced Instruction Set Computer Internal project at IBM, later popularized by Hennessy (Stanford) and Patterson (Berkeley) Fewer, simple instructions Might take more instructions to get given task done Can execute them with small and fast hardware Register-oriented instruction set Many more (typically 32) registers Use for arguments, return pointer, temporaries Only load and store instructions can access memory No condition codes Test instructions return 0/1 in register 20

CISC vs. RISC Original debate CISC proponents easy for compiler, fewer code bytes RISC proponents better for optimizing compilers, can make run fast with simple chip design Current status For desktop pprocessors, choice of ISA not a technical issue With enough hardware, can make anything run fast Code compatibility more important For embedded processors, RISC makes sense Smaller, cheaper, less power 21

Concluding Remarks (1) Design principlesp Simplicity favors regularity Smaller is faster Make the common case faster Good design demands ds good compromises o Layers of software/hardware Compiler, assembler, hardware MIPS: typical of RISC ISAs cf. Intel x86 22

Concluding Remarks (2) Measure MIPS instruction executions in benchmark programs Consider making the common case fast Consider compromises Instruction class MIPS examples SPEC2006 Int SPEC2006 FP Arithmetic add, sub, addi 16% 48% Data transfer lw, sw, lb, lbu, lh, 35% 36% lhu, sb, lui Logical and, or, nor, andi, 12% 4% ori, sll, srl Cond. Branch beq, bne, slt, slti, sltiu 34% 8% Jump j, jr, jal 2% 0% 23