Reminder: tutorials start next week!

Similar documents
ISA: The Hardware Software Interface

ECE 486/586. Computer Architecture. Lecture # 7

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Computer Architecture

Instruction Set Architecture (ISA)

CS3350B Computer Architecture MIPS Instruction Representation

Lecture 4: Instruction Set Architecture

A Model RISC Processor. DLX Architecture

The MIPS Instruction Set Architecture

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

Inf2C - Computer Systems Lectures 3-4 Assembly Language

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

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

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

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

Instructions: Language of the Computer

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

Course Administration

Lecture 4: MIPS Instruction Set

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

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

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

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

Computer Architecture. The Language of the Machine

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

M2 Instruction Set Architecture

Computer Architecture. MIPS Instruction Set Architecture

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

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21

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

Chapter 2A Instructions: Language of the Computer

Instruction Set Architecture. "Speaking with the computer"

Chapter 4. The Processor

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

CENG3420 Lecture 03 Review

TSK3000A - Generic Instructions

Lectures 3-4: MIPS instructions

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

EC-801 Advanced Computer Architecture

Unsigned Binary Integers

Unsigned Binary Integers

ECE 486/586. Computer Architecture. Lecture # 8

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

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Reduced Instruction Set Computer (RISC)

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

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

Topic Notes: MIPS Instruction Set Architecture

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

Instructions: Language of the Computer

Thomas Polzer Institut für Technische Informatik

CPU Architecture and Instruction Sets Chapter 1

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

Chapter 4. The Processor

Instruction Set Principles. (Appendix B)

EN2910A: Advanced Computer Architecture Topic 02: Review of classical concepts

EC 413 Computer Organization

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

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

Reduced Instruction Set Computer (RISC)

Processor (I) - datapath & control. Hwansoo Han

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

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

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

CS/COE1541: Introduction to Computer Architecture

COMPUTER ORGANIZATION AND DESIGN

Design for a simplified DLX (SDLX) processor Rajat Moona

Chapter 4. The Processor Designing the datapath

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

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

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

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

ECE 154A Introduction to. Fall 2012

Control Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary

Control Instructions

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

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

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

CS 4200/5200 Computer Architecture I

EE108B Lecture 3. MIPS Assembly Language II

Instruction Set Architecture

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

Instruction Set Architectures

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

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

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

Chapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )

MIPS Memory Access Instructions

MIPS Assembly Language

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

Chapter 2. Instructions: Language of the Computer

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)

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

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

MIPS ISA and MIPS Assembly. CS301 Prof. Szajda

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

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

Computer Organization MIPS ISA

Introduction. Datapath Basics

Transcription:

Previous lecture recap! Metrics of computer architecture! Fundamental ways of improving performance: parallelism, locality, focus on the common case! Amdahl s Law: speedup proportional only to the affected fraction of the original execution time! CPU Performance equation: IC * CPI * Clock time! Must improve some combination of the above to improve perf! Reminder: tutorials start next week! Inf3 Computer Architecture - 2014-2015 1

ISA: The Hardware Software Interface! Instruction Set Architecture (ISA) is where software meets hardware! Understanding of ISA design is therefore important!! Instruction Set Components! Operands: int32, uint32, int16, uint16, int8, uint8, float32, float64! Addressing modes: how do we access data (in regs, memory, etc)! Operations: four major types! Operator functions (add, shift, xor, mul, etc)! Data movement (load-word, store-byte, etc)! Control transfer (branch, jump, call, return, etc)! Privileged, and miscellaneous instructions (not part of the application)! Good understanding of compiler translation is essential! Inf3 Computer Architecture - 2014-2015 2

ISA Design Considerations! Simple target for compilers! Support for OS and programming language features! Support for important data types (floating-point, vectors)! Code size! Impact on execution efficiency (especially with pipelining)! Backwards compatibility with legacy processors! Provision for extensions! Inf3 Computer Architecture - 2014-2015 3

CISC vs RISC! CISC! Assembly programming à HLL features as instructions! Small # registers, memory not that slow à memory operands! Code size must be small à variable length! Backward compatibility à complexity increases! RISC! Compilers à Simple instructions! Large # registers, memory much slower than processor à load store architecture! Simple and fast decoding à fixed length, fixed format! Inf3 Computer Architecture - 2014-2015 4

Instruction Classes! Instructions that operate on data! Arithmetic & logic operations! Execution template: fetch operands, perform op, store result! Instructions that move data! Move data between registers, memory, and I/O devices! Instructions that change control flow! Re-direct control flow away from the next instruction! May be conditional or unconditional (including exceptions!)! Inf3 Computer Architecture - 2014-2015 5

Operators and their Instructions! Integer Arithmetic! + add! - sub! * mul! / div! % rem! Relational! < slt, sltu! <= sle, sleu! > sgt, sgtu! >= sge, sgeu! == seq!!= sne! C operator! Comparison! Reverse! Branch! ==! seq! 0! bnez!!=! seq! 0! beqz! <! slt, sltu! 0! bnez! >=! slt, sltu! 0! beqz! >! slt, sltu! 1! bnez! <=! slt, sltu! 1! beqz! Inf3 Computer Architecture - 2014-2015 6

Operators continued! Bit-wise logic! or! & and! ^ xor! ~ not! Boolean! Shifts! (src1!= 0 or src2!= 0)! && (src1!= 0 and src2!= 0)! >> (signed) shift-right-arithmetic! >> (unsigned) shift-right-logical! << shift-left-logical! Inf3 Computer Architecture - 2014-2015 7

Operand Types! Usually based on scalar types in C! Type modifier! C type declarator! Machine type! unsigned int, long uint32 unsigned short uint16 unsigned char uint8 unsigned long long uint64 signed int int32 signed short int16 signed char int8 signed long long int64 boolean float double &<type_specifier> uint1 float32 float64 uint32 C defines integer promotion for expression evaluation! int16 + int32 will be performed at 32-bit precision! First operand must be sign-extended to 32 bits! Similarly, uint8 + int16 will be performed at 16-bit precision! First operand must be zero-extended to 16-bit precision! Inf3 Computer Architecture - 2014-2015 8

Instruction Operands - Registers! Registers! How many registers operands should be specified?! 3: R1 = R2 + R3! 2: R1 = R1 + R2! 1: +R1! 32-bit RISC architectures normally specify 3 registers for dyadic operations and 2 registers for monadic operations! Compact 16-bit embedded architectures often specify respectively 2 and 1 register in these cases! Introduces extra register copying! E.g.! load! r1, [address]! copy r2, r1! add r1, r3! sub r4, r2! # this is simply a re-use of r1, but the value of r1 had to be copied!into r2! Accumulator architectures: now dead, but concept still widely used in Digital Signal Processors (DSP).! E.g.! load [address1]! add 23! store [address2]! Inf3 Computer Architecture - 2014-2015 9

Instruction Operands - Literals! Constant operands! E.g. add r1, r2, 45! Jump or branch targets! Relative:! Normally used for if-then-else and loop constructs within a single function! Distances normally short can be specified as 16-bit signed & scaled offset! Permits position independent code (PIC)! Absolute! Normally used for function call and return! But not all function addresses are compile-time constants, so jump to contents of register is also necessary! Load/Store addresses! Relative! Absolute!! Inf3 Computer Architecture - 2014-2015 10

How big do literals have to be?! Addresses! Always 32 (or 64 bits)! Arithmetic operands! Small numbers, representable in 5 10 bits are common! Literals are often used repeatedly at different locations! Place as read-only data in the code and access relative to program counter register (e.g. MIPS16, ARM-thumb)! Branch offsets! 10 bits catches most branch distances! 32-bit RISC architectures provide 16-bit literals! 16-bit instructions must cope with 5 10 bits! May extend literal using an instruction prefix! E.g. Thumb bx instruction! Inf3 Computer Architecture - 2014-2015 11

Memory Access Operations! Memory operations are governed by:! Direction of movement (load or store)! Size of data objects (word, half-word, byte)! Extension semantics for load data (zero-ext, sign-ext)! Memory access load store word half-word byte word half-word byte lw sw sh sb signed unsigned signed unsigned lh lhu lb lbu Inf3 Computer Architecture - 2014-2015 12

Memory Addressing Modes: Displacement! Displacement addressing is the most common memory addressing mode! Register + offset! Generic form for accessing via pointers! Multi-dimensional arrays require address calculations! Stack pointer and Frame pointer relative! 5 to 10 bits of offset is sufficient in most cases! PC relative addresses! Used to modify control flow (e.g., upon a branch)! Inf3 Computer Architecture - 2014-2015 13

Other Memory Addressing Modes! Direct or absolute: useful for accessing constants and static data! Auto-increment/decrement: useful for iterating over arrays or for stack push/pop operations! Scaled: speeds up random array accesses!e.g., R7 = R5 + Mem[R1 + R2 * d] where d is determined by the size of the data item being accessed (byte, hw, word, long)! Memory indirect: in-memory pointer dereference!e.g., R3 = Mem[Mem[R1]] Inf3 Computer Architecture - 2014-2015 14

Memory Addressing Mode Frequency! H&P 5/e Fig. A.7 Few addressing modes account for most memory accesses! Inf3 Computer Architecture - 2014-2015 15

Instructions for Altering Control Flow! Conditional (branches)! (unconditional) Jumps! Function calls and returns! Exceptions & interrupts! Traps (instructions) vs events! Trigger a mode change!! H&P 5/e Fig. A.11 Inf3 Computer Architecture - 2014-2015 16

Conditional Instruction Formats! Condition code based (e.g., x86)! sub $1, $2! Sets Z, N, C, V flags! Branch selects condition! ble : N or Z! (+) Condition set for free ( side-effect of instruction execution)! (-) Volatile state (next instruction may overwrite flags)! Condition register based! slte $1, $2, $3! bnez $1 (or beqz $1)! (+) Simple and reduces number of opcodes! (-) Uses up a register! Compare and branch! combt lte $1, $2! (+) One instruction per branch! (-) Complex instruction! Inf3 Computer Architecture - 2014-2015 17

Instruction Frequency by Type! 40%! 25%! 30%! 20%! 20%! 15%! 10%! 10%! 0%! Data operation!data movement! Control flow! 5%! 0%! Data from H&P 5/e Fig. A.13 Inf3 Computer Architecture - 2014-2015 18

Encoding the Instruction Set! How many bits per instruction?! Fixed-length 32-bit RISC encoding! Variable-length encoding (e.g. Intel x86)! Compact 16-bit RISC encodings! ARM Thumb! MIPS16! Formats define instruction groups with a common set of operands! Orthogonal ISA: addressing modes are independent of the instruction type (i.e., all insts can use all addressing modes)! Great conceptually and for compilation! E.g., VAX-11: 256 opcodes * 13 addressing modes (mode encoded with each operand)! Inf3 Computer Architecture - 2014-2015 19

MIPS 32-bit Instruction Formats! R-type (register to register)! three register operands! most arithmetic, logical and shift instructions! I-type (register with immediate)! instructions which use two registers and a constant! arithmetic/logical with immediate operand! load and store! branch instructions with relative branch distance! J-type (jump)! jump instructions with a 26 bit address! Inf3 Computer Architecture - 2014-2015 20

MIPS R-type instruction format! 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits opcode reg rs reg rt reg rd shamt funct! add $1, $2, $3 special $2 $3 $1 add sll $4, $5, 16 special $5 $4 16 sll Inf3 Computer Architecture - 2014-2015 21

MIPS I-type instruction format! 6 bits 5 bits 5 bits 16 bits opcode reg rs reg rt immediate value/addr! lw $1, offset($2) lw $2 $1 address offset beq $4, $5,.L001 beq $4 $5 (PC -.L001) >> 2 addi $1, $2, -10 addi $2 $1 0xfff6 Inf3 Computer Architecture - 2014-2015 22

MIPS J-type instruction format! 6 bits 26 bits opcode address! call func jal absolute func address >> 2 Inf3 Computer Architecture - 2014-2015 23

ISA Guidelines! Regularity: operations, data types, addressing modes, and registers should be independent (orthogonal)! Primitives, not solutions: do not attempt to match HLL constructs with special IS instructions! Simplify tradeoffs: make it easy for compiler to make choices based on estimated performance! Inf3 Computer Architecture - 2014-2015 24