Appendix A: MIPS Assembly Language - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Appendix A: MIPS Assembly Language

Description:

SPIM and MIPS Architecture ... SPIM simulates two coprocessors: ... SPIM only simulates part of MIPS' exception facility. BadVAddr, Status, Cause, EPC ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 13
Provided by: WenH
Category:

less

Transcript and Presenter's Notes

Title: Appendix A: MIPS Assembly Language


1
Appendix A MIPS Assembly Language

2
Instruction Format
  • R-type
  • I-type
  • J-type

3
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

4
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), crx
  • Virtual machine provides other modes.

5
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)

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

7
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

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

9
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

10
Figure A.9.1
11
Example
  • .data
  • str
  • .asciiz the answer
  • .text
  • li v0,4 print_str
  • la a0,str addr of string to print
  • syscall

12
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).
Write a Comment
User Comments (0)
About PowerShow.com