A Walk Through PCSPIM

This page provides you with a set of video clips to help you learn how to use PCSPIM the SPIM instruction set simulator for Windows. We take a simple example and walk through the basic steps for assembly debugging and execution. The SPIM simulator provides you with a window into the machine registers and memory enabling you to clearly understand the operation of the assembly language programming level. To play these clips you will need RealPlayer G2. The clips are encoded for playback over LAN (for example from the residence halls) and over a 28.8K modem.
 

Downloading Files

Note that each media clip is encoded for access from a 28.8K modem and for access assuming you are in the residence hall, i.e., LAN. However the individual clips are also available in each table in downloadable ZIP format if you would rather do that than play them over the network. If you wish to download all  seven clips at once here is a  zip file . This file is approximately 7 Mbytes. You can then play the clips locally using RealPlayer G2 and the performance should be better, or at least not subject to the network. The quality of the clips could be better (particularly the audio) but this is the best we can do at the moment with the time we have. Also we will be moving to a new simulator next semester and are focused in generating high quality tutorials for that simulator. These clips are functional and work fine if you download and play them locally.

Obtaining SPIM

You can obtain a version of PCSPIM for windows from the University of Wisconsin at ftp.cs.wisc.edu/pub/spim. The latest copies of the distribution and documentation are available below along with some examples of SPIM code.
PCSPIM Installation for Windows This the latest version of PCSPIM 
PCSPIM Documentation PDF documentation for PCSPIM
SPIM Code Examples This is a directory of some example SPIM programs

Starting SPIM

From the menu start PCSPIM and you will find the main PCSPIM window. The first step is to assemble and load the program into SPIM memory. Once this is done then you can examine both the data and text segments and convince yourselves that the stored values matched with your expectations. In this example we will use the following simple SPIM program.
Media Clips: 28.8K 
Media Clips: LAN
Download
Initialization, Assembly and Loading
Initialization, Assembly and Loading
Zip File
Register File
Register File
Zip File
Text Segment
Text Segment
Zip File
Data Segment
Data Segment
Zip File

Program Execution

Once your program assembles correctly you are ready for execution. To do so we must first set PC value to the address of the first instruction in the program. Then we can simply click on GO. If there are no errors the program should execute correctly.
Media Clips: 28.8K 
Media Clips: LAN
Download
Program Execution
Program Execution
Zip File

Debugging SPIM Programs

What do you do when your programs do not work? There are at least two debugging techniques that are supported by PCSPIM. Breakpoints and single step (the latter really being the most general form of the former). In breakpoints you provide PCSPIM with an address of an instruction in the text segment. When the program reaches that instruction during execution it will stop. You can then examine the values in the registers and memory and see if they are what you expected them to be at that point. If they are not then you can proceed to diagnose he problem without going any further. In single step mode there is effectively a breakpoint after each instruction: PCSPIM executes one instruction and stops. This is the slowest way to debug a program but is the most detailed and will enable you to find just about any error you are liable to make at this level.
Media Clips: 28.8K
Media Clips: LAN
Download
Using Breakpoints
Using Breakpoints
Zip File
Single Step Mode
Single Step Mode
Zip File

Miscellaneous

As and when we identify new features or issues with PCSPIM, you can expect to find some clips here.