MIPS History. ISA MIPS Registers

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

CSEE 3827: Fundamentals of Computer Systems

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

Instructions: Language of the Computer

Reduced Instruction Set Computer (RISC)

Instructions: Language of the Computer

Reduced Instruction Set Computer (RISC)

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

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

MIPS Instruction Set

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

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

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

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

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

CS3350B Computer Architecture MIPS Introduction

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

CS3350B Computer Architecture

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

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

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

ECE260: Fundamentals of Computer Engineering

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

ECE331: Hardware Organization and Design

Computer Architecture. The Language of the Machine

Flow of Control -- Conditional branch instructions

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits

Chapter Two MIPS Arithmetic

Computer Architecture. MIPS Instruction Set Architecture

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

CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Formats

ECE260: Fundamentals of Computer Engineering

Instruction encoding. MIPS Instruction encoding

Instructions: Language of the Computer

Levels of Programming. Registers

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

Math 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro

The MIPS Instruction Set Architecture

CPS311 - COMPUTER ORGANIZATION. A bit of history

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

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

MIPS%Assembly% E155%

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

Examples of branch instructions

CPSC 330 Computer Organization

MIPS Assembly Programming

Chapter 2A Instructions: Language of the Computer

Orange Coast College. Business Division. Computer Science Department CS 116- Computer Architecture. The Instructions

Chapter 2. Instruction Set Architecture (ISA)

MIPS Reference Guide

MACHINE LANGUAGE. To work with the machine, we need a translator.

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

CS61C : Machine Structures

MIPS Datapath. MIPS Registers (and the conventions associated with them) MIPS Instruction Types

Computer Architecture

Programming the processor

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

ECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 3 2/8/2018

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

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

CMPE324 Computer Architecture Lecture 2

Lecture 4: Instruction Set Architecture

MIPS Hello World. MIPS Assembly 1. # PROGRAM: Hello, World! # Data declaration section. out_string:.asciiz "\nhello, World!\n"

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

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

Chapter 2. Instructions:

MIPS PROJECT INSTRUCTION SET and FORMAT

CS 61c: Great Ideas in Computer Architecture

Lectures 3-4: MIPS instructions

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

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

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

We will study the MIPS assembly language as an exemplar of the concept.

UCB CS61C : Machine Structures

Course Administration

Computer Architecture Instruction Set Architecture part 2. Mehran Rezaei

ECE 486/586. Computer Architecture. Lecture # 7

Review. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations

ECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 5 2/22/2018

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

M2 Instruction Set Architecture

ECE 15B Computer Organization Spring 2010

Lecture 4: MIPS Instruction Set

SPIM Instruction Set

Part II Instruction-Set Architecture. Jan Computer Architecture, Instruction-Set Architecture Slide 1

ECE232: Hardware Organization and Design

Computer Organization MIPS ISA

Compiling Techniques

Instruction Set Architecture. "Speaking with the computer"

Processor design - MIPS

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Instructions: Assembly Language

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

Topic Notes: MIPS Instruction Set Architecture

Concocting an Instruction Set

Computer Science 61C Spring Friedland and Weaver. Instruction Encoding

Transcription:

MIPS History MIPS is a computer family R2000/R3000 (32-bit) R4000/4400 (64-bit) R10000 (64-bit) and others MIPS originated as a Stanford research project under the direction of John Hennessy Microprocessor without Interlocked Pipe Stages MIPS Co. bought by SGI MIPS in DEC (now Compaq) workstations MIPS is a RISC 1/11/99 CSE378 MIPS ISA 1 ISA MIPS Registers Thirty-two 32-bit registers $0,$1,,$31 used for integer arithmetic; address calculation; temporaries; specialpurpose functions (stack pointer etc.) A 32-bit Program Counter (PC) Two 32-bit registers (HI, LO) used for mult. and division Thirty-two 32-bit registers $f0, $f1,,$f31 used for floating-point arithmetic Often used in pairs: 16 64-bit registers Registers are a major part of the state of a process 1/11/99 CSE378 MIPS ISA 2 1

MIPS Register names and conventions Register Name Function Comment $0 Zero Always 0 No-op on write $1 $at Reserved for assembler Don t use it $2-3 $v0-v1 Expr. Eval/funct. Return $4-7 $a0-a3 Proc./func. Call parameters $8-15 $t0-t7 Temporaries; volatile Not saved on proc. Calls $16-23 $s0-s7 Temporaries Should be saved on calls $24-25 $t8-t9 Temporaries; volatile Not saved on proc. Calls $26-27 $k0-k1 Reserved for O.S. Don t use them $28 $gp Pointer to global static memory $29 $sp Stack pointer $30 $fp Frame pointer $31 $ra Proc./funct return address 1/11/99 CSE378 MIPS ISA 3 MIPS = RISC = Load-Store architecture Every operand must be in a register Except for some small integer constants that can be in the instruction itself (see later) Variables have to be loaded in registers Results have to be stored in memory Explicit Load and Store instructions are needed because there are many more variables than the number of registers 1/11/99 CSE378 MIPS ISA 4 2

Example The HLL statements a = b + c d = a + b will be translated into assembly language as: load b in register rx load c in register ry rz <- rx + ry store rz in a rt <- rz + rx store rt in d 1/11/99 CSE378 MIPS ISA 5 MIPS Information units Data types and size: Byte Half-word (2 bytes) Word (4 bytes) Float (4 bytes; single precision format) Double (8 bytes; double-precision format) Memory is byte-addressable A data type must start at an address evenly divisible by its size (in bytes) In little-endian environment, the address of a data type is the address of its lowest byte 1/11/99 CSE378 MIPS ISA 6 3

Byte address 2 Half-word address 2 Addressing of Information units 3 2 1 0 Byte address 0 Half-word address 0 Word address 0 Byte address 5 Byte address 8 Half-word address 8 Word address 8 1/11/99 CSE378 MIPS ISA 7 SPIM Convention Words listed from left to right but little endians within words [0x7fffebd0] 0x00400018 0x00000001 0x00000005 0x00010aff Byte 7fffebd2 Word 7fffebd4 Half-word 7fffebde 1/11/99 CSE378 MIPS ISA 8 4

Assembly Language programming or How to be nice to your TA Don t be too fancy Use words (rather than bytes) whenever possible Remember: The address of a word is evenly divisible by 4 The word following the word at address i is at address i+4 1/11/99 CSE378 MIPS ISA 9 MIPS Instruction types Few of them (RISC philosophy) Arithmetic Integer (signed and unsigned); Floating-point Logical and Shift work on bit strings Load and Store for various data types (bytes, words, ) Compare (of values in registers) Branch and jumps (flow of control Includes procedure/function calls 1/11/99 CSE378 MIPS ISA 10 5

Notation for SPIM instructions Opcode rd, rs, rt Opcode rt, rs, immed where rd is always a destination register (result) rs is always a source register (read-only) rt can be either a source or a destination (depends on the opcode) immed is a 16-bit constant (signed or unsigned) 1/11/99 CSE378 MIPS ISA 11 Arithmetic instructions in SPIM Don t confuse the SPIM format with the encoding of instructions that we ll see soon Opcode Operands Comments Add rd,rs,rt #rd = rs + rt Addi rt,rs,immed #rt = rs + immed Sub rd,rs,rt #rd = rs - rt 1/11/99 CSE378 MIPS ISA 12 6

Examples Add $8,$9,$10 #$8=$9+$10 Add $t0,$t1,$t2 #$t0=$t1+$t2 Sub $s2,$s1,$s0 #$s2=$s1-$s0 Addi $a0,$t0,20 #$a0=$t0+20 Addi $a0,$t0,-20 #$a0=$t0-20 Addi $t0,$0,0 #clear $t0 Sub $t5,$0,$t5 #$t5 = -$t5 1/11/99 CSE378 MIPS ISA 13 Integer arithmetic Numbers can be signed or unsigned Arithmetic instructions (+,-,*,/) exist for both signed and unsigned numbers (differentiated by Opcode) Example: Add and Addu Addi and Addiu Mult and Multu Signed numbers are represented in 2 s complement For Add and Subtract, computation is the same but Add, Sub, Addi cause exceptions in case of overflow Addu, Subu, Addiu don t 1/11/99 CSE378 MIPS ISA 14 7

How does the CPU know if the numbers are signed or unsigned? It does not! You do You have to tell the machine by using the right instruction (e.g. Add or Addu) 1/11/99 CSE378 MIPS ISA 15 8