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

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

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

CS3350B Computer Architecture

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

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

Instructions: Language of the Computer

CS3350B Computer Architecture MIPS Introduction

ECE232: Hardware Organization and Design

CSEE 3827: Fundamentals of Computer Systems

Chapter 2A Instructions: Language of the Computer

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

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

CS222: MIPS Instruction Set

MIPS%Assembly% E155%

Instructions: Language of the Computer

Architecture I. Computer Systems Laboratory Sungkyunkwan University

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

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

Chapter 2: Instructions:

Instructions: Language of the Computer

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

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

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

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

Computer Architecture. Lecture 2 : Instructions

ECE 154A Introduction to. Fall 2012

MIPS Instruction Set Architecture (1)

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

ECE260: Fundamentals of Computer Engineering

COMPUTER ORGANIZATION AND DESIGN

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

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

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

Chapter 2. Instructions: Language of the Computer

ECE232: Hardware Organization and Design

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

Course Administration

Computer Organization MIPS ISA

CS/COE1541: Introduction to Computer Architecture

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

Unsigned Binary Integers

Unsigned Binary Integers

Lecture 4: MIPS Instruction Set

EN164: Design of Computing Systems Lecture 11: Processor / ISA 4

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

Course Administration

Computer Architecture

ECE331: Hardware Organization and Design

LECTURE 2: INSTRUCTIONS

ECE 486/586. Computer Architecture. Lecture # 7

Operations, Operands, and Instructions

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

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

CS3350B Computer Architecture MIPS Instruction Representation

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

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

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

Levels of Programming. Registers

Chapter 1. Computer Abstractions and Technology

MIPS History. ISA MIPS Registers

Chapter 2. Instruction Set Architecture (ISA)

ECE232: Hardware Organization and Design

Computer Architecture

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

CSCI 402: Computer Architectures

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

MIPS (SPIM) Assembler Syntax

EC 413 Computer Organization

comp 180 Lecture 10 Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions

Systems Architecture I

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

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

Computer Hardware Engineering

Computer Organization and Components

MIPS ISA and MIPS Assembly. CS301 Prof. Szajda

ECE260: Fundamentals of Computer Engineering

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

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

ECE260: Fundamentals of Computer Engineering

Assembler. Lecture 8 CS301

Reduced Instruction Set Computer (RISC)

CENG3420 Lecture 03 Review

EEC 581 Computer Architecture Lecture 1 Review MIPS

Thomas Polzer Institut für Technische Informatik

Rechnerstrukturen. Chapter 2. Instructions: Language of the Computer

Chapter 2. Instructions:

Instruction encoding. MIPS Instruction encoding

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Chapter 3. Instructions:

Lecture 5: Procedure Calls

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

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

CS 351 Exam 2 Mon. 11/2/2015

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

Concocting an Instruction Set

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

Reduced Instruction Set Computer (RISC)

Transcription:

EN164: Design of Computing Systems Lecture 09: Processor / ISA 2 Professor Sherief Reda http://scale.engin.brown.edu Electrical Sciences and Computer Engineering School of Engineering Brown University Spring 2011 S. Reda EN164 Sp 11 [ material from Patterson & Hennessy, 4 th ed and Harris 1 st ed ] 1

MIPS architecture Used as the example throughout the course Stanford MIPS commercialized by MIPS Technologies (www.mips.com) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, Typical of many modern ISAs 32 bit and 64 bit available Will implement and boot a subset MIPS processor in lab S. Reda EN164 Sp 11 2

Arithmetic operations High-level code a = b + c; a = b - c; MIPS assembly code # $s0 = a, $s1 = b, $s2 = c add $s0, $s1, $s2 sub $s0, $s1, $s2 add: mnemonic indicates what operation to perform $s1, $s1: source operands on which the operation is performed $s0: destination operand to which the result is written Design Principle 1: Simplicity favors regularity Regularity makes implementation simpler Simplicity enables higher performance at lower cost S. Reda EN164 Sp 11 3

Register operands Memory is slow. Most architectures have a small set of (fast) registers MIPS has a 32 32-bit register file Use for frequently accessed data Numbered 0 to 31 32-bit data called a word Written with a $ before their name Assembler names $0 always hold value 0 $t0, $t1,, $t9 for temporary values $s0, $s1,, $s7 for saved variables Design Principle 2: Smaller is faster c.f. main memory: millions of locations S. Reda EN164 Sp 11 4

MIPS registers Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary $v0-$v1 2-3 procedure return values $a0-$a3 4-7 procedure arguments $t0-$t7 8-15 temporaries $s0-$s7 16-23 saved variables $t8-$t9 24-25 more temporaries $k0-$k1 26-27 OS temporaries $gp 28 global pointer $sp 29 stack pointer $fp 30 frame pointer $ra 31 procedure return address S. Reda EN164 Sp 11 5

Format of R-type instructions Register-type 3 register operands: rs, rt: source registers rd: destination register Other fields: op: the operation code or opcode (0 for R-type instructions) funct: the function together, the opcode and function tell the computer what operation to perform shamt: the shift amount for shift instructions, otherwise it s 0 S. Reda EN164 Sp 11 6

R-Type examples Note the order of registers in the assembly code: add rd, rs, rt S. Reda EN164 Sp 11 7

Memory operands Too much data to fit in only 32 registers Memory is large, but slow Commonly used variables kept in registers Using a combination of registers and memory, a program can access a large amount of data fairly quickly To apply arithmetic operations Load values from memory into registers Store result from register to memory S. Reda EN164 Sp 11 8

Word-addressable memory Each 32-bit data word has a unique address S. Reda EN164 Sp 11 9

Reading word-addressable memory Memory reads are called loads Mnemonic: load word (lw) Example: read a word of data at memory address 1 into $s3 Memory address calculation: add the base address ($0) to the offset (1) address = ($0 + 1) = 1 Any register may be used to store the base address. $s3 holds the value 0xF2F1AC07 after the instruction completes. Assembly code lw $s3, 1($0) # read memory word 1 into $s3 S. Reda EN164 Sp 11 10

Writing word-addressable memory Memory writes are called stores Mnemonic: store word (sw) Example: Write (store) the value held in $t4 into memory address 7 Offset can be written in decimal (default) or hexadecimal Memory address calculation: add the base address ($0) to the offset (0x7) address: ($0 + 0x7) = 7 Any register may be used to store the base address Assembly code sw $t4, 0x7($0) # write the value in $t4 # to memory word 7 S. Reda EN164 Sp 11 11

Byte-addressable memory Each data byte has a unique address Load/store words or single bytes: load byte (lb) and store byte (sb) Each 32-bit words has 4 bytes, so the word address increments by 4 S. Reda EN164 Sp 11 12

Reading byte-addressable memory The address of a memory word must now be multiplied by 4. For example, the address of memory word 2 is 2 4 = 8 the address of memory word 10 is 10 4 = 40 (0x28) Load a word of data at memory address 4 into $s3. $s3 holds the value 0xF2F1AC07 after the instruction completes. MIPS is byte-addressed, not word-addressed. Though in our lab implementation, we can modify it to be word-addressed by customizing the RAM memory blocks MIPS assembly code lw $s3, 4($0) # read word at address 4 into $s3 S. Reda EN164 Sp 11 13

Writing byte-addressed memory Example: stores the value held in $t7 into memory address 0x2C (44) MIPS assembly code sw $t7, 44($0) # write $t7 into address 44 S. Reda EN164 Sp 11 14

Big-Endian and little-endian How to number bytes within a word? Word address is the same for big- or little-endian Little-endian: byte numbers start at the little (least significant) end Big-endian: byte numbers start at the big (most significant) end S. Reda EN164 Sp 11 15

Big- and little- Endian example Suppose $t0 initially contains 0x23456789. After the following program is run on a big-endian system, what value does $s0 contain? In a little-endian system? sw $t0, 0($0) lb $s0, 1($0) Big-endian: 0x00000045 Little-endian: 0x00000067 S. Reda EN164 Sp 11 16

Design principle 4 in action Good design demands good compromises - Multiple instruction formats allow flexibility - add, sub: use 3 register operands - lw, sw: use 2 register operands and a constant - Number of instruction formats kept small - to adhere to design principles 1 and 3 (simplicity favors regularity and smaller is faster). S. Reda EN164 Sp 11 17

Constant/Immediate operands lw and sw illustrate the use of constants or immediates Called immediates because they are immediately available from the instruction Immediates don t require a register or memory access. The add immediate (addi) instruction adds an immediate to a variable (held in a register). An immediate is a 16-bit two s complement number. Is subtract immediate (subi) necessary? High-level code a = a + 4; b = a 12; MIPS assembly code # $s0 = a, $s1 = b addi $s0, $s0, 4 addi $s1, $s0, -12 S. Reda EN164 Sp 11 18

I-Type format instructions Immediate-type 3 operands: rs, rt: register operands imm: 16-bit two s complement immediate Other fields: op: the opcode Simplicity favors regularity: all instructions have opcode Operation is completely determined by the opcode S. Reda EN164 Sp 11 19

I-Type examples Note the differing order of registers in the assembly and machine codes: addi rt, rs, imm lw sw rt, imm(rs) rt, imm(rs) S. Reda EN164 Sp 11 20