2012 David Black- Schaffer 1

Size: px
Start display at page:

Download "2012 David Black- Schaffer 1"

Transcription

1 1 Instruc*on Set Architectures 2 Introduc<on to Computer Architecture David Black- Schaffer Contents 2 Transla*on to machine code Instruc<on formats Large constants Procedure calls Register conven<ons Stack memory Other ISAs Material that is not in this lecture 3 Readings from the book Sign extension for two s complement numbers (2.4) Logical opera<ons (2.6) Assembler, linker, and loader (2.12) You will need 2.4 and 2.6 for this lecture. (2.12 will be on the exam.) The book has excellent descrip<ons of these topics. Please read the book before watching this lecture David Black- Schaffer 1

2 4 Transla*on to machine code Encodings and formats Instruc*on format (machine language) Machine Language Computers do not understand add R8, R17, R18 Instruc<ons are translated to machine language (1s and 0s) 5 Example: add R8, R17, R MIPS instruc<ons have logical fields: opcode rs (src1) rt (src1) rd (dest) shamt funct Instruc*on fields Ques*on: Why are there 5 bits for rs, rt, and rd? Answer: 2 5 =32. Need 5 bits to select from 32 registers. 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits opcode rs (src1) rt (src2) rd (dest) shamt funct opcode Opera<on (e.g., add lw ) rs First source register rt Second source register rd Des<na<on register shamt Shi] amount funct Func<on selector (add = 32, sub =34) Remember from 2 s complement: subtrac<on is basically addi<on, so it makes sense to share an opcode David Black- Schaffer 2

3 Constants (immediate) 7 How many bits needed to choose from all those registers? Store the constant data in the instruc<on, not the register file. Small constants (immediates) are used all over code (~50%) if (a==b) c=1; else c=2; How can we support this in the processor? Put the typical constants in memory and load them (slow) Create hard- wired registers (like R0) for them (how many?) MIPS does something in between: Some instruc<ons can have constants inside the instruc*on The control logic then sends the constants to the ALU addi R29, R29, 4 value 4 is inside the instruc<on But there s a problem: Instruc<ons have only 32 bits. Need some for opcode and registers opcode rs rt rd shamt funct (src1) (src2) (dest) How do we tradeoff space for constants and instruc*ons? MIPS instruc*on formats Ques*on: How large an immediate can you have for addi? Answer: I- format: bits = 16 bits. 2 s complement - 32,768 to Different formats for different kids of instruc<ons MIPS has 3 instruc*on formats: R: opera<on 3 registers no immediate I: opera<on 2 registers short immediate J: jump 0 registers long immediate Formats use the instruc<on bits differently Tradeoff immediate space and registers N a me F iel d s C o m m e nt s F i e l d Si ze 6 bi ts 5 bi ts 5 bi ts 5 bi ts 5 bi ts 6 b i t s A l l MIPS instruc<ons 32 bits R - f or m at o p rs rt rd s h mt f un c t Arithme<c instruc<on format 8 I - f or m at o p rs rt a d dr e ss / i m m ed iat e Transfer (load/store), branch, immediate format J- f o r m at o p tar ge t a d dr e ss J ump instruc<on format Loading immediate values (constants) 9 Control tells the ALU to take one operand from the Register File and the other from the Instruc*on. R0 R1 R2 R3 R4 R5 R6 R7 R8 Register File Program Counter Memory 0 0 addi R6, R0, Instruc*on Register bit immediate is sign 28 Control extended to bits. ALU add Memory Address Data Register 2012 David Black- Schaffer 3

4 10 11 Large constants and branches Loading larger values 12 Ques*on: Is the immediate sign- extended for ori? Answer: No. If it was we would end up with all 1s in the top bits. The immediate field is limited to 16 bits (- 32,768 to +32,767) How do we load larger values? Use two instruc<ons to combine two 16 bit immediates Load Upper Immediate (lui): Loads upper 16 bits Or Immediate (ori): Loads lower 16 bits Example: (See the MIPS reference data in the book.) lui R2, puts zeros in the lower bits R2: ori R2, R2: David Black- Schaffer 4

5 Addresses in branches and jumps 13 Ques*on: How far can you jump with bne/beq? Answer: - 32,767 to +32,768 instruc<ons from the current instruc<on Branch instruc*ons bne/beq I- format 16 bit immediate j J- format 26 bit immediate But addresses are 32 bits! How do we handle this? Treat bne/beq as rela*ve offsets (add to current PC) Treat j as an absolute value (replace 26 bits of the PC) + + sign extend Current 32 bit PC 4 16 bit immediate 00 Current 32 bit PC 26 bit immediate 00 Next 32 bit PC 00 Next 32 bit PC 00 Jump addresses example: loops for (j=0; j<10; j++) { b = b + j; } R5 = j; R6 = b; Addr Instruction Comment 0 addi R5, R0, 0 ; j addi R1, R0, 10 ; R beq R5, R1, 24 ; if ( j == 10) goto add R6, R6, R5 ; b b + j 16 addi R5, R5, 1 ; j j j 8 ; goto ; done with loop << 2 = 8 8+(3<<2)+4 = << 2 = beq: PC=PC+4+(3<<2) 8 j: PC=[PC(31:28):2]<<2 Why do rela*ve branches work? 15 Ques*on: What is Int and FP? Answer: Integer and Floa<ng Point programs. Int. Avg. FP Avg. 40% 30% 20% 10% 0% Bits of Branch Displacement Most branches don t go very far! 2012 David Black- Schaffer 5

6 What kind of branches are common? 16 LT/GE GT/LE EQ/NE 7% 7% 23% 40% 37% Op<mize for this case because it is most common. (E.g., MIPS) 86% Int Avg. FP Avg. 0% 50% 100% Frequency of comparison types in branches Summary: machine code and immediates 17 Instruc<ons have different encodings to store different types of data (3 register vs. immediate) MIPS has 3 types, for different uses Encodings limit how much data we can have These are tradeoffs in design: Op*mize for the common case (short immediates) Support the general case (long immidiates) David Black- Schaffer 6

7 19 Procedure calls Procedure calls 20 Procedures (func*ons/subrou*nes) are needed for structured programming main() { for (j=0; j<10; j++) if (a[j] == 0) a[j] = update(a[j], j); } This procedure is likely not in your code. You don t control it s implementa*on! The difficulty is that the procedure needs to: Put data where the procedure can access it Start execu*ng Do work/use registers Return to the caller Get the results back to the caller But it needs to do this without messing up the caller s registers! More specifically: 21 main() { for (j=0; j<10; j++) if (a[j] == 0) a[j] = update(a[j], j); } Caller: main() Callee: update() Parameters: a[j], j Results: (stored in) a[j] We need to: 1. Put the parameters in a place where the procedure (callee) can get them 2. Transfer control to the callee 3. Acquire the registers needed for the procedure 4. Execute the code 5. Place the results in a place where the calling program (caller) can access them 6. Return control to where we were before we called the procedure without messing up the caller s registers! 2012 David Black- Schaffer 7

8 Caller context 22 Example procedure: f(g,h,i,j)=(g+h) (i+j) add R1, R4, R5 ; g=r4, h=r5 add R2, R6, R7 ; i=r6, j=r7 sub R3, R1, R2 If the caller (e.g., main()) uses R1, R2 or R3 they would have to be saved because the callee overwrites them when it executes Problems: The callee does not know which registers the caller is using! (It could have mul<ple different callers) The caller does not know which registers the callee will use! (Could call mul<ple sub- procuedures) MIPS has a conven*on on who saves which registers Divided between the callee and caller Following this conven<on allows any caller to call any callee Callee and caller both know it what they need to save Saving registers: MIPS conven*ons 23 Ques*on: What are registers $s0- $s8 and $sp, $fp, $ra? Answer: Just standard names for R16- R23 and R29- R31. MIPS Conven*on Agreed upon contract or protocol that everyone follows Specifies the correct (and expected) usage and some naming conven<ons Established as part of the architecture Used by all compilers, programs, and libraries Assures compa*bility Callee saves the following registers if it uses them: $s0- $s7 (s=saved) $sp, $fp, $ra Caller must save anything else it uses MIPS register names and conven*ons 24 Arguments (input to callee) and values (outputs to caller) R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 $0 $at $v0 $v1 $a0 $a1 $a2 $a3 $t0 $t1 $t2 $t3 $t4 $t5 $t6 $t7 Constant 0 Reserved Temp. Return Values Procedure arguments Caller Save Temporaries: May be overwriqen by called procedures R16 R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 R27 R28 R29 R30 R31 $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $t8 $t9 $k0 $k1 $gp $sp $fp $ra Callee Save Temporaries: May not be overwriqen by called pro- cedures Caller Save Temp Reserved for Opera*ng Sys Global Pointer Callee Save Stack Pointer Frame Pointer Return Address 2012 David Black- Schaffer 8

9 How to do a procedure call Transfer control to the callee: 25 jal ProcedureAddress ; jump- and- link to the procedure The return address (PC+4) is stored in $ra Return control to the caller: jr $ra ; jump- return to the address in $ra This is why you need to store the return address! Register conven<on for procedure calling: $a0- $a3: Argument registers (4) for passing parameters $v0- $v1: Value registers (2) for returning results $ra: Return address for where to go when done Procedure call examples and the stack 2012 David Black- Schaffer 9

10 Example: which registers to save? 28 Caller Callee add $a0, $t0, 2 add $a1, $s0, $zero add $a2, $s1, $t0 add $a3, $t0, 3 ; set up the arguments addi $sp, $sp, -4 ; adjust the stack to make room for one item sw $t0, 0($sp) ; save $t0 in case the callee uses it jal leaf_example ; call the leaf_example proceedure lw $t0, 0($sp) ; restore $t0 from the stack addi $sp, $sp, 4 ; adjust the stack to delete one item add $t2, $v0, $zero ; move the result into $t2 Caller needs to save anything not leaf_example: ; calculates f=(g+h)- (i+j) ; g, h, i, and j are in $a0, $a1, $a2, $a3 in the $s registers. addi $sp, $sp, -4 ; adjust the stack to make room for one item sw $s0, 0($sp) ; save $s0 for the caller add $t0,$a0,$a1 ; g = $a0, h = $a1 add $t1,$a2,$a3 ; i = $a2, j = $a3 sub $s0,$t0,$t1 add $v0,$s0,$zero ; return f in the result register $v0 lw $s0, 0($sp) ; restore $s0 for the caller addi $sp, $sp, ; adjust the stack to delete one 4 item jr $ra ; jump back to the calling rou<ne Ques*ons: 1. What resources does the caller use? $t0, $s0, $s1 2. What resources does the callee use? $t0, $t1, $s0 3. What does the caller need to save? $t0 4. What does the callee need to save? $s0 Callee needs to save anything that is in the $s registers. Saving registers (on the stack) 29 The stack is a part of memory for storing temporary data. $sp The Stack Pointer (kept in $sp) points to the end of the stack in memory. In MIPS the stack grows down. $sp $sp $sp $sp $sp callee save $s0 callee save $s2 callee save $s4 callee save $ra $sp Procedures move the stack pointer when they store data on the stack. Each procedure returns the stack to the state it was before it was called. Stack before procedure call Stack during procedure call Stack aser procedure call Gives procedures a secure place to store data that does not fit in registers. (e.g., saved registers!) Each procedure manages its own stack space so they don t interfere. Works great as long as you return the stack to the way it was before. Example: saving to the stack 30 Move the stack pointer down by 4 bytes (1 word) Then store the register to that loca*on. Read the register from the stack. Then move the stack pointer up by 4 bytes (1 word) back to where it was before. Callee Caller add $a0, $t0, 2 ; set up the arguments add $a1, $s0, $zero add $a2, $s1, $t0 add $a3, $t0, 3 addi $sp, $sp, -4 ; adjust the stack to make room for one item sw $t0, 0($sp) ; save $t0 in case the callee uses it jal leaf_example ; call the leaf_example proceedure lw $t0, 0($sp) ; restore $t0 from the stack addi $sp, $sp, 4 ; adjust the stack to delete one item add $t2, $v0, $zero ; move the result into $t2 leaf_example: ; calculates f=(g+h)- (i+j) ; g, h, i, and j are in $a0, $a1, $a2, $a3 addi $sp, $sp, -4 ; adjust the stack to make room for one item sw $s0, 0($sp) ; save $s0 for the caller add $t0,$a0,$a1 ; g = $a0, h = $a1 add $t1,$a2,$a3 ; i = $a2, j = $a3 sub $s0,$t0,$t1 Ques*ons: 1. What resources does the caller use? $t0, $s0, $s1 2. What resources does the callee use? $t0, $t1, $s0 3. What does the caller need to save? $t0 4. What does the callee need to save? $s0 add $v0,$s0,$zero ; return f in the result register $v0 lw $s0, 0($sp) ; restore $s0 for the caller addi $sp, $sp, ; adjust the stack to delete one 4 item jr $ra ; jump back to the calling rou<ne 2012 David Black- Schaffer 10

11 Example: saving to the stack 31 $s0 and $s1 are callee- saved. So the caller does not need to save them. $t2 is overwriqen so we don t care if it was used by the callee. Callee never writes to $s1, so it does not need to save it. Caller Callee add $a0, $t0, 2 add $a1, $s0, $zero add $a2, $s1, $t0 add $a3, $t0, 3 ; set up the arguments addi $sp, $sp, -4 ; adjust the stack to make room for one item sw $t0, 0($sp) ; save $t0 in case the callee uses it jal leaf_example ; call the leaf_example proceedure lw $t0, 0($sp) ; restore $t0 from the stack addi $sp, $sp, 4 ; adjust the stack to delete one item add $t2, $v0, $zero ; move the result into $t2 leaf_example: ; calculates f=(g+h)- (i+j) ; g, h, i, and j are in $a0, $a1, $a2, $a3 addi $sp, $sp, -4 ; adjust the stack to make room for one item sw $s0, 0($sp) ; save $s0 for the caller add $t0,$a0,$a1 ; g = $a0, h = $a1 add $t1,$a2,$a3 ; i = $a2, j = $a3 sub $s0,$t0,$t1 add $v0,$s0,$zero ; return f in the result register $v0 lw $s0, 0($sp) ; restore $s0 for the caller addi $sp, $sp, ; adjust the stack to delete one 4 item jr $ra ; jump back to the calling rou<ne Caller uses $t0, $s0, $s1. $t0 is not saved, so the caller has to save it. What about $s0, $s1? A]er the call the caller restores $t0. Result is in $v0. Why did we not save $t2? Callee finds its arguments in $a0- $a3. Callee uses $s0, so it must save it. What about $s1? Results are placed in $v0. Callee must restore $s0. Nested calls 32 main() { B() jal B { C() jal C { } jr The stack grows and shrinks as procedure calls add (push) data when they are called and remove (pop) data when they return.... } jr Stack is returned to the way B had it before C was called. Some machines provide stacks as part of the architecture (VAX, JVM) Others implement them in so]ware Summary: procedure calls 33 Procedures need to: Not corrupt caller resources Return to the right place when done To accomplish this we: Have conven<ons for who saves registers Save them on the stack Use jal and jr $ra to enter and exit procedures As long as everyone follows the conven<on we get interoperability 2012 David Black- Schaffer 11

12 34 35 Other ISAs Other ISAs We ve looked at MIPS in detail, but there are a lot of other ISAs: x86 (Intel/AMD) ARM (ARM) JVM (Java) PPC (IBM, Motorola) SPARC (Oracle, Fujitsu) PTX (Nvidia) etc. 36 Let s take a look at a few issues: Machine types ISA classes Addressing modes Instruc<on width CISC vs. RISC 2012 David Black- Schaffer 12

13 Basic machine types 37 Memory- to- Memory machines Instruc<ons can directly manipulate memory Mem[0] = Mem[1] + Mem[2] Problems: Need to store temporary values in memory Memory is slow Memory is big need lots of bits for addresses E.g., f=(g+h)- (i+j) Architectural registers Hold temporary variables Far faster than memory faster programs Fewer addresses in code smaller programs But it s never that simple x86 has a few registers and supports memory opera<ons ARM has many addressing modes that complicate register opera<ons When you run out of registers you have to spill data to memory Basic ISA classes 38 Accumulator (1 register) 1 address add A acc acc + mem[a] General purpose register file (load/store) 3 addresses add Ra Rb Rc Ra Rb + Rc load Ra Rb Ra Mem[Rb] General purpose register file (Register- Memory) 2 address add Ra B Ra Mem[B] Stack (not a register file but an operand stack) 0 address add tos tos + next tos = top of stack Comparison: Bytes per instruc<on? Number of instruc<ons? Cycles per instruc<on? Comparing number of instruc*ons 39 Many very small instruc<ons (no registers) Code for C = A + B Stack Accumulator Register (Register- memory) Push A Push B Add Pop C Load A Add A Store C Load R1, A Add R1, B Store C, R1 Register (Load- store) Load R1, A Load R2, B Add R3, R2, R1 Store C, R3 Lots of simple instruc<ons. JVM PDP- 8, 8008, 8051 x86 MIPS, PPC, ARM, SPARC Good unless you need temporaries Small code, but hard to build in hardware 2012 David Black- Schaffer 13

14 Addressing modes (not all are in MIPS) 40 Ques*on: Why auto- increment/ decrement? Why scaled? Answer: Helpful for walking through arrays. Addressing mode Example Meaning Register add R4, R3 R4 R4+R3 Immediate add R4, 23 R4 R4+23 Displacement add R4, 100(R1) R4 R4+Mem[100+R1] Register indirect add R4, (R1) R4 R4+Mem[R1] Indexed/Base add R3,(R1+R2) R3 R3+Mem[R1+R2] Direct or absolute add R1,(1001) R1 R1+Mem[1001] Memory indirect add R1 R1+Mem[Mem[R3]] MIPS Auto- increment add R1,(R2)+ R1 R1+Mem[R2]; R2 R2+d Auto- decrement add R1,- (R2) R2 R2- d; R1 R1+Mem[R2] Scaled add R1, 100(R2)[R3] R1 R1+Mem[100+R2+R3*d] Instruc*on widths (number of bits) Variable width Different widths for different instruc<ons x86: 2-6 bytes for add, 2-4 bytes for load Beqer for genera<ng compact code Hard for hardware to know where instruc<ons start/stop 41 Fixed width Same width for every instruc<on MIPS: 4 bytes for add, 4 bytes for load Larger code size Easy for hardware to decode Mul*ple widths ARM and MIPS support both 32- bit and 16- bit instruc<ons 16- bit instruc<ons are limited, but can reduce code size General purpose register machines dominate 42 Literally all machines use general purpose registers Advantages Faster than memory (way faster than memory) Can hold temporary variables (easier to break up complex opera<ons) Easier for compilers to use (regular structure and uniform use) Improved code density (fewer bits to select a register than a memory address) But we just talked about how x86 was a memory- register architecture what s going on? 2012 David Black- Schaffer 14

15 20/09/ The truth about ISAs 44 The ISA lies, but you can trust it The ISA presents a simple view of the processor Atomic instruc<ons execute one at a <me Sequen*al instruc<ons execute in order Flat memory can access any loca<on easily Convert x86 into MIPS- like instruc*ons Turn the power off to save energy. Execute mul*ple instruc*ons at the same *me Make memory look faster than it really is (most of the *me) AMD s 8- core Bulldozer Processor Schedule instruc*ons to run out of order 45 CISC vs. RISC Simple computa*ons are not always simple Architectures that provide complex instruc<ons are Complex Instruc*on Set Compu*ng = CISC O]en requires a sequence of more primi<ve instruc<ons E.g., Mem[R1] Mem[R2] + R3 PRO: assembly programs are easier to write, denser code CON: hardware gets really, really complicated by rarely- used instruc<ons. Compilers are hard to write. Architectures that provide only primi<ve instruc<ons are Reduced Instruc*on Set Compu*ng = RISC CON: compiler generate lots of instruc<ons for even simple code PRO: hardware and compiler are easier to design and op<mize Everything is RISC inside today to make the hardware simpler 2012 David Black- Schaffer 15

16 Summary: ISAs 46 Architecture = what s visible to the program about the machine Not everything in the implementa<on is visible The implementa<on may not follow the architecture The invisible stuff is the microarchitecture and it s very messy, but very fun (huge engineering challenges; lots of money) A big piece of the ISA is the assembly language structure Primi<ve instruc<ons (appear to) execute sequen*ally and atomically Formats, computa<ons, addressing modes, etc. CISC: lots of complicated instruc<ons RISC: a few basic instruc<ons All recent machines are RISC, but x86 is s<ll CISC (although they do RISC tricks on the inside) David Black- Schaffer 16

Chapter 2A Instructions: Language of the Computer

Chapter 2A Instructions: Language of the Computer Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction

More information

CENG3420 Lecture 03 Review

CENG3420 Lecture 03 Review CENG3420 Lecture 03 Review Bei Yu byu@cse.cuhk.edu.hk 2017 Spring 1 / 38 CISC vs. RISC Complex Instruction Set Computer (CISC) Lots of instructions of variable size, very memory optimal, typically less

More information

Computer Architecture

Computer Architecture Computer Architecture Chapter 2 Instructions: Language of the Computer Fall 2005 Department of Computer Science Kent State University Assembly Language Encodes machine instructions using symbols and numbers

More information

Instruction Set Architecture. "Speaking with the computer"

Instruction Set Architecture. Speaking with the computer Instruction Set Architecture "Speaking with the computer" The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture Digital Design

More information

CS 61C: Great Ideas in Computer Architecture Strings and Func.ons. Anything can be represented as a number, i.e., data or instruc\ons

CS 61C: Great Ideas in Computer Architecture Strings and Func.ons. Anything can be represented as a number, i.e., data or instruc\ons CS 61C: Great Ideas in Computer Architecture Strings and Func.ons Instructor: Krste Asanovic, Randy H. Katz hdp://inst.eecs.berkeley.edu/~cs61c/sp12 Fall 2012 - - Lecture #7 1 New- School Machine Structures

More information

Instruction Set Design

Instruction Set Design Instruction Set Design software instruction set hardware CPE442 Lec 3 ISA.1 Instruction Set Architecture Programmer's View ADD SUBTRACT AND OR COMPARE... 01010 01110 10011 10001 11010... CPU Memory I/O

More information

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

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes Chapter 2 Instructions: Language of the Computer Adapted by Paulo Lopes Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects

More information

Branch Addressing. Jump Addressing. Target Addressing Example. The University of Adelaide, School of Computer Science 28 September 2015

Branch Addressing. Jump Addressing. Target Addressing Example. The University of Adelaide, School of Computer Science 28 September 2015 Branch Addressing Branch instructions specify Opcode, two registers, target address Most branch targets are near branch Forward or backward op rs rt constant or address 6 bits 5 bits 5 bits 16 bits PC-relative

More information

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

ISA and RISCV. CASS 2018 Lavanya Ramapantulu ISA and RISCV CASS 2018 Lavanya Ramapantulu Program Program =?? Algorithm + Data Structures Niklaus Wirth Program (Abstraction) of processor/hardware that executes 3-Jul-18 CASS18 - ISA and RISCV 2 Program

More information

Chapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )

Chapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont ) Chapter 2 Computer Abstractions and Technology Lesson 4: MIPS (cont ) Logical Operations Instructions for bitwise manipulation Operation C Java MIPS Shift left >>> srl Bitwise

More information

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

Control Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary Control Instructions Computer Organization Architectures for Embedded Computing Thursday, 26 September 2013 Many slides adapted from: Computer Organization and Design, Patterson & Hennessy 4th Edition,

More information

Control Instructions

Control Instructions Control Instructions Tuesday 22 September 15 Many slides adapted from: and Design, Patterson & Hennessy 5th Edition, 2014, MK and from Prof. Mary Jane Irwin, PSU Summary Previous Class Instruction Set

More information

CS 61C: Great Ideas in Computer Architecture. MIPS Instruc,on Representa,on II. Dan Garcia

CS 61C: Great Ideas in Computer Architecture. MIPS Instruc,on Representa,on II. Dan Garcia CS 61C: Great Ideas in Computer Architecture MIPS Instruc,on Representa,on II Dan Garcia 1 Review of Last Lecture Simplifying MIPS: Define instruc?ons to be same size as data word (one word) so that they

More information

COMP 303 Computer Architecture Lecture 3. Comp 303 Computer Architecture

COMP 303 Computer Architecture Lecture 3. Comp 303 Computer Architecture COMP 303 Computer Architecture Lecture 3 Comp 303 Computer Architecture 1 Supporting procedures in computer hardware The execution of a procedure Place parameters in a place where the procedure can access

More information

Lecture 5: Procedure Calls

Lecture 5: Procedure Calls Lecture 5: Procedure Calls Today s topics: Memory layout, numbers, control instructions Procedure calls 1 Memory Organization The space allocated on stack by a procedure is termed the activation record

More information

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

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions Representing Instructions Instructions are encoded in binary Called machine code MIPS instructions Encoded as 32-bit instruction words Small number of formats encoding operation code (opcode), register

More information

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

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands Stored Program Concept Instructions: Instructions are bits Programs are stored in memory to be read or written just like data Processor Memory memory for data, programs, compilers, editors, etc. Fetch

More information

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

comp 180 Lecture 10 Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions Procedure Calls A procedure of a subroutine is like an agent which needs certain information to perform a

More information

Course Administration

Course Administration Fall 2018 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture Introduction 4/4 Avinash Karanth Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701

More information

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

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2014 Sources: Computer

More information

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA CISC 662 Graduate Computer Architecture Lecture 4 - ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization CISC 662 Graduate Computer Architecture Lecture 4 - ISA MIPS ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

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

Computer Organization and Structure. Bing-Yu Chen National Taiwan University Computer Organization and Structure Bing-Yu Chen National Taiwan University Instructions: Language of the Computer Operations and Operands of the Computer Hardware Signed and Unsigned Numbers Representing

More information

CSCE 5610: Computer Architecture

CSCE 5610: Computer Architecture HW #1 1.3, 1.5, 1.9, 1.12 Due: Sept 12, 2018 Review: Execution time of a program Arithmetic Average, Weighted Arithmetic Average Geometric Mean Benchmarks, kernels and synthetic benchmarks Computing CPI

More information

CS 61C: Great Ideas in Computer Architecture Func%ons and Numbers

CS 61C: Great Ideas in Computer Architecture Func%ons and Numbers CS 61C: Great Ideas in Computer Architecture Func%ons and Numbers 9/11/12 Instructor: Krste Asanovic, Randy H. Katz hcp://inst.eecs.berkeley.edu/~cs61c/sp12 Fall 2012 - - Lecture #8 1 New- School Machine

More information

Computer Organization MIPS ISA

Computer Organization MIPS ISA CPE 335 Computer Organization MIPS ISA Dr. Iyad Jafar Adapted from Dr. Gheith Abandah Slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE 232 MIPS ISA 1 (vonneumann) Processor Organization

More information

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

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction

More information

Computer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology

Computer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology Computer Organization MIPS Architecture Department of Computer Science Missouri University of Science & Technology hurson@mst.edu Computer Organization Note, this unit will be covered in three lectures.

More information

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

CSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI. CSCI 402: Computer Architectures Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI Recall Big endian, little endian Memory alignment Unsigned

More information

Instructions: Language of the Computer

Instructions: Language of the Computer CS359: Computer Architecture Instructions: Language of the Computer Yanyan Shen Department of Computer Science and Engineering 1 The Language a Computer Understands Word a computer understands: instruction

More information

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

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2) ELEC 5200-001/6200-001 Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2) Victor P. Nelson, Professor & Asst. Chair Vishwani D. Agrawal, James J. Danaher Professor Department

More information

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer CS 61C: Great Ideas in Computer Architecture Everything is a Number Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13 9/19/13 Fall 2013 - - Lecture #7 1 New- School Machine Structures

More information

EC 413 Computer Organization

EC 413 Computer Organization EC 413 Computer Organization Review I Prof. Michel A. Kinsy Computing: The Art of Abstraction Application Algorithm Programming Language Operating System/Virtual Machine Instruction Set Architecture (ISA)

More information

CS 61c: Great Ideas in Computer Architecture

CS 61c: Great Ideas in Computer Architecture MIPS Instruction Formats July 2, 2014 Review New registers: $a0-$a3, $v0-$v1, $ra, $sp New instructions: slt, la, li, jal, jr Saved registers: $s0-$s7, $sp, $ra Volatile registers: $t0-$t9, $v0-$v1, $a0-$a3

More information

Thomas Polzer Institut für Technische Informatik

Thomas Polzer Institut für Technische Informatik Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Branch to a labeled instruction if a condition is true Otherwise, continue sequentially beq rs, rt, L1 if (rs == rt) branch to

More information

Instruction Set Architectures

Instruction Set Architectures Lecture 2 Instruction Set Architectures Dr. Soner Onder CS 4431 Michigan Technological University 09/04/12 1 Instruction Set Architecture (ISA) 1950s to 1960s: Computer Architecture Course Computer Arithmetic

More information

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

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#: Computer Science and Engineering 331 Midterm Examination #1 Fall 2000 Name: Solutions S.S.#: 1 41 2 13 3 18 4 28 Total 100 Instructions: This exam contains 4 questions. It is closed book and notes. Calculators

More information

EC-801 Advanced Computer Architecture

EC-801 Advanced Computer Architecture EC-801 Advanced Computer Architecture Lecture 5 Instruction Set Architecture I Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC University Taxila!1 Instruction Set Architecture

More information

COMPUTER ORGANIZATION AND DESIGN

COMPUTER ORGANIZATION AND DESIGN COMPUTER ORGANIZATION AND DESIGN 5 th The Hardware/Software Interface Edition Chapter 2 Instructions: Language of the Computer 2.1 Introduction Instruction Set The repertoire of instructions of a computer

More information

Instructions: MIPS arithmetic. MIPS arithmetic. Chapter 3 : MIPS Downloaded from:

Instructions: MIPS arithmetic. MIPS arithmetic. Chapter 3 : MIPS Downloaded from: Instructions: Chapter 3 : MIPS Downloaded from: http://www.cs.umr.edu/~bsiever/cs234/ Language of the Machine More primitive than higher level languages e.g., no sophisticated control flow Very restrictive

More information

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

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements CSE141: Introduction to Computer Architecture CSE 141 Computer Architecture Spring 2005 Lecture 3 Instruction Set Architecute Pramod V. Argade April 4, 2005 Instructor: TAs: Pramod V. Argade (p2argade@cs.ucsd.edu)

More information

Lectures 3-4: MIPS instructions

Lectures 3-4: MIPS instructions Lectures 3-4: MIPS instructions Motivation Learn how a processor s native language looks like Discover the most important software-hardware interface MIPS Microprocessor without Interlocked Pipeline Stages

More information

ECE 486/586. Computer Architecture. Lecture # 7

ECE 486/586. Computer Architecture. Lecture # 7 ECE 486/586 Computer Architecture Lecture # 7 Spring 2015 Portland State University Lecture Topics Instruction Set Principles Instruction Encoding Role of Compilers The MIPS Architecture Reference: Appendix

More information

Chapter 2. Instruction Set Architecture (ISA)

Chapter 2. Instruction Set Architecture (ISA) Chapter 2 Instruction Set Architecture (ISA) MIPS arithmetic Design Principle: simplicity favors regularity. Why? Of course this complicates some things... C code: A = B + C + D; E = F - A; MIPS code:

More information

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

CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Formats CS 61C: Great Ideas in Computer Architecture MIPS Instruction Formats Instructor: Justin Hsia 6/27/2012 Summer 2012 Lecture #7 1 Review of Last Lecture New registers: $a0-$a3, $v0-$v1, $ra, $sp Also: $at,

More information

Lecture 3 Machine Language. Instructions: Instruction Execution cycle. Speaking computer before voice recognition interfaces

Lecture 3 Machine Language. Instructions: Instruction Execution cycle. Speaking computer before voice recognition interfaces Lecture 3 Machine Language Speaking computer before voice recognition interfaces 1 Instructions: Language of the Machine More primitive than higher level languages e.g., no sophisticated control flow Very

More information

Systems Architecture I

Systems Architecture I Systems Architecture I Topics Assemblers, Linkers, and Loaders * Alternative Instruction Sets ** *This lecture was derived from material in the text (sec. 3.8-3.9). **This lecture was derived from material

More information

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

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1 Chapter 3 MIPS Assembly Language Ó1998 Morgan Kaufmann Publishers 1 Instructions: Language of the Machine More primitive than higher level languages e.g., no sophisticated control flow Very restrictive

More information

Lecture 4: Instruction Set Architecture

Lecture 4: Instruction Set Architecture Lecture 4: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation Reading: Textbook (5 th edition) Appendix A Appendix B (4 th edition)

More information

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

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University. Instructions: ti Language of the Computer Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Computer Hierarchy Levels Language understood

More information

MIPS%Assembly% E155%

MIPS%Assembly% E155% MIPS%Assembly% E155% Outline MIPS Architecture ISA Instruction types Machine codes Procedure call Stack 2 The MIPS Register Set Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary

More information

CENG3420 L03: Instruction Set Architecture

CENG3420 L03: Instruction Set Architecture CENG3420 L03: Instruction Set Architecture Bei Yu byu@cse.cuhk.edu.hk (Latest update: January 31, 2018) Spring 2018 1 / 49 Overview Introduction Arithmetic & Logical Instructions Data Transfer Instructions

More information

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.) Lecture 3: The Instruction Set Architecture (cont.) COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 Review: Instructions Computers process information

More information

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.) Lecture 3: The Instruction Set Architecture (cont.) COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 Review: Instructions Computers process information

More information

MIPS Functions and Instruction Formats

MIPS Functions and Instruction Formats MIPS Functions and Instruction Formats 1 The Contract: The MIPS Calling Convention You write functions, your compiler writes functions, other compilers write functions And all your functions call other

More information

Lecture 3: Instruction Set Architecture

Lecture 3: Instruction Set Architecture Lecture 3: Instruction Set Architecture Interface Software/compiler instruction set hardware Design Space of ISA Five Primary Dimensions Number of explicit operands ( 0, 1, 2, 3 ) Operand Storage Where

More information

Lecture 4: MIPS Instruction Set

Lecture 4: MIPS Instruction Set Lecture 4: MIPS Instruction Set No class on Tuesday Today s topic: MIPS instructions Code examples 1 Instruction Set Understanding the language of the hardware is key to understanding the hardware/software

More information

EEC 581 Computer Architecture Lecture 1 Review MIPS

EEC 581 Computer Architecture Lecture 1 Review MIPS EEC 581 Computer Architecture Lecture 1 Review MIPS 1 Supercomputing: Suddenly Fancy 2 1 Instructions: Language of the Machine More primitive than higher level languages e.g., no sophisticated control

More information

Topic Notes: MIPS Instruction Set Architecture

Topic Notes: MIPS Instruction Set Architecture Computer Science 220 Assembly Language & Comp. Architecture Siena College Fall 2011 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture.

More information

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

Instruction Set Architectures Part I: From C to MIPS. Readings: Instruction Set Architectures Part I: From C to MIPS Readings: 2.1-2.14 1 Goals for this Class Understand how CPUs run programs How do we express the computation the CPU? How does the CPU execute it? How

More information

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set COMPSCI 313 S2 2018 Computer Organization 7 MIPS Instruction Set Agenda & Reading MIPS instruction set MIPS I-format instructions MIPS R-format instructions 2 7.1 MIPS Instruction Set MIPS Instruction

More information

COE608: Computer Organization and Architecture

COE608: Computer Organization and Architecture Add on Instruction Set Architecture COE608: Computer Organization and Architecture Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University Overview More

More information

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

Today s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA. Today s topics CS/COE1541: Introduction to Computer Architecture MIPS operations and operands MIPS registers Memory view Instruction encoding A Review of MIPS ISA Sangyeun Cho Arithmetic operations Logic

More information

Computer Architecture

Computer Architecture CS3350B Computer Architecture Winter 2015 Lecture 4.2: MIPS ISA -- Instruction Representation Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design,

More information

CS222: Dr. A. Sahu. Indian Institute of Technology Guwahati

CS222: Dr. A. Sahu. Indian Institute of Technology Guwahati CS222: (a) Activation Record of Merge Sort (b) Architecture Space RISC/CISC Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Activation Record in Recursion: Merge

More information

MIPS Instruction Set Architecture (2)

MIPS Instruction Set Architecture (2) MIPS Instruction Set Architecture (2) Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu

More information

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

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1 Instructions: MIPS ISA Chapter 2 Instructions: Language of the Computer 1 PH Chapter 2 Pt A Instructions: MIPS ISA Based on Text: Patterson Henessey Publisher: Morgan Kaufmann Edited by Y.K. Malaiya for

More information

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

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture Computer Science 324 Computer Architecture Mount Holyoke College Fall 2009 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture. Idea:

More information

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

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week. Chapter 2 Instructions: Language of the Computer HW#1: 1.3 all, 1.4 all, 1.6.1, 1.14.4, 1.14.5, 1.14.6, 1.15.1, and 1.15.4 Due date: one week. Practice: 1.5 all, 1.6 all, 1.10 all, 1.11 all, 1.14 all,

More information

Chapter 2: Instructions:

Chapter 2: Instructions: Chapter 2: Instructions: Language of the Computer Computer Architecture CS-3511-2 1 Instructions: To command a computer s hardware you must speak it s language The computer s language is called instruction

More information

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

Computer Organization and Structure. Bing-Yu Chen National Taiwan University Computer Organization and Structure Bing-Yu Chen National Taiwan University Instructions: Language of the Computer Operations and Operands of the Computer Hardware Signed and Unsigned Numbers Representing

More information

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

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook) Lecture 2 Instructions: Language of the Computer (Chapter 2 of the textbook) Instructions: tell computers what to do Chapter 2 Instructions: Language of the Computer 2 Introduction Chapter 2.1 Chapter

More information

Instruction Set Design and Architecture

Instruction Set Design and Architecture Instruction Set Design and Architecture COE608: Computer Organization and Architecture Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University Overview Computer

More information

Chapter 2. Instructions: Language of the Computer

Chapter 2. Instructions: Language of the Computer Chapter 2 Instructions: Language of the Computer Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects in common Early computers

More information

Procedure Calling. Procedure Calling. Register Usage. 25 September CSE2021 Computer Organization

Procedure Calling. Procedure Calling. Register Usage. 25 September CSE2021 Computer Organization CSE2021 Computer Organization Chapter 2: Part 2 Procedure Calling Procedure (function) performs a specific task and return results to caller. Supporting Procedures Procedure Calling Calling program place

More information

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

Forecast. Instructions (354 Review) Basics. Basics. Instruction set architecture (ISA) is its vocabulary. Instructions are the words of a computer Instructions (354 Review) Forecast Instructions are the words of a computer Instruction set architecture (ISA) is its vocabulary With a few other things, this defines the interface of computers But implementations

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying

More information

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

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 101 Assembly ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 What is assembly? 79 Why are we learning assembly now? 80 Assembly Language Readings: Chapter 2 (2.1-2.6, 2.8, 2.9, 2.13, 2.15), Appendix

More information

Instructions: Assembly Language

Instructions: Assembly Language Chapter 2 Instructions: Assembly Language Reading: The corresponding chapter in the 2nd edition is Chapter 3, in the 3rd edition it is Chapter 2 and Appendix A and in the 4th edition it is Chapter 2 and

More information

ECE369. Chapter 2 ECE369

ECE369. Chapter 2 ECE369 Chapter 2 1 Instruction Set Architecture A very important abstraction interface between hardware and low-level software standardizes instructions, machine language bit patterns, etc. advantage: different

More information

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

ECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 3 2/8/2018 ECE 331 Hardware Organization and Design Professor Jay Taneja UMass ECE - jtaneja@umass.edu Discussion 3 2/8/2018 Study Jams Leader: Chris Bartoli Tuesday 5:30-6:45pm Elab 325 Wednesday 8:30-9:45pm Elab

More information

The MIPS Instruction Set Architecture

The MIPS Instruction Set Architecture The MIPS Set Architecture CPS 14 Lecture 5 Today s Lecture Admin HW #1 is due HW #2 assigned Outline Review A specific ISA, we ll use it throughout semester, very similar to the NiosII ISA (we will use

More information

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

MIPS Datapath. MIPS Registers (and the conventions associated with them) MIPS Instruction Types 1 Lecture 08 Introduction to the MIPS ISA + Procedure Calls in MIPS Longer instructions = more bits to address registers MIPS Datapath 6 bit opcodes... 2 MIPS Instructions are 32 bits More ways to address

More information

Architecture I. Computer Systems Laboratory Sungkyunkwan University

Architecture I. Computer Systems Laboratory Sungkyunkwan University MIPS Instruction ti Set Architecture I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Architecture (1) the attributes of a system as seen by the

More information

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

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Introduction to the MIPS Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Introduction to the MIPS The Microprocessor without Interlocked Pipeline Stages

More information

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

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 Do-While Example In C++ do { z--; while (a == b); z = b; In assembly language loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero 25 Comparisons Set on less than (slt) compares its source registers

More information

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

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1 Chapter 2 1 MIPS Instructions Instruction Meaning add $s1,$s2,$s3 $s1 = $s2 + $s3 sub $s1,$s2,$s3 $s1 = $s2 $s3 addi $s1,$s2,4 $s1 = $s2 + 4 ori $s1,$s2,4 $s2 = $s2 4 lw $s1,100($s2) $s1 = Memory[$s2+100]

More information

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place? I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place? here s the monitor, here goes the CPU, Do you need a class

More information

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

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands Stored Program Concept nstructions: nstructions are bits Programs are stored in memory to be read or written just like data Processor Memory memory for data, programs, compilers, editors, etc. Fetch &

More information

The Single Cycle Processor

The Single Cycle Processor EECS 322 Computer Architecture The Single Cycle Processor Instructor: Francis G. Wolff wolff@eecs.cwru.edu Case Western Reserve University This presentation uses powerpoint animation: please viewshow CWRU

More information

PHBREAK: RISC ISP architecture the MIPS ISP. you read: text Chapter 3 CS 350

PHBREAK: RISC ISP architecture the MIPS ISP. you read: text Chapter 3 CS 350 PHBREAK: RISC ISP architecture the MIPS ISP you read: text Chapter 3 Summary of main points: Two objectives; 1] Describe the MIPS ISP architecture 2] expose the Reduced Instruction Set Computer (RISC)

More information

Architecture II. Computer Systems Laboratory Sungkyunkwan University

Architecture II. Computer Systems Laboratory Sungkyunkwan University MIPS Instruction ti Set Architecture II Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Making Decisions (1) Conditional operations Branch to a

More information

Lectures 5. Announcements: Today: Oops in Strings/pointers (example from last time) Functions in MIPS

Lectures 5. Announcements: Today: Oops in Strings/pointers (example from last time) Functions in MIPS Lectures 5 Announcements: Today: Oops in Strings/pointers (example from last time) Functions in MIPS 1 OOPS - What does this C code do? int foo(char *s) { int L = 0; while (*s++) { ++L; } return L; } 2

More information

Machine Instructions - II. Hwansoo Han

Machine Instructions - II. Hwansoo Han Machine Instructions - II Hwansoo Han Conditional Operations Instructions for making decisions Alter the control flow - change the next instruction to be executed Branch to a labeled instruction if a condition

More information

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

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

More information

Computer Architecture. The Language of the Machine

Computer Architecture. The Language of the Machine Computer Architecture The Language of the Machine Instruction Sets Basic ISA Classes, Addressing, Format Administrative Matters Operations, Branching, Calling conventions Break Organization All computers

More information

Rechnerstrukturen. Chapter 2. Instructions: Language of the Computer

Rechnerstrukturen. Chapter 2. Instructions: Language of the Computer 182.690 Rechnerstrukturen Chapter 2 Instructions: Language of the Computer Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many

More information

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Overview Last Lecture s Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a

More information

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

ECE232: Hardware Organization and Design. Computer Organization - Previously covered ECE232: Hardware Organization and Design Part 6: MIPS Instructions II http://www.ecs.umass.edu/ece/ece232/ Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Computer Organization

More information

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

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls 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. Ask TA (Liquan chen: liquan@ece.rutgers.edu) about homework related questions.

More information