Appendix A: MIPS Assembly Language. Instruction Format R-type I-type J-type.

Slides:



Advertisements
Similar presentations
SPIM Tutorial CSE 410 Computer Systems. Introduction SPIM: MIPS simulator –Reads/executes assembly source programs Does not execute binaries Download.
Advertisements

MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
SPIM and MIPS programming
Some Samples of MIPS Assembly Language Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
Syscall in MIPS Xinhui Hu Yuan Wang.
1 Computer Architecture MIPS Simulator and Assembly language.
Assembly Language Working with the CPU.
Chap.2: Instructions: Language of the computer Jen-Chang Liu, Spring 2006 Adapted from
MIPS Assembly Language I Computer Architecture CPSC 321 Andreas Klappenecker.
Low-Level Programming Languages
1 Chapter 4: Arithmetic for Computers (Part 1) CS 447 Jason Bakos.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
1 Lecture 6: Compilers, the SPIM Simulator Today’s topics:  SPIM simulator  The compilation process Additional TA hours: Liqun Cheng, legion at.
On Textbook CD: SPIM Jen-Chang Liu, Simulation of a virtual machine Virtual machine (simulator) Differences between SPIM and real MIPS? No delayed.
Midterm Wednesday 11/19 Overview: 25% First Midterm material - Number/character representation and conversion, number arithmetic - DeMorgan’s Law, Combinational.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
MIPS I/O and Interrupt. SPIM I/O and MIPS Interrupts The materials of this lecture can be found in A7-A8 (3 rd Edition) and B7-B8 (4 th Edition).
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Introduction to Microprossor.
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
1 Appendix B Classifying Instruction Set Architecture Memory addressing mode Operations in the instruction set Control flow instructions Instruction format.
Memory and Addressing How and Where Information is Stored.
MIPS I/O and Interrupt. .data val1:.float 0.6 val2:.float 0.8 msg_done:.asciiz "done\n".text.globl main main: li.s $f0, mfc1 $a0, $f0 jal calsqrt.
1 Compilers Modern Compiler Design Supplementary Note 2 SPIM Overview NCYU C. H. Wang.
CWRU EECS 322 March 8, 2000 The SPIM simulator EECS 322: Computer Architecture.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
R3000/001 Assembly Programming using MIPS R3000 CPU R3000 CPU Chip Manufactured by IDT What is MIPS R3000 Processor? A 32-bit RISC CPU developed by MIPS.
CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Computer Science 101 Computer Systems Organization.
Ch2b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Thanks for all the Memory! When 32 registers just won’t do. Many times (almost.
Strings in MIPS. Chapter 2 — Instructions: Language of the Computer — 2 Character Data Byte-encoded character sets – ASCII: 128 characters 95 graphic,
Lecture 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Computer Organization & Programming Chapter 6 Single Datapath CPU Architecture.
Computer Architecture Lecture 03 Fasih ur Rehman.
Lecture 161 Lets examine a SPIM program in detail. io.asm This program is a simple routine which demonstrates input/output using assembly code. SPIM.
1 Lecture 7: MARS, Computer Arithmetic Today’s topics:  MARS intro  Numerical representations  Addition and subtraction.
Dale & Lewis Chapter 5 Computing components
Computer Organization Rabie A. Ramadan Lecture 3.
The MIPS Processor Computer Organization The MIPS Processor Appendix A.
Machine Instructions Instruction Formats. Machine Instructions u Internal Signals in computer have high and low voltages which represent values 0 and.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Introduction to Assembly Language Programming
MIPS Assembly Language Chapter 15 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer, 2003.
3-Apr-2006cse spim © 2006 DW Johnson and University of Washington1 SPIM simulator CSE 410, Spring 2006 Computer Systems
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
MISP Exception Facility Supported by SPIM simulator.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
CS 312 Computer Architecture & Organization
System Calls & Arithmetic
Introduction to Lab #1 José Nelson Amaral.
CS2100 Computer Organisation
MIPS I/O and Interrupt.
Integers/Characters Input/Output
MIPS I/O and Interrupt.
Assembly Programming using MIPS R3000 CPU
MIPS I/O and Interrupt.
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
MPIS Instructions Functionalities of instructions Instruction format
Assembler Directives Example program: .data # DATA segment city: .asciiz “Seattle” .align 2 num: .word 2210, 2341, 26, 0x022ec,
COMS 361 Computer Organization
MIPS I/O and Interrupt.
Assembly Programming using MIPS R3000 CPU
Course Outline for Computer Architecture
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Introduction to SPIM Simulator
PROF. JOHN ABRAHAM UTRGV
Presentation transcript:

Appendix A: MIPS Assembly Language

Instruction Format R-type I-type J-type

SPIM and MIPS Architecture A MIPS processor consists of an integer processing unit (the CPU) and a collection of coprocessors. SPIM simulates two coprocessors: coprocessor 0 handles exceptions, interrupts and the virtual memory system coprocessor 1 is the floating-point unit

Addressing Modes MIPS is a load-store architecture Only load and store instructions access memory Computation instructions operates only on values in registers. The bare machine provides only one addressing mode: c(rx), c+rx Virtual machine provides other modes.

Data Alignment Most load and store instructions operate only on aligned data. A quantity is aligned if its memory address is a multiple of its size in bytes. Example: a half-word object must be stored at a even address. MIPS provides some instructions to manipulate unaligned data. ( lwl, lwr, swl, swr )

Exceptions and Interrupts Will be discussed in Chapter 5. Deal with exceptions caused by errors during an instruction’s execution; or external interrupts caused by I/O devices. SPIM only simulates part of MIPS’ exception facility. BadVAddr, Status, Cause, EPC

Instruction Categories Arithmetic and Logical Instructions Constant-Manipulating Instructions Comparison Instructions Branch Instructions Jump Instructions Load Instructions Store Instructions Data Movement Instructions Floating-Point Instructions Exception and Interrupt Instructions

Assembler Syntax.align n : align the next datum on a 2^n byte boundary..ascii str, asciiz str.byte b1,…,bn.data.double d1,..,dn More on Pages A-47 and A-48

System Calls System services (Figure A.9.1): print_int, print_float, print_double, print_string, read_int, read_float, read_double, read_string, srbk, exit

Figure A.9.1

Example.data str:.asciiz “the answer= “.text li $v0,4 # print_str la $a0,str # addr of string to print syscall

Programming Assignment A.6 (due on 10/5/2005) A.7 (due on 10/5/2005) A.8 (due on 10/12/2005) Submit a hardcopy including the source code and the results of executing the program. Also send an electronic copy of the source code to your TA (g9304).