CSE331 W02.1Irwin&Li 2006 PSU CSE 331 Computer Organization and Design Fall 2006 Adaptado a DSD. R. Pereira Section 1: Mary Jane Irwin (www.cse.psu.edu/~mji)www.cse.psu.edu/~mji.

Slides:



Advertisements
Similar presentations
Goal: Write Programs in Assembly
Advertisements

1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
Systems Architecture Lecture 5: MIPS Instruction Set
Chapter 2 Instructions: Language of the Computer
Chapter 2.
CSE 340 Computer Architecture Spring 2014 MIPS ISA Review
331 W08.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 8: Datapath Design [Adapted from Dave Patterson’s UCB CS152.
Chapter 2 Instructions: Language of the Computer Part III.
The Processor: Datapath & Control
ENEE350 Spring07 1 Ankur Srivastava University of Maryland, College Park Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005.”
331 W02.1Spring 05 Announcements  HW1 is due on this Friday  Appendix A (on CD) is very helpful to HW1.
1 CSE SUNY New Paltz Chapter 3 Machine Language Instructions.
OK, we are now ready to begin Chapter 2 of our text
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
331 W02.1Fall 2003 Announcements  HW1 is due on this Friday (Sept 12 th )  Appendix A is very helpful to HW1. Check out system calls on Page A-48. 
331 Practice Exam.1Fall 2003 Naming Conventions for Registers 0$zero constant 0 (Hdware) 1$atreserved for assembler 2$v0expression evaluation & 3$v1function.
ISA-2 CSCE430/830 MIPS: Case Study of Instruction Set Architecture CSCE430/830 Computer Architecture Instructor: Hong Jiang Courtesy of Prof. Yifeng Zhu.
Lecture 4 section 2.4-?? As opposed to CISC – Complicated Instruction Set Architecture (ala the x86)
MIPS assembly. Computer What’s in a computer? Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
CDA 3101 Fall 2012 Introduction to Computer Organization Instruction Set Architecture MIPS Instruction Format 04 Sept 2013.
CS224 Fall 2011 Chap 2a Computer Organization CS224 Fall 2011 Chapter 2 a With thanks to M.J. Irwin, D. Patterson, and J. Hennessy for some lecture slide.
CSE331 W02.1Irwin Fall 2001 PSU Computer Architecture Discussion Lecture # 2 MIPS Programming.
08/08/ COM181 Computer Hardware Lecture 4: The MIPs CPU Ian McCrumRoom 5B18, Tel: voice mail.
1 CS/EE 362 Hardware Fundamentals Lecture 10 (Chapter 3: Hennessy and Patterson) Winter Quarter 1998 Chris Myers.
1 Computer Architecture COSC 3430 Lecture 3: Instructions.
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /08/2013 Lecture 10: MIPS Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL STATE.
 1998 Morgan Kaufmann Publishers MIPS arithmetic All instructions have 3 operands Operand order is fixed (destination first) Example: C code: A = B +
Computer Organization Rabie A. Ramadan Lecture 3.
EE472 – Spring 2007P. Chiang, with Slide Help from C. Kozyrakis (Stanford) ECE472 Computer Architecture Lecture #3—Oct. 2, 2007 Patrick Chiang TA: Kang-Min.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
CSE331 W10.1Irwin&Li Fall 2006 PSU CSE 331 Computer Organization and Design Fall 2006 Week 10 Section 1: Mary Jane Irwin (
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
Instruction Set Architecture Chapter 3 – P & H. Introduction Instruction set architecture interface between programmer and CPU Good ISA makes program.
CSE331 W02.1Irwin 2007 PSU CSE 331 Computer Organization and Design Fall 2007 Week 2 Section 1: Mary Jane Irwin (
CS35101 Computer Architecture Spring 2006 Week 2.
Computer Architecture & Operations I
Computer Architecture & Operations I
MIPS Assembly.
Instruction Set Architecture
Morgan Kaufmann Publishers
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
The University of Adelaide, School of Computer Science
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
CSCI206 - Computer Organization & Programming
Systems Architecture Lecture 5: MIPS Instruction Set
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
Chapter 2 Instructions: Language of the Computer
Computer Instructions
Computer Architecture
September 17 Test 1 pre(re)view Fang-Yi will demonstrate Spim
UCSD ECE 111 Prof. Farinaz Koushanfar Fall 2018
COMS 361 Computer Organization
COMS 361 Computer Organization
CPU Structure CPU must:
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Presentation transcript:

CSE331 W02.1Irwin&Li 2006 PSU CSE 331 Computer Organization and Design Fall 2006 Adaptado a DSD. R. Pereira Section 1: Mary Jane Irwin ( Section 2: Feihui Li ( ) Course material on ANGEL: cms.psu.edu [ adapted from D. Patterson slides ]

CSE331 W02.2Irwin&Li 2006 PSU Review: Execute Cycle Processor Control Datapath Memory contents Reg #4 ADD contents Reg #2 results put in Reg #2 The datapath executes the instructions as directed by control Memory stores both instructions and data Devices Input Output Network

CSE331 W02.3Irwin&Li 2006 PSU Review: Processor Organization  Control needs to have circuitry to l Decide which is the next instruction and input it from memory l Decode the instruction l Issue signals that control the way information flows between datapath components l Control what operations the datapath’s functional units perform l Execute instructions - functional units (e.g., adder) and storage locations (e.g., register file) l Interconnect the functional units so that the instructions can be executed as required l Load data from and store data to memory  Datapath needs to have circuitry to Fetch DecodeExec

CSE331 W02.4Irwin&Li 2006 PSU Assembly Language Instructions  The language of the machine l Want an ISA that makes it easy to build the hardware and the compiler while maximizing performance and minimizing cost  Stored program (von Neumann) concept l Instructions are stored in memory (as is the data)  Our target: the MIPS ISA l similar to other ISAs developed since the 1980's l used by Broadcom, Cisco, NEC, Nintendo, Sony, … Design goals: maximize performance, minimize cost, reduce design time (time-to-market), minimize memory space (embedded systems), minimize power consumption (mobile systems)

CSE331 W02.5Irwin&Li 2006 PSU RISC - Reduced Instruction Set Computer  RISC philosophy l fixed instruction lengths l load-store instruction sets l limited number of addressing modes l limited number of operations  MIPS, Sun SPARC, HP PA-RISC, IBM PowerPC …  Instruction sets are measured by how well compilers use them as opposed to how well assembly language programmers use them  CISC (C for complex), e.g., Intel x86

CSE331 W02.6Irwin&Li 2006 PSU The Four Design Principles 1. Simplicity favors regularity. 2. Smaller is faster. 3. Make the common case fast. 4. Good design demands good compromises.

CSE331 W02.7Irwin&Li 2006 PSU MIPS Arithmetic Instruction  MIPS assembly language arithmetic statement add$t0, $s1, $s2 sub$t0, $s1, $s2  Each arithmetic instruction performs only one operation  Each arithmetic instruction specifies exactly three operands destination  source1 op source2 l Operand order is fixed (the destination is specified first)  The operands are contained in the datapath’s register file ( $t0, $s1, $s2 )

CSE331 W02.8Irwin&Li 2006 PSU MIPS Arithmetic Instruction  MIPS assembly language arithmetic statement add$t0, $s1, $s2 sub$t0, $s1, $s2  Each arithmetic instruction performs only one operation  Each arithmetic instruction specifies exactly three operands destination  source1 op source2 l Operand order is fixed (the destination is specified first)  The operands are contained in the datapath’s register file ( $t0, $s1, $s2 )

CSE331 W02.9Irwin&Li 2006 PSU Compiling More Complex Statements  Assuming variable b is stored in register $s1, c is stored in $s2, and d is stored in $s3 and the result is to be left in $s0, what is the assembler equivalent to the C statement h = (b - c) + d

CSE331 W02.10Irwin&Li 2006 PSU Compiling More Complex Statements  Assuming variable b is stored in register $s1, c is stored in $s2, and d is stored in $s3 and the result is to be left in $s0, what is the assembler equivalent to the C statement h = (b - c) + d sub$t0, $s1, $s2 add$s0, $t0, $s3

CSE331 W02.11Irwin&Li 2006 PSU MIPS Register File  Operands of arithmetic instructions must be from a limited number of special locations contained in the datapath’s register file l Thirty-two 32-bit registers -Two read ports -One write port  Registers are l Fast -Smaller is faster & Make the common case fast l Easy for a compiler to use -e.g., (A*B) – (C*D) – (E*F) can do multiplies in any order l Improves code density -Since register are named with fewer bits than a memory location  Register addresses are indicated by using $

CSE331 W02.12Irwin&Li 2006 PSU MIPS Register File  Operands of arithmetic instructions must be from a limited number of special locations contained in the datapath’s register file l Thirty-two 32-bit registers -Two read ports -One write port  Registers are l Fast -Smaller is faster & Make the common case fast l Easy for a compiler to use -e.g., (A*B) – (C*D) – (E*F) can do multiplies in any order l Improves code density -Since register are named with fewer bits than a memory location  Register addresses are indicated by using $ Register File src1 addr src2 addr dst addr write data 32 bits src1 data src2 data 32 locations

CSE331 W02.13Irwin&Li 2006 PSU 0$zero constant 0 (Hdware) 1$atreserved for assembler 2$v0expression evaluation & 3$v1function results 4$a0arguments 5$a1 6$a2 7$a3 8$t0temporary: caller saves...(callee can clobber) 15$t7 Naming Conventions for Registers 16$s0callee saves... (caller can clobber) 23$s7 24$t8 temporary (cont’d) 25$t9 26$k0reserved for OS kernel 27$k1 28$gppointer to global area 29$spstack pointer 30$fpframe pointer 31$rareturn address (Hdware)

CSE331 W02.14Irwin&Li 2006 PSU Registers vs. Memory  Arithmetic instructions operands must be in registers l only thirty-two registers are provided  Compiler associates variables with registers  What about programs with lots of variables? Processor Control Datapath Memory Devices Input Output Network

CSE331 W02.15Irwin&Li 2006 PSU Registers vs. Memory  Arithmetic instructions operands must be in registers l only thirty-two registers are provided  Compiler associates variables with registers  What about programs with lots of variables? Processor Control Datapath Memory Devices Input Output Network

CSE331 W02.16Irwin&Li 2006 PSU  Memory is a large, single-dimensional array  An address acts as the index into the memory array Processor – Memory Interconnections Processor Memory 32 bits ? locations read addr/ write addr read data write data

CSE331 W02.17Irwin&Li 2006 PSU  Memory is a large, single-dimensional array  An address acts as the index into the memory array Processor – Memory Interconnections Processor Memory 32 bits ? locations read addr/ write addr read data write data Bytes (4 GB)  2 30 Words (1 GW) = 4 Bytes = 1 Word The data stored in the memory The word address of the data

CSE331 W02.18Irwin&Li 2006 PSU  MIPS has two basic data transfer instructions for accessing memory (assume $s3 holds ) lw$t0, 4($s3) #load word from memory sw$t0, 8($s3) #store word to memory  The data transfer instruction must specify l where in memory to read from (load) or write to (store) – memory address l where in the register file to write to (load) or read from (store) – register destination (source)  The memory address is formed by summing the constant portion of the instruction and the contents of the second register Accessing Memory

CSE331 W02.19Irwin&Li 2006 PSU  MIPS has two basic data transfer instructions for accessing memory (assume $s3 holds ) lw$t0, 4($s3) #load word from memory sw$t0, 8($s3) #store word to memory  The data transfer instruction must specify l where in memory to read from (load) or write to (store) – memory address l where in the register file to write to (load) or read from (store) – register destination (source)  The memory address is formed by summing the constant portion of the instruction and the contents of the second register Accessing Memory 28 32

CSE331 W02.20Irwin&Li 2006 PSU MIPS Memory Addressing  The memory address is formed by summing the constant portion of the instruction and the contents of the second (base) register lw$t0, 4($s3) #what? is loaded into $t0 sw$t0, 8($s3) #$t0 is stored where? Memory DataWord Address $s3 holds 8

CSE331 W02.21Irwin&Li 2006 PSU MIPS Memory Addressing  The memory address is formed by summing the constant portion of the instruction and the contents of the second (base) register lw$t0, 4($s3) #what? is loaded into $t0 sw$t0, 8($s3) #$t0 is stored where? Memory bit DataWord Address $s3 holds 8 in location

CSE331 W02.22Irwin&Li 2006 PSU 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 $s3 $s3 +4 $s3 +8 $s A[2] A[3]... A[1] A[0]

CSE331 W02.23Irwin&Li 2006 PSU 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 $s3 $s3 +4 $s3 +8 $s A[2] A[3]... A[1] A[0] lw$t0, 8($s3) sub$t0, $t0, $s2 sw$t0, 32($s3)

CSE331 W02.24Irwin&Li 2006 PSU Compiling with a Variable Array Index  Assuming that the base address of array A 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 $s4 $s4 +4 $s4 +8 $s A[2] A[3]... A[1] A[0]

CSE331 W02.25Irwin&Li 2006 PSU Compiling with a Variable Array Index  Assuming that the base address of array A 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 $s4 $s4 +4 $s4 +8 $s A[2] A[3]... A[1] A[0] add$t1, $t1, $s4#addr of A[i] now in $t1 lw$t0, 0($t1) sub$s2, $t0, $s1

CSE331 W02.26Irwin&Li 2006 PSU  Small constants are used quite frequently (50% of operands in many common programs) e.g., A = A + 5; B = B + 1; C = C - 18;  Solutions? Why not? l Put “typical constants” in memory and load them l Create hard-wired registers (like $zero) for constants like 1, 2, 4, 10, … Dealing with Constants  How do we make this work?  How do we Make the common case fast !

CSE331 W02.27Irwin&Li 2006 PSU  Include constants inside arithmetic instructions l Much faster than if they have to be loaded from memory (they come in from memory with the instruction itself)  MIPS immediate instructions addi$s3, $s3, 4#$s3 = $s3 + 4  There is no subi instruction, can you guess why not? Constant (or Immediate) Operands

CSE331 W02.28Irwin&Li 2006 PSU MIPS Instructions, so far CategoryInstrExampleMeaning Arithmeticaddadd $s1, $s2, $s3$s1 = $s2 + $s3 subtractsub $s1, $s2, $s3$s1 = $s2 - $s3 add immediate addi $s1, $s2, 4$s1 = $s2 + 4 Data transfer load wordlw $s1, 32($s2)$s1 = Memory($s2+32) store wordsw $s1, 32($s2)Memory($s2+32) = $s1

CSE331 W02.29Irwin&Li 2006 PSU End of Lecture #3

CSE331 W02.30Irwin&Li 2006 PSU In may ways, legacy code is a more difficult target for a new microarchitecture. A mountain of x86 code has accumulated since the 1970s. Designing an engine to correctly run both legacy code and modern compiled code at world-class performance levels is like designing a new jet fighter to run on anything from jet-A fuel to whale blubber and coal. Bob Colwell, The Pentium Chronicles

CSE331 W02.31Irwin&Li 2006 PSU Review: MIPS Organization Processor Memory 32 bits 2 30 words read/write addr read data write data word address (binary) 0…0000 0…0100 0…1000 0…1100 1…1100 Register File src1 addr src2 addr dst addr write data 32 bits src1 data src2 data 32 registers ($zero - $ra) ALU byte address (big Endian)  Arithmetic instructions – to/from the register file  Load/store instructions - to/from memory

CSE331 W02.32Irwin&Li 2006 PSU Review: Unsigned Binary Representation HexBinaryDecimal 0x … x … x … x … x … x … x … x … x … x …10019 … 0xFFFFFFFC1…1100 0xFFFFFFFD1…1101 0xFFFFFFFE1…1110 0xFFFFFFFF1… bit bit position bit weight

CSE331 W02.33Irwin&Li 2006 PSU Review: Signed Binary Representation 2’sc binarydecimal = -( ) = -2 3 = 1010 complement all the bits 1011 and add a 1 complement all the bits 0101 and add a

CSE331 W02.34Irwin&Li 2006 PSU  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: Can you guess what the field names stand for? Machine Language - Arithmetic Instruction op rs rt rd shamt funct

CSE331 W02.35Irwin&Li 2006 PSU  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: Can you guess what the field names stand for? Machine Language - Arithmetic Instruction op rs rt rd shamt funct

CSE331 W02.36Irwin&Li 2006 PSU MIPS Instruction Fields  op  rs  rt  rd  shamt  funct op rs rt rd shamt funct 6 bits5 bits 6 bits= 32 bits

CSE331 W02.37Irwin&Li 2006 PSU MIPS Instruction Fields  op  rs  rt  rd  shamt  funct op rs rt rd shamt funct 6 bits5 bits 6 bits= 32 bits 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 amoun t (for shift instructions) function code that selects the specific variant of the operation specified in the opcode field

CSE331 W02.38Irwin&Li 2006 PSU  Consider the load-word and store-word instr’s l What would the regularity principle have us do? -But... Good design demands compromise  Introduce a new type of instruction format l I-type for data transfer instructions (previous format was R-type for register)  Example: lw $t0, 24($s2) Where's the compromise? Machine Language - Load Instruction op rs rt 16 bit number 23 hex

CSE331 W02.39Irwin&Li 2006 PSU  Consider the load-word and store-word instr’s l What would the regularity principle have us do? -But... Good design demands compromise  Introduce a new type of instruction format l I-type for data transfer instructions (previous format was R-type for register)  Example: lw $t0, 24($s2) Where's the compromise? Machine Language - Load Instruction op rs rt 16 bit number 23 hex

CSE331 W02.40Irwin&Li 2006 PSU Memory Address Location  Example: lw $t0, 24($s2) Memory dataword address (hex) 0x x x x c 0xf f f f f f f f $s2 0x x $s2 = Note that the offset can be positive or negative

CSE331 W02.41Irwin&Li 2006 PSU Memory Address Location  Example: lw $t0, 24($s2) Memory dataword address (hex) 0x x x x c 0xf f f f f f f f $s2 0x x $s2 = Note that the offset can be positive or negative = 0x120040ac $t0

CSE331 W02.42Irwin&Li 2006 PSU  Example: sw $t0, 24($s2)  A 16-bit offset means access is limited to memory locations within a range of  2 13 = 8,192 words (  2 15 = 32,768 bytes) of the address in the base register $s2 l 2’s complement (1 sign bit + 15 magnitude bits) Machine Language - Store Instruction op rs rt 16 bit number

CSE331 W02.43Irwin&Li 2006 PSU  Example: sw $t0, 24($s2)  A 16-bit offset means access is limited to memory locations within a range of to (~8,192) words ( to (~32,768) bytes) of the address in the base register $s2 l 2’s complement (1 sign bit + 15 magnitude bits) Machine Language - Store Instruction op rs rt 16 bit number

CSE331 W02.44Irwin&Li 2006 PSU  What instruction format is used for the addi ? addi$s3, $s3, 4#$s3 = $s3 + 4  Machine format: Machine Language – Immediate Instructions

CSE331 W02.45Irwin&Li 2006 PSU  What instruction format is used for the addi ? addi$s3, $s3, 4#$s3 = $s3 + 4  Machine format: Machine Language – Immediate Instructions op rs rt 16 bit immediate I format  The constant is kept inside the instruction itself! l So must use the I format – Immediate format l Limits immediate values to the range –1 to -2 15

CSE331 W02.46Irwin&Li 2006 PSU Instruction Format Encoding  Can reduce the complexity with multiple formats by keeping them as similar as possible l First three fields are the same in R-type and I-type  Each format has a distinct set of values in the op field InstrFrmtoprsrtrdshamtfunctaddress add R0reg 032 ten NA sub R0reg 034 ten NA addi I8 ten reg NA constant lw I35 ten reg NA address sw I43 ten reg NA address

CSE331 W02.47Irwin&Li 2006 PSU Assembling Code  Remember the assembler code we compiled last lecture for the C statement A[8] = A[2] - b lw$t0, 8($s3)#load A[2] into $t0 sub$t0, $t0, $s2#subtract b from A[2] sw$t0, 32($s3)#store result in A[8]  Assemble the MIPS object code for these three instructions (decimal is fine) lw sw sub

CSE331 W02.48Irwin&Li 2006 PSU Assembling Code  Remember the assembler code we compiled last lecture for the C statement A[8] = A[2] - b lw$t0, 8($s3)#load A[2] into $t0 sub$t0, $t0, $s2#subtract b from A[2] sw$t0, 32($s3)#store result in A[8]  Assemble the MIPS object code for these three instructions (decimal is fine) 35 lw sw sub

CSE331 W02.49Irwin&Li 2006 PSU Review: MIPS Instructions, so far CategoryInstrOp Code ExampleMeaning Arithmetic (R format) add0 & 32 add $s1, $s2, $s3$s1 = $s2 + $s3 subtract0 & 34 sub $s1, $s2, $s3$s1 = $s2 - $s3 Arithmetic (I format) add immediate 8addi $s1, $s2, 4$s1 = $s2 + 4 Data transfer (I format) load word35lw $s1, 100($s2)$s1 = Memory($s2+100) store word43sw $s1, 100($s2)Memory($s2+100) = $s1

CSE331 W02.50Irwin&Li 2006 PSU Two Key Principles of Machine Design 1. Instructions are represented as numbers 2. Programs are stored in memory to be read or written, just like numbers  Stored-program concept l Programs can be shipped as files of binary numbers – binary compatibility l Computers can inherit ready- made software provided they are compatible with an existing ISA – leads industry to align around a small number of ISAs Accounting prg (machine code) C compiler (machine code) Payroll data Source code in C for Acct prg Memory

CSE331 W02.51Irwin&Li 2006 PSU Review: MIPS R3000 ISA  Instruction Categories l Load/Store l Computational l Jump and Branch l Floating Point -coprocessor l Memory Management l Special  3 Instruction Formats: all 32 bits wide R0 - R31 PC HI LO OPrs rt rdshamtfunct OPrs rt 16 bit number OP 26 bit jump target Registers R format I format 6 bits5 bits 6 bits