CSEE 3827: Fundamentals of Computer Systems

Similar documents
ECE 486/586. Computer Architecture. Lecture # 7

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

EECS Computer Organization Fall Based on slides by the author and prof. Mary Jane Irwin of PSU.

EN164: Design of Computing Systems Lecture 09: Processor / ISA 2

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

CS3350B Computer Architecture MIPS Introduction

CS3350B Computer Architecture

Lecture 4: MIPS Instruction Set

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

Chapter 2. Instruction Set. RISC vs. CISC Instruction set. The University of Adelaide, School of Computer Science 18 September 2017

Instructions: Language of the Computer

Computer Architecture. Lecture 2 : Instructions

Chapter 2A Instructions: Language of the Computer

Architecture I. Computer Systems Laboratory Sungkyunkwan University

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

CSCI 402: Computer Architectures

MIPS History. ISA MIPS Registers

CS222: MIPS Instruction Set

ECE232: Hardware Organization and Design

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Unsigned Binary Integers

Unsigned Binary Integers

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

ECE 154A Introduction to. Fall 2012

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

Lectures 3-4: MIPS instructions

EC 413 Computer Organization

Instructions: Language of the Computer

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

ECE260: Fundamentals of Computer Engineering

Lecture 4: Instruction Set Architecture

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

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

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

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

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

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

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

COMPUTER ORGANIZATION AND DESIGN

MIPS Instruction Set Architecture (1)

Introduction. Datapath Basics

ECE260: Fundamentals of Computer Engineering

Chapter 4. The Processor

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

Computer Architecture

CS3350B Computer Architecture MIPS Instruction Representation

LECTURE 2: INSTRUCTIONS

EC-801 Advanced Computer Architecture

ECE260: Fundamentals of Computer Engineering

Operations, Operands, and Instructions

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

CS/COE1541: Introduction to Computer Architecture

Topic Notes: MIPS Instruction Set Architecture

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

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

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

Instructions: Language of the Computer

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. MIPS Assembly

Lecture 10: Simple Data Path

Chapter 1. Computer Abstractions and Technology

Chapter 4. The Processor

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

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

Chapter 2: Instructions:

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

Assembler. Lecture 8 CS301

Processor (I) - datapath & control. Hwansoo Han

CS61C Machine Structures. Lecture 13 - MIPS Instruction Representation I. 9/26/2007 John Wawrzynek. www-inst.eecs.berkeley.

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

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

ECE 15B Computer Organization Spring 2011

Chapter 4. The Processor Designing the datapath

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

Chapter 2. Instructions: Language of the Computer

CS61C - Machine Structures. Lecture 6 - Instruction Representation. September 15, 2000 David Patterson.

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

ECE232: Hardware Organization and Design

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

Computer Organization MIPS ISA

Instruction Set Architecture

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

ECE232: Hardware Organization and Design

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

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

CS61C : Machine Structures

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Chapter 2. Instruction Set Architecture (ISA)

Instruction Set Architecture. "Speaking with the computer"

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

Course Administration

MIPS Coding Continued

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

Instruction Set Architecture

Levels of Programming. Registers

CS 4200/5200 Computer Architecture I

CENG3420 L03: Instruction Set Architecture

ECE260: Fundamentals of Computer Engineering

Transcription:

CSEE 3827: Fundamentals of Computer Systems Lecture 15 April 1, 2009 martha@cs.columbia.edu

and the rest of the semester Source code (e.g., *.java, *.c) (software) Compiler MIPS instruction set architecture Application executable (e.g., *.exe) General purpose processor (e.g., Power PC, Pentium, MIPS) (hardware) Single-cycle MIPS processor Performance analysis Optimization (pipelining, caches) Topics in modern computer architecture (multicore, on-chip networks, etc.) 2

Another angle (high level language) (assembly language) (hardware representation) 3

What is an ISA? An Instruction Set Architecture, or ISA, is an interface between the hardware and the software. An ISA consists of: a set of operations (instructions) data units (sized, addressing modes, etc.) processor state (registers) input and output control (memory operations) execution model (program counter) 4

Why have an ISA? An ISA provides binary compatibility across machines that share the ISA Any machine that implements the ISA X can execute a program encoded using ISA X. You typically see families of machines, all with the same ISA, but with different power, performance and cost characteristics. e.g., the MIPS family: Mips 2000, 3000, 4400, 10000 5

RISC machines RISC = Reduced Instruction Set Computer All operations are of the form Rd Rs op Rt MIPS (and other RISC architectures) are load-store architectures, meaning all operations performed only on operands in registers. (The only instructions that access memory are loads and stores) Alternative to CISC (Complex Instruction Set Computer) where operations are significantly more complex. 6

MIPS History MIPS is a computer family Originated as a research project at Stanford under the direction of John Hennessy called Microprocessor without Interlocked Pipe Stages Commercialized by MIPS Technologies purchased by SGI used in previous versions of DEC workstations now has large share of the market in the embedded space 7

What is an ISA? An Instruction Set Architecture, or ISA, is an interface between the hardware and the software. An ISA consists of: a set of operations (instructions) data units (sized, addressing modes, etc.) processor state (registers) input and output control (memory operations) (for MIPS) arithmetic, logical, conditional, branch, etc. 32-bit data word 32, 32-bit registers load and store execution model (program counter) 32-bit program counter 8

Arithmetic Instructions Addition and subtraction Three operands: two source, one destination add a, b, c # a gets b + c All arithmetic operations (and many others) have this form Design principle: Regularity makes implementation simpler Simplicity enables higher performance at lower cost 9

Arithmetic Example 1 f = (g + h) - (i + j) C code add t0, g, h # temp t0=g+h add t1, i, j # temp t1=i+j sub f, t0, t1 # f = t0-t1 Compiled MIPS 10

Register Operands Arithmetic instructions get their operands from registers MIPS 32x32-bit register file is used for frequently accessed data numbered 0-31 Registers indicated with $<id> $t0, $t1,, $t9 for temporary values $s0, $s1,, $s7 for saved values 11

Arithmetic Example 1 w. Registers add t0, g, h # temp t0=g+h add t1, i, j # temp t1=i+j sub f, t0, t1 # f = t0-t1 Compiled MIPS store: f in $s0, g in $s1, h in $s2, i in $s3, and j in $s4 add $t0, $s1, $s2 add $t1, $s3, $s4 sub $s5, $t0, $t1 Compiled MIPS w. registers 12

Memory Operands Main memory used for composite data (e.g., arrays, structures, dynamic data) To apply arithmetic operations Load values from memory into registers (load instruction = mem read) Store result from registers to memory (store instruction = mem write) Memory is byte-addressed (each address identifies an 8-bit byte) Words (32-bits) are aligned in memory (meaning each address must be a multiple of 4) MIPS is big-endian (i.e., most significant byte stored at least address of the word) 13

Memory Operand Example 1 g = h + A[8] C code g in $s1, h in $s2, base address of A in $s3 index = 8 requires offset of 32 (8 items x 4 bytes per word) offset base register lw $t0, 32($s3) add $s1, $s2, $t0 # load word Compiled MIPS 14

Memory Operand Example 2 A[12 = h + A[8] C code h in $s2, base address of A in $s3 index = 8 requires offset of 32 (8 items x 4 bytes per word) index = 12 requires offset of 48 (12 items x 4 bytes per word) lw $t0, 32($s3) add $t0, $s2, $t0 sw $t0, 48($s3) # load word # store word Compiled MIPS 15

Registers v. Memory Registers are faster to access than memory Operating on data in memory requires loads and stores (More instructions to be executed) Compiler should use registers for variables as much as possible Only spill to memory for less frequently used variables Register optimization is important for performance 16

Immediate Operands Constant data encoded in an instruction addi $s3, $s3, 4 No subtract immediate instruction, just use the negative constant addi $s2, $s1, -1 Design principle: make the common case fast Small constants are common Immediate operands avoid a load instruction 17

The Constant Zero MIPS register 0 ($zero) is the constant 0 $zero cannot be overwritten Useful for many operations, for example, a move between two registers add $t2, $s1, $zero 18

Representing Instructions Instructions are encoded in binary (called machine code) MIPS instructions encoded as 32-bit instruction words Small number of formats encoding operation code (opcode), register numbers, etc. 19

Register Numbers 20

MIPS R-format Instructions op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits Instruction fields op: operation code (opcode) rs: first source register number rt: second source register number rd: register destination number shamt: shift amount (00000 for now) funct: function code (extends opcode) 21

R-format Example op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits add $t0, $s1, $s2 special $s1 $s2 $t0 0 add 0 17 18 8 0 32 000000 10001 10010 01000 00000 100000 22

MIPS I-format Instructions op rs rt constant 6 bits 5 bits 5 bits 16 bits Includes immediate arithmetic and load/store operations op: operation code (opcode) rs: first source register number rt: destination register number constant: offset added to base address in rs, or immediate operand 23