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

Size: px
Start display at page:

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

Transcription

1 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 Lecture #7 1 New- School Machine Structures (It s a bit more complicated!) So4ware Parallel Requests Assigned to computer e.g., Search Katz Parallel Threads Assigned to core e.g., Lookup, Ads Parallel Instruc]ons >1 one ]me e.g., 5 pipelined instruc]ons Parallel Data >1 data one ]me e.g., Add of 4 pairs of words Hardware descrip]ons All one ]me Programming Languages Harness Parallelism & Achieve High Performance Hardware Today s Lecture Warehouse Scale Computer Core Memory Input/Output Instruc]on Unit(s) Cache Memory Core 9/19/13 Fall Lecture #7 2 Computer (Cache) Core Func]onal Unit(s) A 0 +B 0 A 1 +B 1 A 2 +B 2 A 3 +B 3 Smart Phone Logic Gates 1

2 Big Idea #1: Levels of Representa]on/ Interpreta]on Machine Interpreta4on High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g., MIPS) Assembler Machine Language Program (MIPS) Hardware Architecture DescripCon (e.g., block diagrams) Architecture Implementa4on Logic Circuit DescripCon (Circuit SchemaCc Diagrams) temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; lw $t0, 0($2) lw $t1, 4($2) sw $t1, 0($2) sw $t0, 4($2) We are here! Anything can be represented as a number, i.e., data or instruc]ons ! 9/19/13 Fall Lecture #7 3 Review C is func]on oriented; code reuse via func]ons Jump and link (jal) invokes, jump register (jr $ra) returns Registers $a0-$a3 for arguments, $v0-$v1 for return values Stack for spilling registers, nested func]on calls, C local (automa]c) variables 9/19/13 Fall Lecture #7 4 2

3 Agenda Memory Heap Everything is a Number Administrivia Overflow and Real Numbers Technology Break Instruc]ons as Numbers Assembly Language to Machine Language And in Conclusion, 9/19/13 Fall Lecture #7 5 Agenda Memory Heap Everything is a Number Administrivia Overflow and Real Numbers Technology Break Instruc]ons as Numbers Assembly Language to Machine Language And in Conclusion, 9/19/13 Fall Lecture #7 6 3

4 What If a Func]on Calls a Func]on? Recursive Func]on Calls? Would clobber values in $a0 to $a1 and $ra What is the solu]on? 9/19/13 Fall Lecture #7 7 Alloca]ng Space on Stack C has two storage classes: automa]c and sta]c Automa@c variables are local to func]on and discarded when func]on exits. Sta@c variables exist across exits from and entries to procedures Use stack for automa]c (local) variables that don t fit in registers Procedure frame or ac@va@on record: segment of stack with saved registers and local variables Some MIPS compilers use a frame pointer ($fp) to point to first word of frame (29 of 32, 3 ler!) 9/19/13 Fall Lecture #7 8 4

5 Stack Before, During, Arer Call 9/19/13 Fall Lecture #7 9 Recursive Func]on Factorial int fact (int n) { if (n < 1) return (1); else return (n * fact(n-1)); } 9/19/13 Fall Lecture #7 10 5

6 Recursive Func]on Factorial Fact: L1: # adjust stack for 2 items # Else part (n >= 1) addi $sp,$sp,-8 # arg. gets (n 1) # save return address addi $a0,$a0,-1 sw $ra, 4($sp) # call fact with (n 1) # save argument n jal fact sw $a0, 0($sp) # return from jal: restore n # test for n < 1 lw $a0, 0($sp) slti $t0,$a0,1 # restore return address # if n >= 1, go to L1 lw $ra, 4($sp) beq $t0,$zero,l1 # adjust sp to pop 2 items # Then part (n==1) return 1 addi $sp, $sp,8 addi $v0,$zero,1 # return n * fact (n 1) # pop 2 items off stack mul $v0,$a0,$v0 addi $sp,$sp,8 # return to the caller # return to caller jr $ra jr $ra mul is a pseudo instruc@on 9/19/13 Fall Lecture #7 11 Op]mized Func]on Conven]on To reduce expensive loads and stores from spilling and restoring registers, MIPS divides registers into two categories: 1. Preserved across func]on call Caller can rely on values being unchanged $ra, $sp, $gp, $fp, saved registers $s0- $s7 2. Not preserved across func]on call Caller cannot rely on values being unchanged Return value registers $v0,$v1, Argument registers $a0- $a3, temporary registers $t0- $t9 9/19/13 Fall Lecture #7 12 6

7 Where is the Stack in Memory? MIPS conven]on Stack starts in high memory and grows down Hexadecimal (base 16) : 7fff fffc hex MIPS programs (text segment) in low end hex Sta@c data segment (constants and other sta]c variables) above text for sta]c variables MIPS conven]on global pointer ($gp) points to sta]c (30 of 32, 2 ler! will see when talk about OS) Heap above sta]c for data structures that grow and shrink ; grows up to high addresses 9/19/13 Fall Lecture #7 13 MIPS Memory Alloca]on 9/19/13 Fall Lecture #7 14 7

8 Register Alloca]on and Numbering 9/19/13 Fall Lecture #7 15 Which statement is FALSE? MIPS uses jal to invoke a func]on and jr to return from a func]on jal saves PC+1 in $ra! The callee can use temporary registers ($ti) without saving and restoring them! 16 8

9 Which statement is FALSE? MIPS uses jal to invoke a func]on and jr to return from a func]on jal saves PC+1 in $ra! The callee can use temporary registers ($ti) without saving and restoring them! 17 Agenda Memory Heap Everything is a Number Administrivia Overflow and Real Numbers Technology Break Instruc]ons as Numbers Assembly Language to Machine Language Summary 9/19/13 Fall Lecture #7 18 9

10 Key Concepts Inside computers, everything is a number But everything is of a fixed size 8- bit bytes, 16- bit half words, 32- bit words, 64- bit double words, Integer and floa]ng point opera]ons can lead to results too big to store within their representa]ons: overflow/underflow 9/19/13 Fall Lecture #7 19 Number Representa]on Value of i- th digit is d Base i where i starts at 0 and increases from right to ler: = 1 10 x x x = 1x x x1 10 = = Binary (Base 2), Hexadecimal (Base 16), Decimal (Base 10) different ways to represent an integer We use 1 two, 5 ten, 10 hex to be clearer (vs. 1 2, 4 8, 5 10, ) 9/19/13 Fall Lecture #

11 Number Representa]on Hexadecimal digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F FFF hex = 15 ten x 16 ten ten x 16 ten ten x 16 ten 0 = 3840 ten ten + 15 ten = 4095 ten two = FFF hex = 4095 ten May put blanks every group of binary, octal, or hexadecimal digits to make it easier to parse, like commas in decimal 9/19/13 Fall Lecture #7 21 Signed and Unsigned Integers C, C++, and Java have signed integers, e.g., 7, - 255: int x, y, z; C, C++ also have unsigned integers, which are used for addresses 32- bit word can represent 2 32 binary numbers Unsigned integers in 32 bit word represent 0 to (4,294,967,295) 9/19/13 Fall Lecture #

12 Unsigned Integers two = 0 ten two = 1 ten two = 2 ten two = 2,147,483,645 ten two = 2,147,483,646 ten two = 2,147,483,647 ten two = 2,147,483,648 ten two = 2,147,483,649 ten two = 2,147,483,650 ten two = 4,294,967,293 ten two = 4,294,967,294 ten two = 4,294,967,295 ten 9/19/13 Fall Lecture #7 23 Signed Integers and Two s Complement Representa]on Signed integers in C; want ½ numbers <0, want ½ numbers >0, and want one 0 Two s complement treats 0 as posi]ve, so 32- bit word represents 2 32 integers from ( 2,147,483,648) to (2,147,483,647) Note: one nega]ve number with no posi]ve version Book lists some other op]ons, all of which are worse Every computers uses two s complement today Most significant bit (lermost) is the sign bit, since 0 means posi]ve (including 0), 1 means nega]ve Bit 31 is most significant, bit 0 is least significant 9/19/13 Fall Lecture #

13 Sign Bit Two s Complement Integers two = 0 ten two = 1 ten two = 2 ten two = 2,147,483,645 ten two = 2,147,483,646 ten two = 2,147,483,647 ten two = 2,147,483,648 ten two = 2,147,483,647 ten two = 2,147,483,646 ten two = 3 ten two = 2 ten two = 1 ten 9/19/13 Fall Lecture #7 25 Twos Complement Examples Assume for simplicity 4 bit width, - 8 to +7 represented (- 2) (- 2) Overflow! (- 1) Underflow! Carry into MSB = Carry Out MSB Carry into MSB = Carry Out MSB 9/19/13 Fall Lecture #

14 Suppose we had a 5 bit word. What integers can be represented in two s complement? - 32 to to to +15! 27 Suppose we had a 5 bit word. What integers can be represented in two s complement? - 32 to to to +15! 28 14

15 MIPS Logical Instruc]ons Useful to operate on fields of bits within a word e.g., characters within a word (8 bits) Opera]ons to pack /unpack bits into words Called logical opera@ons Logical operations C operators Java operators MIPS instructions Bit-by-bit AND & & and Bit-by-bit OR or Bit-by-bit NOT ~ ~ nor Shift left << << sll Shift right >> >>> srl 9/19/13 Fall Lecture #7 29 Bit- by- bit Defini]on OperaCon Input Input Output AND AND AND AND OR OR OR OR NOR NOR NOR /19/13 NOR 1 Fall Lecture #

16 Examples If register $t2 contains two And register $t1 contains two What is value of $t0 arer: and $t0,$t1,$t2 # reg $t0 = reg $t1 & reg $t2 9/19/13 Fall Lecture #7 31 Examples If register $t2 contains two And register $t1 contains two What is value of $t0 arer: and $t0,$t1,$t2 # reg $t0 = reg $t1 & reg $t two 9/19/13 Fall Lecture #

17 Examples If register $t2 contains two And register $t1 contains two What is value of $t0 arer: or $t0,$t1,$t2 # reg $t0 = reg $t1 reg $t2 9/19/13 Fall Lecture #7 33 Examples If register $t2 contains two And register $t1 contains two What is value of $t0 arer: or $t0,$t1,$t2 # reg $t0 = reg $t1 reg $t two 9/19/13 Fall Lecture #

18 Examples If register $t2 contains two And register $t1 contains two What is value of $t0 arer: nor $t0,$t1,$zero # reg $t0 = ~ (reg $t1 0) 9/19/13 Fall Lecture #7 35 Examples If register $t2 contains two And register $t1 contains two What is value of $t0 arer: nor $t0,$t1,$zero # reg $t0 = ~ (reg $t1 0) two 9/19/13 Fall Lecture #

19 Shiring Shir ler logical moves n bits to the ler (insert 0s into empty bits) Same as mul]plying by 2 n for two s complement number For example, if register $s0 contained two = 9 ten If executed sll $s0, $s0, 4, result is: two = 144 ten And 9 ten 2 ten 4 = 9 ten 16 ten = 144 ten Shir right logical moves n bits to the right (insert 0s into empty bits) NOT same as dividing by 2n (nega]ve numbers fail) 9/19/13 Fall Lecture #7 37 Shiring Shir right arithme]c moves n bits to the right (insert high order sign bit into empty bits) For example, if register $s0 contained two = 25 ten If executed sra $s0, $s0, 4, result is: 9/19/13 Fall Lecture #

20 Shiring Shir right arithme]c moves n bits to the right (insert high order sign bit into empty bits) For example, if register $s0 contained two = 25 ten If executed sra $s0, $s0, 4, result is: two = 1 ten 9/19/13 Fall Lecture #7 39 Shiring Shir right arithme]c moves n bits to the right (insert high order sign bit into empty bits) For example, if register $s0 contained two = - 25 ten If executed sra $s0, $s0, 4, result is: 9/19/13 Fall Lecture #

21 Shiring Shir right arithme]c moves n bits to the right (insert high order sign bit into empty bits) For example, if register $s0 contained two = - 25 ten If executed sra $s0, $s0, 4, result is: two = - 2 ten Unfortunately, this is NOT same as dividing by 2n Fails for odd nega]ve numbers C arithme]c seman]cs is that division should round towards 0 9/19/13 Fall Lecture #7 41 Impact of Signed and Unsigned Integers on Instruc]on Sets What (if any) instruc]ons affected? Load word, store word? branch equal, branch not equal? and, or, sll, srl? add, sub, mult, div? sl] (set less than immediate)? 9/19/13 Fall Lecture #

22 C provides two sets of operators for AND (& and &&) and two sets of operators for OR ( and ) while MIPS doesn t. Why? Logical opera]ons AND and OR do & and while condi]onal branches do && and The previous statement has it backwards: && and logical ops, & and are branches They are redundant and mean the same thing: && and are simply inherited from the programming language B, the predecessor of C! 43 C provides two sets of operators for AND (& and &&) and two sets of operators for OR ( and ) while MIPS doesn t. Why? Logical opera]ons AND and OR do & and while condi]onal branches do && and The previous statement has it backwards: && and logical ops, & and are branches They are redundant and mean the same thing: && and are simply inherited from the programming language B, the predecessor of C! 44 22

23 Peer Instruc]on Answer C provides two sets of operators for AND (& and &&) and two sets of operators for OR ( and ) while MIPS doesn t. Why? Logical opera]ons AND and OR implement & and while condi]onal branches implement && and Reason: e.g., && is logical and: true && true is true and everything else is false & is bitwise and: e.g., (1010 two & 1000 two ) = 1000 two 9/19/13 Fall Lecture #7 45 Agenda Memory Heap Everything is a Number Administrivia Overflow and Real Numbers Instruc]ons as Numbers Technology Break Assembly Language to Machine Language And in Conclusion, 9/19/13 Fall Lecture #

24 Administrivia HW #3 Due 11:59:59 Project #1 Part 1 Due 11:59:59 Midterm on the horizon: 10/17 (4 weeks), 6-9 PM It s going to be completely mul]ple choice! 9/19/13 Fall Lecture #7 47 And in Conclusion, Program can interpret binary number as unsigned integer, two s complement signed integer, floa]ng point number, ASCII characters, Unicode characters, Integers have largest posi]ve and largest nega]ve numbers, but represent all in between Two s comp. weirdness is one extra nega]ve numinteger and floa]ng point opera]ons can lead to results too big to store within their representa]ons: overflow/underflow Floa]ng point is an approxima]on of reals Everything is a (binary) number in a computer Instruc]ons and data; stored program concept 9/19/13 Fall Lecture #

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

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

CS 61C: Great Ideas in Computer Architecture (Machine Structures) More MIPS Machine Language

CS 61C: Great Ideas in Computer Architecture (Machine Structures) More MIPS Machine Language CS 61C: Great Ideas in Computer Architecture (Machine Structures) More MIPS Machine Language Instructors: Randy H. Katz David A. PaGerson hgp://inst.eecs.berkeley.edu/~cs61c/sp11 1 2 Machine Interpreta4on

More information

CS 110 Computer Architecture MIPS Instruction Formats

CS 110 Computer Architecture MIPS Instruction Formats CS 110 Computer Architecture MIPS Instruction Formats Instructor: Sören Schwertfeger http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides based

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

CS 61C: Great Ideas in Computer Architecture More MIPS, MIPS Functions

CS 61C: Great Ideas in Computer Architecture More MIPS, MIPS Functions CS 61C: Great Ideas in Computer Architecture More MIPS, MIPS Functions Instructors: John Wawrzynek & Vladimir Stojanovic http://inst.eecs.berkeley.edu/~cs61c/fa15 1 Machine Interpretation Levels of Representation/Interpretation

More information

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro Instructors: Krste Asanovic & Vladimir Stojanovic h>p://inst.eecs.berkeley.edu/~cs61c/sp15 1 Machine Interpreta4on Levels

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

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

Agenda. Review 2/10/11. CS 61C: Great Ideas in Computer Architecture (Machine Structures)

Agenda. Review 2/10/11. CS 61C: Great Ideas in Computer Architecture (Machine Structures) CS 61C: Great Ideas in Computer Architecture (Machine Structures) Instructors: Randy H. Katz David A. PaGerson hgp://inst.eecs.berkeley.edu/~cs61c/sp11 1 2 New- School Machine Structures (It s a bit more

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

CS 61c: Great Ideas in Computer Architecture

CS 61c: Great Ideas in Computer Architecture MIPS Functions July 1, 2014 Review I RISC Design Principles Smaller is faster: 32 registers, fewer instructions Keep it simple: rigid syntax, fixed instruction length MIPS Registers: $s0-$s7,$t0-$t9, $0

More information

CS 61C: Great Ideas in Computer Architecture More RISC-V Instructions and How to Implement Functions

CS 61C: Great Ideas in Computer Architecture More RISC-V Instructions and How to Implement Functions CS 61C: Great Ideas in Computer Architecture More RISC-V Instructions and How to Implement Functions Instructors: Krste Asanović and Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c/fa17 9/14/17 Fall

More information

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

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

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

CS 61C: Great Ideas in Computer Architecture. Lecture 6: More MIPS, MIPS Func.ons. Instructor: Sagar Karandikar

CS 61C: Great Ideas in Computer Architecture. Lecture 6: More MIPS, MIPS Func.ons. Instructor: Sagar Karandikar CS 61C: Great Ideas in Computer Architecture Lecture 6: More MIPS, MIPS Func.ons Instructor: Sagar Karandikar sagark@eecs.berkeley.edu hap://inst.eecs.berkeley.edu/~cs61c 1 Machine Interpreta4on Levels

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

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

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

CS61C Machine Structures. Lecture 12 - MIPS Procedures II & Logical Ops. 2/13/2006 John Wawrzynek. www-inst.eecs.berkeley.

CS61C Machine Structures. Lecture 12 - MIPS Procedures II & Logical Ops. 2/13/2006 John Wawrzynek. www-inst.eecs.berkeley. CS61C Machine Structures Lecture 12 - MIPS Procedures II & Logical Ops 2/13/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L12 MIPS Procedures II / Logical (1)

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

Lecture 5: Procedure Calls

Lecture 5: Procedure Calls Lecture 5: Procedure Calls Today s topics: Procedure calls and register saving conventions 1 Example Convert to assembly: while (save[i] == k) i += 1; i and k are in $s3 and $s5 and base of array save[]

More information

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits CS61C L10 MIPS Instruction Representation II (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #10 Instruction Representation II 2007-7-8 Review There are register calling conventions!

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

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

CS 110 Computer Architecture Lecture 6: More MIPS, MIPS Functions

CS 110 Computer Architecture Lecture 6: More MIPS, MIPS Functions CS 110 Computer Architecture Lecture 6: More MIPS, MIPS Functions Instructor: Sören Schwertfeger http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University

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

Instructors: Randy H. Katz David A. PaHerson hhp://inst.eecs.berkeley.edu/~cs61c/fa10. Fall Lecture #6. Agenda

Instructors: Randy H. Katz David A. PaHerson hhp://inst.eecs.berkeley.edu/~cs61c/fa10. Fall Lecture #6. Agenda CS 61C: Great Ideas in Computer Architecture (Machine Structures) Instructors: Randy H. Katz David A. PaHerson hhp://inst.eecs.berkeley.edu/~cs61c/fa10 Fall 2010 - - Lecture #6 1 Agenda Review Overflow

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

CS 61C: Great Ideas in Computer Architecture Compilers and Floa-ng Point. Today s. Lecture

CS 61C: Great Ideas in Computer Architecture Compilers and Floa-ng Point. Today s. Lecture CS 61C: Great Ideas in Computer Architecture s and Floa-ng Point Instructors: Krste Asanovic, Randy H. Katz hdp://inst.eecs.berkeley.edu/~cs61c/fa12 Fall 2012 - - Lecture #13 1 New- School Machine Structures

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 Instructors: Bernhard Boser and Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c/fa16 9/15/16 Fall 2016 - Lecture #7 1 Review: Basic

More information

Agenda. Strings: C vs. Java. Loading, Storing bytes. Support for Characters and Strings 6/29/2011

Agenda. Strings: C vs. Java. Loading, Storing bytes. Support for Characters and Strings 6/29/2011 6/29/2011 61: Great deas in omputer Architecture (achine tructures) ore achine Language nstructors: Randy H. Katz David A. atterson http://inst.eecs.berkeley.edu/~cs61c/sp11 pring 2011 -- Lecture #6 1

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 Lecture 2: Introduction to C, Part I

CS 61C: Great Ideas in Computer Architecture Lecture 2: Introduction to C, Part I CS 61C: Great Ideas in Computer Architecture Lecture 2: Introduction to C, Part I Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ 1 Agenda Everything is a Number

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering Supporting Nested Procedures James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Memory Layout

More information

CS 110 Computer Architecture MIPS Instruction Formats

CS 110 Computer Architecture MIPS Instruction Formats CS 110 Computer Architecture MIPS Instruction Formats Instructor: Sören Schwertfeger http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides based

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

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

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

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 Instructors: Vladimir Stojanovic and Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/sp16 1 Machine Interpretation Levels of Representation/Interpretation

More information

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduc)on to Machine Language

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduc)on to Machine Language CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduc)on to Machine Language TA: Sco? Beamer h?p://inst.eecs.berkeley.edu/~cs61c/sp12 1 New- School Machine Structures (It s a bit more

More information

9/9/12. New- School Machine Structures (It s a bit more complicated!) CS 61C: Great Ideas in Computer Architecture IntroducMon to Machine Language

9/9/12. New- School Machine Structures (It s a bit more complicated!) CS 61C: Great Ideas in Computer Architecture IntroducMon to Machine Language CS 61C: Great Ideas in Computer Architecture IntroducMon to Machine Language Instructors: Krste Asanovic Randy H. Katz h

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #8: MIPS Procedures 2005-06-30 CS 61C L08 MIPS Procedures (1) Andy Carle Topic Outline Functions More Logical Operations CS 61C L08

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 8: Procedures (cont d), Binary Numbers and Adders Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Review: Procedure Calling Steps

More information

Lecture 5. Announcements: Today: Finish up functions in MIPS

Lecture 5. Announcements: Today: Finish up functions in MIPS Lecture 5 Announcements: Today: Finish up functions in MIPS 1 Control flow in C Invoking a function changes the control flow of a program twice. 1. Calling the function 2. Returning from the function In

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

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

MIPS Instruc,ons CS 64: Computer Organiza,on and Design Logic Lecture #8

MIPS Instruc,ons CS 64: Computer Organiza,on and Design Logic Lecture #8 MIPS Instruc,ons CS 64: Computer Organiza,on and Design Logic Lecture #8 Ziad Matni Dept. of Computer Science, UCSB Administra:ve Your midterm exam is next week on Thurs. 2/15 2/8/18 Matni, CS64, Wi18

More information

Chapter 2. Instructions:

Chapter 2. Instructions: Chapter 2 1 Instructions: Language of the Machine More primitive than higher level languages e.g., no sophisticated control flow Very restrictive e.g., MIPS Arithmetic Instructions We ll be working with

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

Numbers: positional notation. CS61C Machine Structures. Faux Midterm Review Jaein Jeong Cheng Tien Ee. www-inst.eecs.berkeley.

Numbers: positional notation. CS61C Machine Structures. Faux Midterm Review Jaein Jeong Cheng Tien Ee. www-inst.eecs.berkeley. CS 61C Faux Midterm Review (1) CS61C Machine Structures Faux Midterm Review 2002-09-29 Jaein Jeong Cheng Tien Ee www-inst.eecs.berkeley.edu/~cs61c/ Numbers: positional notation Number Base B B symbols

More information

Inequalities in MIPS (2/4) Inequalities in MIPS (1/4) Inequalities in MIPS (4/4) Inequalities in MIPS (3/4) UCB CS61C : Machine Structures

Inequalities in MIPS (2/4) Inequalities in MIPS (1/4) Inequalities in MIPS (4/4) Inequalities in MIPS (3/4) UCB CS61C : Machine Structures CS61C L8 Introduction to MIPS : Decisions II & Procedures I (1) Instructor Paul Pearce inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures http://www.xkcd.org/627/ Lecture 8 Decisions & and Introduction

More information

Review of Last Lecture. CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Representation II. Agenda. Dealing With Large Immediates

Review of Last Lecture. CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Representation II. Agenda. Dealing With Large Immediates CS 61C: Great Ideas in Computer Architecture MIPS Instruction Representation II Guest Lecturer: Justin Hsia 2/11/2013 Spring 2013 Lecture #9 1 Review of Last Lecture Simplifying MIPS: Define instructions

More information

ECE232: Hardware Organization and Design

ECE232: Hardware Organization and Design ECE232: Hardware Organization and Design Lecture 6: Procedures Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Procedures have different names in different languages Java:

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

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

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

Calling Conventions. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See P&H 2.8 and 2.12

Calling Conventions. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See P&H 2.8 and 2.12 Calling Conventions Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.8 and 2.12 Goals for Today Calling Convention for Procedure Calls Enable code to be reused by allowing

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 11 Introduction to MIPS Procedures I Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia CS61C L11 Introduction to MIPS: Procedures I

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

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

Computer Architecture I Midterm I

Computer Architecture I Midterm I Computer Architecture I Midterm I April 11 2017 Computer Architecture I Midterm I Chinese Name: Pinyin Name: E-Mail... @shanghaitech.edu.cn: Question Points Score 1 1 2 12 3 16 4 14 5 18 6 17 7 22 Total:

More information

CS 316: Procedure Calls/Pipelining

CS 316: Procedure Calls/Pipelining CS 316: Procedure Calls/Pipelining Kavita Bala Fall 2007 Computer Science Cornell University Announcements PA 3 IS out today Lectures on it this Fri and next Tue/Thu Due on the Friday after Fall break

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures $2M 3D camera Lecture 8 MIPS Instruction Representation I Instructor: Miki Lustig 2014-09-17 August 25: The final ISA showdown: Is ARM, x86, or

More information

Computer Architecture. Chapter 2-2. Instructions: Language of the Computer

Computer Architecture. Chapter 2-2. Instructions: Language of the Computer Computer Architecture Chapter 2-2 Instructions: Language of the Computer 1 Procedures A major program structuring mechanism Calling & returning from a procedure requires a protocol. The protocol is a sequence

More information

ECE 15B Computer Organization Spring 2010

ECE 15B Computer Organization Spring 2010 ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 7: Procedures I Partially adapted from Computer Organization and Design, 4 th edition, Patterson and Hennessy, and classes taught by and

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #9: MIPS Procedures 2006-07-11 CS 61C L09 MIPS Procedures (1) Andy Carle C functions main() { int i,j,k,m;... i = mult(j,k);... m =

More information

CSSE232 Computer Architecture. Logic and Decision Opera:ons

CSSE232 Computer Architecture. Logic and Decision Opera:ons CSSE232 Computer Architecture Logic and Decision Opera:ons Class status Reading for today: Sec:ons 2.6-2.7 Due today HW0 Lab 0 status? Outline Logical opera:ons ShiI operators Pseudo instruc:ons Immediates

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

UCB CS61C : Machine Structures

UCB CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Guest Lecturer Alan Christopher Lecture 08 MIPS Instruction Representation I 2014-02-07 BOINC MORE THAN JUST SETI@HOME BOINC (developed here

More information

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture EEM 486: Computer Architecture Lecture 2 MIPS Instruction Set Architecture EEM 486 Overview Instruction Representation Big idea: stored program consequences of stored program Instructions as numbers Instruction

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

Lecture 14: Recap. Today s topics: Recap for mid-term No electronic devices in midterm

Lecture 14: Recap. Today s topics: Recap for mid-term No electronic devices in midterm Lecture 14: Recap Today s topics: Recap for mid-term No electronic devices in midterm 1 Modern Trends Historical contributions to performance: Better processes (faster devices) ~20% Better circuits/pipelines

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

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

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

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-2 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language

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

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011 CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-3 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language

More information

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/sp16 1 Machine Interpretation

More information

CSE Lecture In Class Example Handout

CSE Lecture In Class Example Handout CSE 30321 Lecture 07-08 In Class Example Handout Part A: J-Type Example: If you look in your book at the syntax for j (an unconditional jump instruction), you see something like: e.g. j addr would seemingly

More information

CSE Lecture In Class Example Handout

CSE Lecture In Class Example Handout CSE 30321 Lecture 07-09 In Class Example Handout Part A: A Simple, MIPS-based Procedure: Swap Procedure Example: Let s write the MIPS code for the following statement (and function call): if (A[i] > A

More information

Computer Organization and Design

Computer Organization and Design Computer Organization and Design The Hardware/Software Interface Chapter 2 - Introductions: Language of the Computer Dr. Feng Li fli@sdu.edu.cn https://funglee.github.io 1 Contents of Chapter 2 l 2.1 Introduction

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

Computer Architecture Instruction Set Architecture part 2. Mehran Rezaei

Computer Architecture Instruction Set Architecture part 2. Mehran Rezaei Computer Architecture Instruction Set Architecture part 2 Mehran Rezaei Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a MIPS Interpreter

More information

Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University. See P&H 2.8 and 2.12, and A.

Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University. See P&H 2.8 and 2.12, and A. Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University See P&H 2.8 and 2.12, and A.5 6 compute jump/branch targets memory PC +4 new pc Instruction Fetch

More information

Lecture 2: Number Representa2on

Lecture 2: Number Representa2on CSE 30: Computer Organization and Systems Programming Lecture 2: Number Representa2on Diba Mirza University of California, San Diego 1 Levels of Representation High Level Language Program (e.g., C) Compiler

More information

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro 1 Levels of Representation/Interpretation Machine Interpretation High Level Language Program (e.g., C) Compiler Assembly

More information

More C functions and Big Picture [MIPSc Notes]

More C functions and Big Picture [MIPSc Notes] More C functions and Big Picture [MIPSc Notes] Implementing C functions Passing parameters Local variables Stack frames Big picture Compiling Assembling Passing parameters by value or reference Galen H.

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

MIPS Functions and the Runtime Stack

MIPS Functions and the Runtime Stack MIPS Functions and the Runtime Stack COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline

More information

Programming the processor

Programming the processor CSC258 Week 9 Logistics This week: Lab 7 is the last Logisim DE2 lab. Next week: Lab 8 will be assembly. For assembly labs you can work individually or in pairs. No matter how you do it, the important

More information

CS 61C: Great Ideas in Computer Architecture Direct- Mapped Caches. Increasing distance from processor, decreasing speed.

CS 61C: Great Ideas in Computer Architecture Direct- Mapped Caches. Increasing distance from processor, decreasing speed. CS 6C: Great Ideas in Computer Architecture Direct- Mapped s 9/27/2 Instructors: Krste Asanovic, Randy H Katz hdp://insteecsberkeleyedu/~cs6c/fa2 Fall 2 - - Lecture #4 New- School Machine Structures (It

More information

Functions in MIPS. Functions in MIPS 1

Functions in MIPS. Functions in MIPS 1 Functions in MIPS We ll talk about the 3 steps in handling function calls: 1. The program s flow of control must be changed. 2. Arguments and return values are passed back and forth. 3. Local variables

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 12 Introduction to MIPS Procedures II, Logical and Shift Ops 2004-09-27 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Gotta love

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

CS153: Compilers Lecture 8: Compiling Calls

CS153: Compilers Lecture 8: Compiling Calls CS153: Compilers Lecture 8: Compiling Calls Stephen Chong https://www.seas.harvard.edu/courses/cs153 Announcements Project 2 out Due Thu Oct 4 (7 days) Project 3 out Due Tuesday Oct 9 (12 days) Reminder:

More information

Reduced Instruction Set Computer (RISC)

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 machine. Reduced number of cycles needed per instruction.

More information