Spasm (web start / remember that?)

Java Web Start (All Platforms)

OSX Instructions

  • Install Java (yep it's Java)
  • This app is very old and unsigned, so you need to add an exception for "https://research.egrsoftware.com/" (remove it afterward)
  • Info on how to add an exception: http://java.com/en/download/faq/exception_sitelist.xml
  • Click the link above and it will download the spasm1b.jnlp file
  • After file downloads click "keep" and "Show in Finder"
  • Right click the JNLP file and click open with "Java Web Start App"
  • It should load / you don't need to assign a desktop link
  • Enter this simple program (it adds 1 to register 1 and loops forever):
    addi $1, $1, 1
    beq $0, $0, -2
  • Click "compile"; make sure to have an extra new line after the beq statement.
  • Click execute next as it will step through the program visually and loop adding 1 to a register.
  • Click on the "instruction memory" or "registers" square on the layout to view internal contents.
  • For fun check out the hidden tank game by clicking exactly on the iris of the eye of the lower right icon, don't move the mouse, and type in "xyzzy".

    Screenshot

    Overview

    Spasm is a visual simulator of a single-cycle implementation of MIPS. A MIPS assembly program based on a reduced instruction set can be entered and execution viewed graphically. Users may modify values of several parameters while a simulation is running. Explore!

    I worked on SPASM the summer after my freshman year in college and into the fall of 1997 on a Pentium-166 using Java and Netscape's IFC graphics API (preceeded JFC/Swing). This project counted as my senior project and was a proof of concept for a more comprehensive visual simulator. It is based on figure 5.13 in chapter 5 of the book Computer Organization & Design -- "The Hardware / Software Interface" by Patterson and Hennesey. This book is widely used in undergraduate computer architecture courses.

    Spasm has been updated to run by Java web start on 1.4+ JVMs and has been tested on Win32 XP and Mac OSX 10.3.5. If you are using a recent version of OSX simply click on the "web start" link at the top of the page. If you are on Windows or Linux you must first install a 1.4+ JVM (and on OSX now too!); web start is installed as part of the process. After installation click on the "web start" link at the top of page.

    If you find Spasm useful feel free to contact the author, Michael Leahy (remove spam block). Please report any bugs that you may find and I will fix them right away. Also, it would be great to receive user programs that provide examples of usage and I will post the good ones on this page. If you are a professor and use Spasm as a teaching aid for a computer architecture course please contact me, so that I might add your class information to the list below.

    Below is a list of supported instructions; $1 specifies register 1:

    InstructionExampleMeaning
    Addadd $1, $2, $3$1 = $2 + $3
    Add Immediateaddi $1, $2, 100$1 = $2 + 100
    Add Immediate Unsignedaddiu $1, $2, 100$1 = $2 + 100
    Add Unsignedaddu $1, $2, $3$1 = $2 + $3
    Andand $1, $2, $3$1 = $2 & $3
    And Immediateandi $1, $2, 100$1 = $2 & 100
    Branch On Equalbeq $1, $2, 25if ($1 == $2) go to pc + 4 + 100
    Branch On Not Equalbne $1, $2, 25if ($1 != $2) go to pc + 4 + 100
    Load Wordlw $1, 100($2)$1 = Memory[$2 + 100]
    No Operationnopno operation
    Oror $1, $2, $3$1 = $2 | $3
    Or Immediateori $1, $2, 100$1 = $2 | 100
    Set On Less Thanslt $1, $2, $3if ($2 < $3) $1 = 1; else $1 = 0
    Set On Less Than Immediateslti $1, $2, 100if ($2 < 100) $1 = 1; else $1 = 0
    Subtractsub $1, $2, $3$1 = $2 - $3
    Subtract Unsignedsubu $1, $2, $3$1 = $2 - $3
    Store Wordsw $1, 100($2)Memory[$2 + 100] = $1

    A simple program in Spasm to repeatedly add 1 to a register:
    addi $1, $1, 1
    beq $0, $0, -2

    Spasm can load and save programs and the state of the simulator. These files are located under the "save" directory. This directory is automatically created on the desktop if web start is used or in the location of the offline installation.

    The parser is fairly simple. One instruction per line regardless of white space. Users may enter blank lines and comments are indicated by starting lines with #.

    Universities using Spasm:

  • California Polytechnic University (San Luis Obispo)
  • Case Western Reserve University; EECS 314