Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

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

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

Computer Organization MIPS ISA

Instructions: Language of the Computer

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

CENG3420 Lecture 03 Review

Chapter 2A Instructions: Language of the Computer

Instructions: Language of the Computer

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

Instructions: Language of the Computer

Course Administration

Computer Architecture

ECE331: Hardware Organization and Design

MIPS Instruction Set Architecture (1)

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

CENG3420 L03: Instruction Set Architecture

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CS3350B Computer Architecture MIPS Instruction Representation

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

MIPS Memory Access Instructions

ECE232: Hardware Organization and Design

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Reduced Instruction Set Computer (RISC)

Chapter 2: Instructions:

Reduced Instruction Set Computer (RISC)

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

Unsigned Binary Integers

Unsigned Binary Integers

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

Do-While Example. In C++ In assembly language. do { z--; while (a == b); z = b; loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero

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

Rechnerstrukturen. Chapter 2. Instructions: Language of the Computer

CS3350B Computer Architecture MIPS Introduction

Instruction Set Architecture

Levels of Programming. Registers

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Five classic components

Chapter 4. The Processor. Computer Architecture and IC Design Lab

CS3350B Computer Architecture

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

Control Instructions

ECE232: Hardware Organization and Design

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

Architecture I. Computer Systems Laboratory Sungkyunkwan University

CSEE 3827: Fundamentals of Computer Systems

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

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

ECE 154A Introduction to. Fall 2012

MIPS%Assembly% E155%

ECE 486/586. Computer Architecture. Lecture # 7

Computer Architecture. The Language of the Machine

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

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

CS222: MIPS Instruction Set

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

ECE232: Hardware Organization and Design

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

Lecture 4: MIPS Instruction Set

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

Lecture 4: Instruction Set Architecture

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

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

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

Computer Hardware Engineering

Instruction Set Principles and Examples. Appendix B

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

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

Operations, Operands, and Instructions

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

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Computer Architecture Instruction Set Architecture part 2. Mehran Rezaei

Instruction Set Architecture (ISA)

Lecture 5: Procedure Calls

The Single Cycle Processor

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

Grading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off.

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

EC 413 Computer Organization

ECE260: Fundamentals of Computer Engineering

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Typical Processor Execution Cycle

Computer Organization and Components

EEC 581 Computer Architecture Lecture 1 Review MIPS

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

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

ECE260: Fundamentals of Computer Engineering

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

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

Instruction encoding. MIPS Instruction encoding

Systems Architecture I

Computer Architecture

All instructions have 3 operands Operand order is fixed (destination first)

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

Course Administration

COMPUTER ORGANIZATION AND DESIGN

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

CS4617 Computer Architecture

Computer Architecture. MIPS Instruction Set Architecture

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

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

Transcription:

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro II Lect 10 Feb 15, 2008 Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L10.1 Smith Spring 2008

MIPS Data Types Bit: 0, 1 Bit String: sequence of bits of a particular length 4 bits is a nibble 8 bits is a byte 16 bits is a half-word 32 bits (4 bytes) is a word 64 bits is a double-word Character: ASCII 7 bit code Decimal: digits 0-9 encoded as 0000b thru 1001b two decimal digits packed per 8 bit byte Integers: 2's complement Floating Point M230 L10.2 Smith Spring 2008

Review: MIPS R3000 Instruction Set Architecture Instruction Categories Load/Store Computational Jump and Branch Floating Point - coprocessor Memory Management Special Registers R0 - R31 PC HI LO 3 Instruction Formats: all 32 bits wide OP OP OP rs rt rd sa funct rs rt immediate jump target M230 L10.3 Smith Spring 2008

MIPS Instructions, so far Category Instr Op Code Example Meaning Arithmetic (R format) add subtract 0 and 32 0 and 34 add $s1, $s2, $s3 sub $s1, $s2, $s3 $s1 = $s2 + $s3 $s1 = $s2 - $s3 Data transfer (I format) load word store word 35 43 lw $s1, 100($s2) sw $s1, 100($s2) $s1 = Memory($s2+100) Memory($s2+100) = $s1 M230 L10.4 Smith Spring 2008

Processor Memory Interconnections Memory is viewed as a large, single-dimension array, with an address A memory address is an index into the array read addr/ write addr Processor read data Memory? # of words? write data 32 bits M230 L10.6 Smith Spring 2008

Processor Memory Interconnections Memory is viewed as a large, single-dimension array, with an address A memory address is an index into the array read addr/ write addr 32 Processor read data Memory? # of words? write data 32 bits M230 L10.6 Smith Spring 2008

Processor Memory Interconnections Memory is viewed as a large, single-dimension array, with an address A memory address is an index into the array read addr/ write addr 32 Processor read data 32 Memory? # of words? write data 32 bits M230 L10.6 Smith Spring 2008

Processor Memory Interconnections Memory is viewed as a large, single-dimension array, with an address A memory address is an index into the array read addr/ write addr 32 Processor read data 32 Memory? # of words? 32 write data 32 bits M230 L10.6 Smith Spring 2008

Processor Memory Interconnections Memory is viewed as a large, single-dimension array, with an address A memory address is an index into the array read addr/ write addr 32 Processor read data 32 Memory? 2 32 2 30 words # of words? 32 write data 32 bits M230 L10.6 Smith Spring 2008

Review: Naming Conventions for Registers 0 $zero constant 0 (Hdware) 1 $at reserved for assembler 2 $v0 expression evaluation & 3 $v1 function results 4 $a0 arguments 5 $a1 6 $a2 7 $a3 8 $t0 temporary: caller saves... (callee can clobber) 15 $t7 16 $s0 callee saves... (caller can clobber) 23 $s7 24 $t8 temporary (cont d) 25 $t9 26 $k0 reserved for OS kernel 27 $k1 28 $gp pointer to global area 29 $sp stack pointer 30 $fp frame pointer 31 $ra return address (Hdware) M230 L10.7 Smith Spring 2008

Byte Addresses Since 8-bit bytes are so useful, most architectures address individual bytes in memory Therefore, the memory address of a word must be a multiple of 4 (alignment restriction) Big Endian: leftmost byte is word address IBM 360/370, Motorola 68k, MIPS, Sparc, HP PA Little Endian: rightmost byte is word address Intel 80x86, DEC Vax, DEC Alpha (Windows NT) M230 L10.8 Smith Spring 2008

M230 L10.9 Smith Spring 2008

Addressing Objects: Endianess and Alignment Big Endian: Little Endian: leftmost byte is word address rightmost byte is word address msb lsb Aligned 0 1 2 3 Alignment restriction: requires that objects fall on address that is multiple of their size. Not Aligned M230 L10.11 Smith Spring 2008

Addressing Objects: Endianess and Alignment Big Endian: Little Endian: leftmost byte is word address rightmost byte is word address 3 2 1 0 little endian byte 0 msb lsb Aligned 0 1 2 3 Alignment restriction: requires that objects fall on address that is multiple of their size. Not Aligned M230 L10.11 Smith Spring 2008

Addressing Objects: Endianess and Alignment Big Endian: Little Endian: leftmost byte is word address rightmost byte is word address 3 2 1 0 little endian byte 0 msb lsb 0 1 2 3 big endian byte 0 Aligned 0 1 2 3 Alignment restriction: requires that objects fall on address that is multiple of their size. Not Aligned M230 L10.11 Smith Spring 2008

Addressing Objects: Endianess and Alignment Big Endian: Little Endian: leftmost byte is word address rightmost byte is word address 3 2 1 0 little endian byte 0 msb lsb 0 1 2 3 big endian byte 0 Aligned 0 1 2 3 Alignment restriction: requires that objects fall on address that is multiple of their size. Not Aligned M230 L10.11 Smith Spring 2008

MIPS Memory Addressing The memory address is formed by summing the constant portion of the instruction and the contents of the second (base) register $s3 holds 8 Memory... 0 1 1 0... 0 1 0 1... 1 1 0 0... 0 0 0 1... 0 0 1 0... 1 0 0 0... 0 1 0 0 Data 24 20 16 12 8 4 0 Word Address lw $t0, 4($s3) #what? is loaded into $t0 sw $t0, 8($s3) #$t0 is stored where? M230 L10.14 Smith Spring 2008

MIPS Memory Addressing The memory address is formed by summing the constant portion of the instruction and the contents of the second (base) register $s3 holds 8 Memory... 0 1 1 0... 0 1 0 1... 1 1 0 0... 0 0 0 1... 0 0 1 0... 1 0 0 0... 0 1 0 0 Data 0 Word Address... 0001 lw $t0, 4($s3) #what? is loaded into $t0 sw $t0, 8($s3) #$t0 is stored where? 24 20 16 12 8 4 M230 L10.14 Smith Spring 2008

MIPS Memory Addressing The memory address is formed by summing the constant portion of the instruction and the contents of the second (base) register $s3 holds 8 Memory... 0 1 1 0... 0 1 0 1... 1 1 0 0... 0 0 0 1... 0 0 1 0... 1 0 0 0... 0 1 0 0 Data 0 Word Address... 0001 lw $t0, 4($s3) #what? is loaded into $t0 sw $t0, 8($s3) #$t0 is stored where? in location 16 M230 L10.14 Smith Spring 2008 24 20 16 12 8 4

MIPS Memory Addressing The memory address is formed by summing the constant portion of the instruction and the contents of the second (base) register $s3 holds 8... 0001 Memory... 0 1 1 0... 0 1 0 1... 1 1 0 0... 0 0 0 1... 0 0 1 0... 1 0 0 0... 0 1 0 0 Data 0 Word Address... 0001 lw $t0, 4($s3) #what? is loaded into $t0 sw $t0, 8($s3) #$t0 is stored where? in location 16 M230 L10.14 Smith Spring 2008 24 20 16 12 8 4

Compiling with Loads and Stores Assuming variable b is stored in $s2 and that the base address of array A is in $s3, what is the MIPS assembly code for the C statement A[8] = A[2] - b... A[3] A[2] A[1] A[0]... $s3+12 $s3+8 $s3+4 $s3 M230 L10.16 Smith Spring 2008

Compiling with Loads and Stores Assuming variable b is stored in $s2 and that the base address of array A is in $s3, what is the MIPS assembly code for the C statement A[8] = A[2] - b... A[3] A[2] A[1] A[0]... $s3+12 $s3+8 $s3+4 $s3 lw $t0, 8($s3) sub $t0, $t0, $s2 sw $t0, 32($s3) M230 L10.16 Smith Spring 2008

Compiling with a Variable Array Index Assuming A is an array of 50 elements whose base is in register $s4, and variables b, c, and i are in $s1, $s2, and $s3, respectively, what is the MIPS assembly code for the C statement c = A[i] - b add $t1, $s3, $s3 #array index i is in $s3 add $t1, $t1, $t1 #temp reg $t1 holds 4*i M230 L10.18 Smith Spring 2008

Compiling with a Variable Array Index Assuming A is an array of 50 elements whose base is in register $s4, and variables b, c, and i are in $s1, $s2, and $s3, respectively, what is the MIPS assembly code for the C statement c = A[i] - b add $t1, $s3, $s3 #array index i is in $s3 add $t1, $t1, $t1 #temp reg $t1 holds 4*i add $t1, $t1, $s4 #addr of A[i] lw $t0, 0($t1) sub $s2, $t0, $s1 M230 L10.18 Smith Spring 2008

Review: Unsigned Binary Representation Hex Binary Decimal 0x00000000 0 0000 0 0x00000001 0 0001 1 2 31 2 30 2 29... 2 3 2 2 2 1 2 0 bit weight 0x00000002 0x00000003 0x00000004 0 0010 0 0011 0 0100 2 3 4 31 30 29... 3 2 1 0 bit position 1 1 1... 1 1 1 1 bit 0x00000005 0 0101 5 0x00000006 0x00000007 0 0110 0 0111 6 7 1 0 0 0... 0 0 0 0-1 0x00000008 0 1000 8 0x00000009 0 1001 9 2 32-1 0xFFFFFFFC 0xFFFFFFFD 1 1100 1 1101 2 32-4 2 32-3 0xFFFFFFFE 0xFFFFFFFF 1 1110 1 1111 2 32-2 2 32-1 M230 L10.19 Smith Spring 2008

Review: Signed Binary Representation 2 sc binary decimal -2 3 = 1000-8 -(2 3-1) = 1001-7 1010-6 1011-5 1100-4 1101-3 1110-2 1111-1 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 2 3-1 = 0111 7 M230 L10.20 Smith Spring 2008

Review: Signed Binary Representation 1010 complement all the bits 2 sc binary decimal -2 3 = 1000-8 -(2 3-1) = 1001-7 1010-6 1011-5 1100-4 1101-3 1110-2 1111-1 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 2 3-1 = 0111 7 M230 L10.20 Smith Spring 2008

Review: Signed Binary Representation 1011 and add a 1 1010 complement all the bits 2 sc binary decimal -2 3 = 1000-8 -(2 3-1) = 1001-7 1010-6 1011-5 1100-4 1101-3 1110-2 1111-1 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 2 3-1 = 0111 7 M230 L10.20 Smith Spring 2008

Machine Language - Arithmetic Instruction Instructions, like registers and words of data, are also 32 bits long Example: add $t0, $s1, $s2 registers have numbers $t0=$8, $s1=$17, $s2=$18 Instruction Format: op rs rt rd shamt funct 000000 10001 10010 01000 00000 100000 Can you guess what the field names stand for? M230 L10.22 Smith Spring 2008

Machine Language - Arithmetic Instruction Instructions, like registers and words of data, are also 32 bits long Example: add $t0, $s1, $s2 registers have numbers $t0=$8, $s1=$17, $s2=$18 Instruction Format: op rs rt rd shamt funct 000000 10001 10010 01000 00000 100000 Can you guess what the field names stand for? M230 L10.22 Smith Spring 2008

Machine Language - Arithmetic Instruction Instructions, like registers and words of data, are also 32 bits long Example: add $t0, $s1, $s2 registers have numbers $t0=$8, $s1=$17, $s2=$18 Instruction Format: op rs rt rd shamt funct 000000 10001 10010 01000 00000 100000 Can you guess what the field names stand for? M230 L10.22 Smith Spring 2008

Machine Language - Arithmetic Instruction Instructions, like registers and words of data, are also 32 bits long Example: add $t0, $s1, $s2 registers have numbers $t0=$8, $s1=$17, $s2=$18 Instruction Format: op rs rt rd shamt funct 000000 10001 10010 01000 00000 100000 Can you guess what the field names stand for? M230 L10.22 Smith Spring 2008

Machine Language - Arithmetic Instruction Instructions, like registers and words of data, are also 32 bits long Example: add $t0, $s1, $s2 registers have numbers $t0=$8, $s1=$17, $s2=$18 Instruction Format: op rs rt rd shamt funct 000000 10001 10010 01000 00000 100000 Can you guess what the field names stand for? M230 L10.22 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op rs rt rd shamt funct M230 L10.24 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op opcode indicating operation to be performed rs rt rd shamt funct M230 L10.24 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op rs rt opcode indicating operation to be performed address of the first register source operand rd shamt funct M230 L10.24 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op rs rt opcode indicating operation to be performed address of the first register source operand address of the second register source operand rd shamt funct M230 L10.24 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op rs rt rd opcode indicating operation to be performed address of the first register source operand address of the second register source operand the register destination address shamt funct M230 L10.24 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op rs rt rd shamt funct opcode indicating operation to be performed address of the first register source operand address of the second register source operand the register destination address shift amount (for shift instructions) M230 L10.24 Smith Spring 2008

MIPS Instruction Fields op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits = 32 bits op rs rt rd shamt funct opcode indicating operation to be performed address of the first register source operand address of the second register source operand the register destination address shift amount (for shift instructions) function code that selects the specific variant of the operation specified in the opcode field M230 L10.24 Smith Spring 2008

Machine Language - Load Instruction Consider the load-word and store-word instructions, What would the regularity principle have us do? New principle: Good design demands a compromise Introduce a new type of instruction format I-type for data transfer instructions previous format was R-type for register Example: lw $t0, 24($s2) op rs rt 16 bit number 35 18 8 24 100011 10010 01000 0000000000011000 Where's the compromise? M230 L10.26 Smith Spring 2008

Machine Language - Load Instruction Consider the load-word and store-word instructions, What would the regularity principle have us do? New principle: Good design demands a compromise Introduce a new type of instruction format I-type for data transfer instructions previous format was R-type for register Example: lw $t0, 24($s2) op rs rt 16 bit number 35 18 8 24 100011 10010 01000 0000000000011000 Where's the compromise? M230 L10.26 Smith Spring 2008

Machine Language - Load Instruction Consider the load-word and store-word instructions, What would the regularity principle have us do? New principle: Good design demands a compromise Introduce a new type of instruction format I-type for data transfer instructions previous format was R-type for register Example: lw $t0, 24($s2) op rs rt 16 bit number 35 18 8 24 100011 10010 01000 0000000000011000 Where's the compromise? M230 L10.26 Smith Spring 2008

Machine Language - Load Instruction Consider the load-word and store-word instructions, What would the regularity principle have us do? New principle: Good design demands a compromise Introduce a new type of instruction format I-type for data transfer instructions previous format was R-type for register Example: lw $t0, 24($s2) op rs rt 16 bit number 35 18 8 24 100011 10010 01000 0000000000011000 Where's the compromise? M230 L10.26 Smith Spring 2008

Machine Language - Load Instruction Consider the load-word and store-word instructions, What would the regularity principle have us do? New principle: Good design demands a compromise Introduce a new type of instruction format I-type for data transfer instructions previous format was R-type for register Example: lw $t0, 24($s2) op rs rt 16 bit number 35 18 8 24 100011 10010 01000 0000000000011000 Where's the compromise? M230 L10.26 Smith Spring 2008

Memory Address Location Example: lw $t0, 24($s2) 24 10 + $s2 = Memory 0xf f f f f f f f 0x00000002 $s2 0x12004094 Note that the offset can be positive or negative data 0x0000000c 0x00000008 0x00000004 0x00000000 word address (hex) M230 L10.28 Smith Spring 2008

Memory Address Location Example: lw $t0, 24($s2) 24 10 + $s2 = Memory 0xf f f f f f f f... 1001 0100 +... 0001 1000... 1010 1100 = 0x120040ac 0x00000002 $s2 0x12004094 Note that the offset can be positive or negative data 0x0000000c 0x00000008 0x00000004 0x00000000 word address (hex) M230 L10.28 Smith Spring 2008

Machine Language - Store Instruction Example: sw $t0, 24($s2) op rs rt 16 bit number 43 18 8 24 101011 10010 01000 0000000000011000 A 16-bit address means access is limited to memory locations within a region of ±2 13 or 8,192 words (±2 15 or 32,768 bytes) of the address in the base register $s2 M230 L10.30 Smith Spring 2008

Machine Language - Store Instruction Example: sw $t0, 24($s2) op rs rt 16 bit number 43 18 8 24 101011 10010 01000 0000000000011000 A 16-bit address means access is limited to memory locations within a region of ±2 13 or 8,192 words (±2 15 or 32,768 bytes) of the address in the base register $s2 M230 L10.30 Smith Spring 2008

Machine Language - Store Instruction Example: sw $t0, 24($s2) op rs rt 16 bit number 43 18 8 24 101011 10010 01000 0000000000011000 A 16-bit address means access is limited to memory locations within a region of ±2 13 or 8,192 words (±2 15 or 32,768 bytes) of the address in the base register $s2 M230 L10.30 Smith Spring 2008

Machine Language - Store Instruction Example: sw $t0, 24($s2) op rs rt 16 bit number 43 18 8 24 101011 10010 01000 0000000000011000 A 16-bit address means access is limited to memory locations within a region of ±2 13 or 8,192 words (±2 15 or 32,768 bytes) of the address in the base register $s2 M230 L10.30 Smith Spring 2008

Machine Language - Store Instruction Example: sw $t0, 24($s2) op rs rt 16 bit number 43 18 8 24 101011 10010 01000 0000000000011000 A 16-bit address means access is limited to memory locations within a region of ±2 13 or 8,192 words (±2 15 or 32,768 bytes) of the address in the base register $s2 M230 L10.30 Smith Spring 2008

Review: MIPS Organization Arithmetic instructions to/from the register file Load/store word and byte instructions from/to memory Processor Memory 1 1100 src1 addr src2 addr dst addr write data Exec Fetch 5 5 5 32 Register File 32 registers ($zero - $ra) Decode 32 bits 32 32 src1 data src2 data read/write addr 32 read data 32 write data 32 32 ALU 32 4 5 6 7 32 0 1 2 3 byte address (big Endian) 32 bits 0 1100 0 1000 0 0100 0 0000 2 30 words word address (binary) M230 L10.31 Smith Spring 2008