CSE 378 - Winter 2002

Machine Organization and Assembly Language Programming

Software needed for the course

SPIM 6.3a simulator (required)

We have a custom version of the spim simulator which has been extended to do file open/read/write/close. This extension is only available in the PC version of spim. This extended version is intended ONLY for use in CSE and is not supported by anyone for any other use.

Download spim63aF1.zip by clicking on the link, and either select "Open from location" or save it to disk and unzip it by double-clicking. No further installation is needed. A larger file containing all the sources including the mods to PCSpim is also available as spim63aF1-src.zip.

The official spim page has the original version of the program and other useful information.

The best source of documentation is said to be Appendix A of your book, however, it is a bit general. This PDF describes the windows implementation of spim to some degree.

If you have any trouble getting spim or installing it, please do not hestitate to send Bart mail (bart@cs).

Note: both of the above archives include a modified trap handler with additional routines for Assignment 4. The original archives can be found in spim63aF0.zip and spim63aF1-src.zip.

Installing a trap handler in PCSpim

The trap handler is a small piece of assembly code which catches any traps that your program may cause and calls the right piece of code in PCSpim to handle them. If you specify a trap handler (as you should), it is loaded when PCSpim starts, before you load your code.

In Assignment 4 we give you some helper procedure by embedding them in a trap handler file. This way they are loaded before your code is loaded, and you can simply call them like you would call any other procedure.

In order to specify which trap handler PCSpim uses, you must open the Simulator->Settings... dialog box. Within this box, towards the bottom, there is a place for you to type in the filename of the trap handler you wish to use. You may also browse for it.

To install the trap handler for assignment 4, simply download it from here, saving it to some place you can remember. For example, I saved mine to ...\Desktop\trap.handler. Note that you should not save it as a text file, rather save it as "trap.handler" (the quotes should be included) with file type of "All files". Now start up PCSpim. If you have not run PCSpim before, it will ask you if you want to open the Settings... dialog, say yes. If you have run it before, open the Settings... dialog yourself from the Simulator menu.

With the Settings... dialog open, click on browse and find the file you saved (e.g. ...\Desktop\trap.handler), and Open it. Click OK in the Settings... dialog, and you are done. Note that you may need to restart PCSpim at this point, simply exit and re-run it.

There are a few ways to tell if you have the correct trap handler for assignment 4. The easiest, though perhaps not the most reliable is to look at first shown in the code window. If it is line number 105 (... ; 105: lw $a0, 0($sp) # argc) then you have the right one. If it is line number 102, you do not.

Please send any questions to bart@cs.

ConTEXT editor (recommended)

The source files that spim reads in are just text, but must have a .s file name extension to be recognized. This means that Notepad and Word are awkward to use, as they insist upon adding .txt to the end of text file names.

ConTEXT is a simple text editor that supports syntax highlighting (like Visual Studio), and is small, fast and fairly easy to use. You can download version 0.93.3 here. To get syntax highlighting for MIPS assembly code, download MIPSAssembler.chl and put it in the Highlighters directory after you install ConTEXT.

Again, if you have any trouble, please send Bart mail (bart@cs).

SLOOP-SMOK

SLOOP-SMOK is available here, including documentation. You should be using the latest version (3.0.2) as it has been updated especially for this class.