include("./header.php"); ?>
SPIM is a simulator for the MIPS instruction set. MIPS is a set of assembly level instructions that were originally designed for (not surprisingly) the MIPS cpu, which includes the "rxxxx" series of chips. It's a reduced instruction set architecture which means it trades complex instructions, that can do a lot, for simple ones, that do very little. The result is an instruction set that is very fast, and each instruction is able to execute independent of the others. This has large implications you'll learn about throughout this course.
This first lab will introduce you to the simulator we'll be using.
SPIMThere are two main versions of SPIM available. The command line version is called 'spim' and is available at /usr/local/bin/spim. The "gui" version is called 'xspim' and it's available at /usr/local/bin/xspim. There is no functional difference between the two, but you may use either for the labs. There is also a windows version available from the main page for SPIM. Please note that editing files in windows and then using them in Unix can bring unexpected results (^M characters are one example) so be careful. Also note the Unix version will be the focus of our labs.
SPIM allows you to monitor the values contained in the various registers, which instruction is being executed, and even the memory being used by your program. For now, just consider a register to be a variable that is stored within the processor itself. This makes accessing them very fast in an actual computer.
SPIM also allows you to "step through" your code. Stepping through code means you execute one statement and stop, then execute another and stop, etc... Try stepping through the code below and watch how the values in the registers change. By being aware of what SPIM is saying you can save many headaches trying to fix something that's broken.
The programYour task in this first lab is to just run this program: lab1.s
This program, in its current state, computes the sum from 1 to n, where n is a positive integer read from the user, and prints the result to the screen. Take some time and run this program with spim (or xspim) a couple times.
Your task is to use this program to get familiar with SPIM and how it works. Don't worry too much about the program itself if you don't understand it now.
What to turn inThis lab is a demonstration lab, but attendance will be taken and counted toward your participation.
include("./footer.php"); ?>