Spim as Intermediate code

This document describes the subset of Spim that you are going to use for your intermediate code. Examples of spim programs using this subset can be found on the website for the course. For information about other features of Spim see the complete document, also online.

Addressing Modes:
Spim allows various addressing modes, a subset of which we can use during intermediate code generation
FormatAddress Computation
registerindicates the register
(register)contents of the register
immimmediate value
imm(register)immediate value + contents of register
symboladdress of symbol

Instructions

  1. Data Movement
  2. Arithmetic
  3. Comparison
  4. Branching
  5. System Services (i/o). The following shows the instructions required to read and print integers, as well as designate the termination of the program.

Using the Spim Interpreter

The spim interpreter comes both in a command line format (spim) and in a X-window interface (xspim), both of which are installed on osf1. Complete descriptions of the use of these tools is found in the online spim documentation. This brief description only outlines the minimum stuff you need to know to use the X-window version.

The interface is fairly self-explanatory, however you will probably only need to use a few of the buttons.