MIPS Instruction Set Architecture Prof. Sirer CS 316 Cornell University.

Slides:



Advertisements
Similar presentations
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Advertisements

Lecture 5: MIPS Instruction Set
CS/COE0447 Computer Organization & Assembly Language
Deeper Assembly: Addressing, Conditions, Branching, and Loops
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 5: Data Transfer Instructions / Control Flow Instructions Partially adapted from Computer.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
The University of Adelaide, School of Computer Science
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University A Processor See: P&H Chapter ,
MIPS Assembler Programming
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Feb 18, 2009 Lecture 4-1 instruction set architecture (Part II of [Parhami]) MIPS assembly language instructions MIPS assembly programming.
83 Assembly Language Readings: Chapter 2 ( , 2.8, 2.9, 2.13, 2.15), Appendix A.10 Assembly language Simple, regular instructions – building blocks.
Memory and Addressing How and Where Information is Stored.
1. 2 Instructions: Words of the language understood by CPU Instruction set: CPU’s vocabulary Instruction Set Architecture (ISA): CPU’s vocabulary together.
EEM 486: Computer Architecture Designing Single Cycle Control.
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
Chapter 2 CSF 2009 The MIPS Assembly Language. Stored Program Computers Instructions represented in binary, just like data Instructions and data stored.
Computer Organization Rabie A. Ramadan Lecture 3.
MIPS Instructions Instructions: Language of the Machine
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
CS Computer Organization Numbers and Instructions Dr. Stephen P. Carl.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
Instructor: Prof. Hany H Ammar, LCSEE, WVU
Prof. Hsien-Hsin Sean Lee
Memory Access Instructions
Morgan Kaufmann Publishers
Introduction CPU performance factors
Computer Organization and Design Instruction Sets - 2
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Prof. Sirer CS 316 Cornell University
32-bit MIPS ISA.
ENGR 3410 – Computer Architecture Mark L. Chang Fall 2006
Designing MIPS Processor (Single-Cycle) Presentation G
Appendix A Classifying Instruction Set Architecture
Han Wang CS3410, Spring 2012 Computer Science Cornell University
Control Flow and Arrays
MPIS Instructions Functionalities of instructions Instruction format
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Rocky K. C. Chang 6 November 2017
Instruction encoding The ISA defines Format = Encoding
Architecture Overview
MIPS Assembly.
MIPS Microarchitecture Multicycle Processor
COMS 361 Computer Organization
Computer Instructions
Computer Architecture
Basic Building Blocks Multiplexer Demultiplexer Adder +
Prof. Sirer CS 316 Cornell University
ECE 463/563 Fall `18 RISC-V instruction formats
Reading and writing to data memory
Basic Building Blocks Multiplexer Demultiplexer Adder +
MIPS Instruction Set Architecture
MIPS Assembly.
Hakim Weatherspoon CS 3410 Computer Science Cornell University
CS352H Computer Systems Architecture
The Processor: Datapath & Control.
COMS 361 Computer Organization
CS 3410, Spring 2014 Computer Science Cornell University
7/6/
9/13/
Control Flow and Arrays
Presentation transcript:

MIPS Instruction Set Architecture Prof. Sirer CS 316 Cornell University

Instructions Load/store architecture Data must be in registers to be operated on Keeps hardware simple Emphasis on efficient implementation Integer data types: byte: 8 bits half-words: 16 bits words: 32 bits MIPS supports signed and unsigned data types

MIPS Instruction Types Arithmetic/Logical three operands: result + two sources operands: registers, 16-bit immediates signed and unsigned versions Memory Access load/store between registers and memory half-word and byte operations Control flow conditional branches: pc-relative addresses jumps: fixed offsets

Arithmetic Instructions (1) if op == 0 && func == 0x21 R[rd] = R[rs] + R[rt] if op == 0 && func == 0x23 R[rd] = R[rs] - R[rt] if op == 0 && func == 0x25 R[rd] = R[rs] | R[rt] funcshamtrdrtrsop 6 bits5 bits 6 bits ADD rs, rt, rd ADDU rs, rt, rd AND rs, rt, rd OR rs, rt, rd NOR rs, rt, rd

Arithmetic Ops memory inst 32 pc 2 00 new pc calculation register file control alu

Arithmetic Instructions (2) if op == 8 R[rd] = R[rs] + sign_extend(immediate) if op == 12 R[rd] = R[rs] & immediate immediaterdrsop 6 bits5 bits 16 bits ADDI rs, rt, val ADDIU rs, rt, val ANDI rs, rt, val ORI rs, rt, val

Sign Extension Often need to convert a small (8-bit or 16-bit) signed value to a larger (16-bit or 32-bit) signed value “1” in 8 bits: “1” in 16 bits: “-1” in 8 bits: “-1” in 16 bits: Conversion from small to larger numbers involves replicating the sign bit

Arithmetic Ops with Immediates memory inst 32 pc 2 00 new pc calculation register file control alu mux sign extend 16 32

Memory Operations lb, lbu, lh, lhu, lw sb, sh, sw Examples lw r3, 0(r4)int array[32]; x = array[0] lw r3, 16(r4)int array[32]; x = array[4] immediatertrsop 6 bits5 bits 16 bits

Load memory inst 32 pc 2 0 new pc calculation register file control alu sign extend data memory addrd out

Store memory inst 32 pc 2 0 new pc calculation register file control alu sign extend data memory addrd out d in

Endianness Take a 32-bit hexadecimal value e.g. 0x Store the word at location 0x1000 Read the byte at location 0x1000 What do you get? Little endian Big endian x1003 0x1002 0x1001 0x1000 0x1000 0x1001 0x1002 0x1003

Endianness The way the bytes are ordered within a word generally does not matter, except when casting between integral data types  casting four bytes to an int  casting two bytes to a short  casting two shorts to an int Such casting is typically required when sending data from one host to another networks use big-endian representation for ints x86’s use little-endian representation for ints

Control Flow (Absolute Jump) j, jal Absolute addressing new PC = high 4 bits of current PC || target || 00 Cannot jump from 0xffff to 0x Better to make all instructions fit in 32 bits than to support really large absolute jumps Examples j L01goto L01 targetop 6 bits26 bits

Absolute Jump memory inst 32 pc 2 0 new pc calculation register file control alu sign extend data memory addrd out d in

Control Flow (Jump Register) new PC = R[rs] Can jump to any address stored in a register func rsop 6 bits5 bits15 bits6 bits

Jump Register memory inst 32 pc 2 0 new pc calculation register file control alu sign extend data memory addrd out d in

Control Flow (Branches) Some branches depend on the relative values of two registers if op == 4 # BEQ if R[rs] == R[rt]  new PC = old PC + sign_extend(immediate << 2) BEQ, BNE immediatertrsop 6 bits5 bits 16 bits

Branch memory inst 32 pc 2 0 new pc calculation register file control alu sign extend data memory addrd out d in =?

Control Flow (Branches) Some branches depend on the value of a single register if op == 1 && subop == BLTZ if R[rs] < 0  new PC = old PC + sign_extend(immediate << 2) BGEZ, BGTZ, BLTZ, BLEZ immediatesuboprsop 6 bits5 bits 16 bits

Branch memory inst 32 pc 2 0 new pc calculation register file control alu sign extend data memory addrd out d in =?<=0?

Summary Full-blown processor Next time: we’ll make it go faster