MIPS Machine Assembly Language - PowerPoint PPT Presentation

About This Presentation
Title:

MIPS Machine Assembly Language

Description:

... . if/else do/while while Introduction to SPIM Now let s take a quick look at the xspim program and try to write and run the Fibonacci numbers program. – PowerPoint PPT presentation

Number of Views:58
Avg rating:3.0/5.0
Slides: 10
Provided by: Mark1339
Learn more at: http://cs.trinity.edu
Category:

less

Transcript and Presenter's Notes

Title: MIPS Machine Assembly Language


1
MIPS Machine Assembly Language
  • 2-7-2003

2
Opening Discussion
  • What did we talk about last class?
  • Have you seen anything interesting in the news?
  • Do you have any questions about the graded
    quizzes?

3
Powers of 2 Loop
  • Last class I asked you to write assembly for a
    loop that basically calculates powers of two.

LoopTop add s1, s1, s1 sub t0, t0, 1 beq
t0, zero, LoopTop
4
Jump Statements
  • In addition to the conditional branch statements
    beq and bne, there are non-conditional jumps.
  • j label always jumps to the given label.
  • jr register always jumps to the address for
    that register.
  • These are helpful when the flow cant just be
    linear.

5
Basic Blocks
  • This is a term that you see any time you are
    talking about program analysis with any language.
    These are blocks of code that always execute
    sequentially from top to bottom.
  • They have no entry points in the middle and any
    branches or jumps are at the end.

6
Building Conditionals
  • MIPS compilers build all of their conditions out
    of beq, bne, and slt with the help of the fixed
    register zero.
  • Obviously we can check for equality, in equality,
    and less than. Greater than just causes us to
    reverse the order of the arguments from less
    than.
  • Who can we get something like less than or equal
    to?

7
Different Control Structures in MIPS Assembly
  • Lets take a look at how we build each of the
    different control structures we would use in
    C/C in MIPS assembly.
  • if/else
  • do/while
  • while

8
Introduction to SPIM
  • Now lets take a quick look at the xspim program
    and try to write and run the Fibonacci numbers
    program.

9
Minute Essay
  • Write assembly language to do the following C
    code. You can assume that some registers are
    attached to variables.
  • Dont leave without turning in assignment 2.

int a0 for(int j6 jgt0 j) aj
Write a Comment
User Comments (0)
About PowerShow.com