CS U380 Lab 3 - Spring, 2009

Adapted from: CS61C, UCBerkeley

Purpose:

To learn to run assembly programs and use the MIPS MARS simulator.

Preparation

Before starting the lab, go to Google and look up: MARS MIPS.
Install the simulator on your machine.

     If you are on a Windows machine, follow the directions.
     If you are on a Linux/UNIX box, download the Mars.jar file
and run the simulator with the command:
          java -jar Mars.java

Do the MARS tutorial Part 1: Basic MARS Use, points 1 to 11, and skip point 12.

Assignment

Write a piece of MIPS code that starts with values in $s0 and $s1, copies them to $t0 and $t1, and then adds fibonacci-style to put values in registers $ti, for 2<=i<=7. For example, if $s0, $s1 contain the values 2 and 1, then after running your code, registers $t0 through $t7 should contain these values:

$t0 = 2 (2)
$t1 = 1 (1) 
$t2 = 3 (2+1)
$t3 = 4 (1+3)
.
.
.
$t7 = 29 (11+18)

You should not set the value of $s0 and $s1 in your code. Learn how to set those values manually within MARS. Point 10 in the tutorial shows you how.

You are only allowed to use the instructions learned in class so far for this assignment.

Assembly programs go in text files with a .s extension. For this lab, we give you a skeleton program to start from;
copy the file /course/csu380jc/.www/lab3/lab3.s to one of your directories.
The program must start with the label "main:" and your code goes where the comments say to put it.

Check off

To get checked off, show me your code, how you run it, and that it produced the correct results.


This page last modified 02/02/2008.