Size: px
Start display at page:

## Transcription

1 Fall 2017 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture Introduction 3/4 Avinash Kodi Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio Website: Course Administration SPIM (or Qt-SPIM) tutorial today in-class 1

2 MIPS ISA So Far Category Instr Op Code Example Meaning Arithmetic (R & I format) Data Transfer (I format) Cond. Branch (I & R format) Uncond. Jump (J & R format) add 0 and 32 add \$s1, \$s2, \$s3 \$s1 = \$s2 + \$s3 subtract 0 and 34 sub \$s1, \$s2, \$s3 \$s1 = \$s2 - \$s3 add immediate 8 addi \$s1, \$s2, 6 \$s1 = \$s2 + 6 or immediate 13 ori \$s1, \$s2, 6 \$s1 = \$s2 v 6 load word 35 lw \$s1, 24(\$s2) \$s1 = Memory(\$s2+24) store word 43 sw \$s1, 24(\$s2) Memory(\$s2+24) = \$s1 load byte 32 lb \$s1, 25(\$s2) \$s1 = Memory(\$s2+25) store byte 40 sb \$s1, 25(\$s2) Memory(\$s2+25) = \$s1 load upper imm 15 lui \$s1, 6 \$s1 = 6 * 2 16 br on equal 4 beq \$s1, \$s2, L if (\$s1==\$s2) go to L br on not equal 5 bne \$s1, \$s2, L if (\$s1!=\$s2) go to L set on less than 0 and 42 slt \$s1, \$s2, \$s3 if (\$s2<\$s3) \$s1=1 else \$s1=0 set on less than immediate 10 slti \$s1, \$s2, 6 if (\$s2<6) \$s1=1 else \$s1=0 jump 2 j 2500 go to jump register 0 and 8 jr \$t1 go to \$t1 jump and link 3 jal 2500 go to 10000; \$ra=pc+4 See handout Other Instructions 2

3 Register Organization Name Register Number Usage Preserved on Call \$zero 0 Constant Value of 0 n.a. \$v0-\$v1 2-3 Values for results and expressions \$a0-\$a3 4-7 Arguments No \$t0-\$t Temporaries No \$s0-\$s Saved Yes \$t8-\$t More Temporaries No \$gp 28 Global Pointer Yes \$sp 29 Stack Pointer Yes \$fp 30 Frame Pointer Yes \$ra 31 Return Address Yes No What about Register 1? Example - 1 Write a MIPS code to move 100 signed 16-bits signed from memory location A (0x ) to memory location B (0x ) addi \$s1, \$zero, 4096 \\ load the address A into \$s1 addi \$s2, \$zero, 8192 \\ load the address B into \$s2 addi \$t0, \$zero, 100 \\ load the counter into \$t0 LOOP: lh \$s3, 0(\$s1) \\ load halfword into \$s3 sh \$s3, 0(\$s2) \\ store halfword from \$s3 addi \$s1, \$s1, 2 \\ adjust the address for A addi \$s2, \$s2, 2 \\ adjust the address for B subi \$t0, \$t0, 1 \\ reduce the counter bneq \$t0, \$zero, LOOP \\ test the loop: \$t0 - \$zero =? 3

5 Unix Object Format Header (contains sizes of other parts) Text (machine code) Data (global and static data) Symbol table (associates addresses with external labels, lists unresolved references) Relocation Table (identifies instructions and data words that rely on absolute addresses) Debug (information contains a precise description of the way the program was compiled) Header Text Data Symbol Table Relocation Table (maps symbols to instructions) Debug Information MIPS Layout CPU Registers (\$0 - \$31) ALU Unit Multiply/Divide Lo and Hi Registers (to store totally 64 bits) Coprocessor 1 (Floating Point Unit) Registers (\$0 - \$31) ALU Coprocessor 0 (Traps and Memory) BadVAddr, Status, Cause, EPC 0x7FFF FFFC 0x PC = 0x Stack Heap Data Static Data Text Reserved 5

6 System Calls System calls provide a way to communicate (input/output) Certain system calls use specific data during the execution of the (primarily \$v0 and \$a0) Service System Call Code Arguments print_int 1 \$a0 = integer print_float 2 \$f12 = float print_double 3 \$f12 = double print_string 4 \$a0 = string Result read_int 5 integer (in \$v0) read_string 8 \$a0 = buffer, \$a1 = length exit 10 print_char 11 \$a0 = char read_char 12 char (in \$v0) Examples of System Calls Assembly Code # Get an integer from user li \$v0, 5 Explanation # Load immediate system code 5 into \$v0 # System call command get integer from # user returned in \$v0 # Print out the Result li \$v0, 1 move \$a0, \$t0 # code for print_int # put result in \$a0 # print out the result 6

7 Directives Directives Explanation.align n Align the next datum on a 2 n boundary (Example.align 2 aligns the next value on a word boundary).ascii str.asciiz str.data <addr>.byte b1,. bn.globl sym.space n.text <addr>.word w1, wn Store the string str in memory, but do not null terminate it Store the string str in memory and null terminate it Subsequent items are stored in the data segment. If optional argument addr is present, subsequent items are stored starting at addr Store the n values in successive memory locations Declare the label sym is global and can be referenced from other files Allocate n bytes of space in the current segment Subsequent items are put in the user text segment (instructions) Store the n 32-bit quantities in successive memory words Labels Labels notify the program to attach a name to a data declaration or a text (program) line Each data entry must be labeled a unique name or label The specific name main MUST be the first line of text Labels are always followed by semicolon Examples string: prompt:.asciiz Hello World\n.asciiz Enter your name\n 7

8 Hello World Program # This is a simple program to print hello world # a comment starts with a # till the end of the line.data # start putting stuff in the data segment greet:.asciiz "Hello world\n # declare greet to be the string.text #start putting stuff in the text segment main: # main is a label here. Names a function li \$v0, 4 # system call code for print_str(sect1.5) la \$a0, greet # address of string to print # print the string Example 2 Ask the user for his name and display it back to him! Should look like: Please Enter Your Name xxxxxx Your Name is xxxxxx 8

9 Solution.data yourname:.asciiz "Please Enter Your Name\n" name:.space 16 nameprint:.asciiz "Your name is\n" main:.globl main.text li \$v0,4 la \$a0,yourname li \$v0,8 la \$a0,name li \$a1,16 li \$v0,4 la \$a0,nameprint li \$v0,4 la \$a0,name Example 3-4 From previous example, enter a number after name, add 100 to it and display the number back to the user! Sum all numbers from 1 to 10 and display the result 9

### MIPS (SPIM) Assembler Syntax

MIPS (SPIM) Assembler Syntax Comments begin with # Everything from # to the end of the line is ignored Identifiers are a sequence of alphanumeric characters, underbars (_), and dots () that do not begin

Fall 2017 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture 2/4 Avinash Kodi Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701 E-mail: kodi@ohio.edu

### CS3350B Computer Architecture MIPS Introduction

CS3350B Computer Architecture MIPS Introduction Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada Thursday January

### CS3350B Computer Architecture

CS3350B Computer Architecture Winter 2015 Lecture 4.1: MIPS ISA: Introduction Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted d from lectures on Computer Organization and Design, Patterson & Hennessy,

### Orange Coast College. Business Division. Computer Science Department CS 116- Computer Architecture. The Instructions

Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture The Instructions 1 1 Topics: Assembly language, assemblers MIPS R2000 Assembly language Instruction set

### QtSPIM and MARS : MIPS Simulators

QtSPIM and MARS : MIPS Simulators Learning MIPS & SPIM MIPS assembly is a low-level programming language The best way to learn any programming language is to write code We will get you started by going

### COMP2421 COMPUTER ORGANZATION. Lab 3

Lab 3 Objectives: This lab shows you some basic techniques and syntax to write a MIPS program. Syntax includes system calls, load address instruction, load integer instruction, and arithmetic instructions

### MIPS Processor Overview

MIPS Processor Cptr280 Dr Curtis Nelson MIPS Processor Overview Hardware Design philosophy Architecture Software Assembly language program structure QTSpim simulator Example programs 1 MIPS Processor Power

### 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,

### SPIM Instruction Set

SPIM Instruction Set This document gives an overview of the more common instructions used in the SPIM simulator. Overview The SPIM simulator implements the full MIPS instruction set, as well as a large

### 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

### ECE 30 Introduction to Computer Engineering

ECE 30 Introduction to Computer Engineering Study Problems, Set #3 Spring 2015 Use the MIPS assembly instructions listed below to solve the following problems. arithmetic add add sub subtract addi add

### MIPS and QTSPIM Recap. MIPS Architecture. Cptr280. Dr Curtis Nelson. Cptr280, Autumn

MIPS and QTSPIM Recap Cptr280 Dr Curtis Nelson MIPS Architecture The MIPS architecture is considered to be a typical RISC architecture Simplified instruction set Programmable storage 32 x 32-bit General

### CS3350B Computer Architecture MIPS Instruction Representation

CS3350B Computer Architecture MIPS Instruction Representation Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada

### 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,

### Computer Systems and Architecture

Computer Systems and Architecture Stephen Pauwels MIPS: Introduction Academic Year 2018-2019 Outline MIPS Registers and Memory Language Constructs Exercises Assembly Language Very closely related to machine

### 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,

### 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

### MIPS Architecture and Assembly Language Overview

MIPS Architecture and Assembly Language Overview Adapted from: http://edge.mcs.dre.g.el.edu/gicl/people/sevy/architecture/mipsref(spim).html [Register Description] [I/O Description] Data Types and Literals

### 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.

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

2.9 Communication with People: Byte Data & Constants Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21 32: space 33:! 34: 35: #...

### 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

### 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

### CPSC 330 Computer Organization

CPSC 330 Computer Organization Chapter 2-II Instructions: Language of the computer MIPS Instructions - Review Instruction Meaning add \$s1,\$s2,\$s3 \$s1 = \$s2 + \$s3 sub \$s1,\$s2,\$s3 \$s1 = \$s2 \$s3 addi \$s1,\$s1,4

### 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 &

### We will study the MIPS assembly language as an exemplar of the concept.

MIPS Assembly Language 1 We will study the MIPS assembly language as an exemplar of the concept. MIPS assembly instructions each consist of a single token specifying the command to be carried out, and

### 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:

### 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

### Lecture 7: Examples, MARS, Arithmetic

Lecture 7: Examples, MARS, Arithmetic Today s topics: More examples MARS intro Numerical representations 1 Dealing with Characters Instructions are also provided to deal with byte-sized and half-word quantities:

### CS/COE1541: Introduction to Computer Architecture

CS/COE1541: Introduction to Computer Architecture Dept. of Computer Science University of Pittsburgh http://www.cs.pitt.edu/~melhem/courses/1541p/index.html 1 Computer Architecture? Application pull Operating

### Field 6-Bit Op Code rs Field rt Field 16-bit Immediate field

Introduction to MIPS Instruction Set Architecture The MIPS used by SPIM is a 32-bit reduced instruction set architecture with 32 integer and 32 floating point registers. Other characteristics are as follows:

### 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[]

### 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

### ECE 30 Introduction to Computer Engineering

ECE 30 Introduction to Computer Engineering Study Problems, Set #4 Spring 2015 Note: To properly study and understand the problems below, it is strongly recommended to implement and run your solution (and/or

### 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

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

### 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

### 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

### 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

### MIPS ISA and MIPS Assembly. CS301 Prof. Szajda

MIPS ISA and MIPS Assembly CS301 Prof. Szajda Administrative HW #2 due Wednesday (9/11) at 5pm Lab #2 due Friday (9/13) 1:30pm Read Appendix B5, B6, B.9 and Chapter 2.5-2.9 (if you have not already done

### MIPS Assembly Language. Today s Lecture

MIPS Assembly Language Computer Science 104 Lecture 6 Homework #2 Midterm I Feb 22 (in class closed book) Outline Assembly Programming Reading Chapter 2, Appendix B Today s Lecture 2 Review: A Program

### 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

### Assembly labs start this week. Don t forget to submit your code at the end of your lab section. Download MARS4_5.jar to your lab PC or laptop.

CSC258 Week 10 Logistics Assembly labs start this week. Don t forget to submit your code at the end of your lab section. Download MARS4_5.jar to your lab PC or laptop. Quiz review A word-addressable RAM

### MIPS Reference Guide

MIPS Reference Guide Free at PushingButtons.net 2 Table of Contents I. Data Registers 3 II. Instruction Register Formats 4 III. MIPS Instruction Set 5 IV. MIPS Instruction Set (Extended) 6 V. SPIM Programming

### 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

### 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

### Compiling Techniques

Lecture 10: An Introduction to MIPS assembly 18 October 2016 Table of contents 1 Overview 2 3 Assembly program template.data Data segment: constant and variable definitions go here (including statically

### 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

### 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

### ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5 MIPS/SPIM General Purpose Registers Powers of Two 0 \$zero all bits are zero 16 \$s0 local variable 1 \$at assembler temporary 17 \$s1 local

### 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

### 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

### 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

### Today s Lecture. MIPS Assembly Language. Review: What Must be Specified? Review: A Program. Review: MIPS Instruction Formats

Today s Lecture Homework #2 Midterm I Feb 22 (in class closed book) MIPS Assembly Language Computer Science 14 Lecture 6 Outline Assembly Programming Reading Chapter 2, Appendix B 2 Review: A Program Review:

### SPIM & MIPS Programming

Computer Organization and Structure 2012 SPIM & MIPS Programming Department of Information Management National Taiwan University Outline Introduction to Assembly Language SPIM Getting Started MIPS Assembly

### 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

### 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

### EE 361 University of Hawaii Fall

C functions Road Map Computation flow Implementation using MIPS instructions Useful new instructions Addressing modes Stack data structure 1 EE 361 University of Hawaii Implementation of C functions and

### 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]

### 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

### MIPS Assembly Language

MIPS Assembly Language Chapter 15 S. Dandamudi Outline MIPS architecture Registers Addressing modes MIPS instruction set Instruction format Data transfer instructions Arithmetic instructions Logical/shift/rotate/compare

### 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

### 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

### 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

### 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

### CSSE 232 Computer Architecture I. I/O and Addressing

CSSE 232 Computer Architecture I I/O and Addressing 1 / 21 Class Status Reading for today 2.9-2.10, 6.6 (optional) 2 / 21 Outline I/O More memory instructions Addressing modes Jump and branch instructions

### 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

### Assignment 1: Pipelining Implementation at SPIM Simulator

Assignment 1: Pipelining Implementation at SPIM Simulator Due date: 11/26 23:59 Submission: icampus (Report, Source Code) SPIM is a MIPS processor simulator, designed to run assembly language code for

### 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

### 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,

### 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

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

### Communicating with People (2.8)

Communicating with People (2.8) For communication Use characters and strings Characters 8-bit (one byte) data for ASCII lb \$t0, 0(\$sp) ; load byte Load a byte from memory, placing it in the rightmost 8-bits

### MIPS Assembly Language Programming

MIPS Assembly Language Programming COE 308 Computer Architecture Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Assembly

### Lecture 6: Assembly Programs

Lecture 6: Assembly Programs Today s topics: Procedures Examples Large constants The compilation process A full example 1 Procedures Local variables, AR, \$fp, \$sp Scratchpad and saves/restores, \$fp Arguments

### 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

### MIPS Assembly Language Programming

MIPS Assembly Language Programming ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals [Adapted

### 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

### CS3350B Computer Architecture MIPS Procedures and Compilation

CS3350B Computer Architecture MIPS Procedures and Compilation Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada

### Review (1/2) IEEE 754 Floating Point Standard: Kahan pack as much in as could get away with. CS61C - Machine Structures

Review (1/2) CS61C - Machine Structures Lecture 11 - Starting a Program October 4, 2000 David Patterson http://www-inst.eecs.berkeley.edu/~cs61c/ IEEE 754 Floating Point Standard: Kahan pack as much in

### 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

### MIPS Assembly Language Guide

MIPS Assembly Language Guide MIPS is an example of a Reduced Instruction Set Computer (RISC) which was designed for easy instruction pipelining. MIPS has a Load/Store architecture since all instructions

### 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

### 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

### Assembly Language Programming. CPSC 252 Computer Organization Ellen Walker, Hiram College

Assembly Language Programming CPSC 252 Computer Organization Ellen Walker, Hiram College Instruction Set Design Complex and powerful enough to enable any computation Simplicity of equipment MIPS Microprocessor

### CENG3420 Lab 1-1: MIPS assembly language programing

CENG3420 Lab 1-1: MIPS assembly language programing Haoyu YANG Department of Computer Science and Engineering The Chinese University of Hong Kong hyyang@cse.cuhk.edu.hk 2017 Spring 1 / 18 Overview SPIM

### M2 Instruction Set Architecture

M2 Instruction Set Architecture Module Outline Addressing modes. Instruction classes. MIPS-I ISA. Translating and starting a program. High level languages, Assembly languages and object code. Subroutine

### 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

### 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

### MIPS function continued

MIPS function continued Review Functions Series of related instructions one after another in memory Called through the jal instruction Pointed to by a label like any other Returns by calling Stack Top

### 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

### CSE 2021: Computer Organization

CSE 2021: Computer Organization Lecture-5 Code Translation-3 Heap, Storage options, Addressing modes, Concurrent data access, Linking & loading Shakil M. Khan (adapted from Prof. Roumani) So Far Registers

### Introduction to MIPS Processor

Introduction to MIPS Processor The processor we will be considering in this tutorial is the MIPS processor. The MIPS processor, designed in 1984 by researchers at Stanford University, is a RISC (Reduced

### 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

### CS222: MIPS Instruction Set

CS222: MIPS Instruction Set Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Previous Introduction to MIPS Instruction Set MIPS Arithmetic's Register Vs Memory, Registers

### 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