You will test your SLIM programs using the Super Lean Instruction Machine Emulator (SLIME).

The authors of our textbook have made SLIME available as this Java Archive (jar) file: SLIME.jar, which you should download to your machine.

Note: Depending on your browser, you may get a warning about downloading and executing files like this. In general, you may want to avoid downloading jar files from sources you do not trust.

In order to run SLIME.jar, Java must be installed on your machine.

As the SLIME homepage describes, SLIME can be run either as:
Running SLIME as a Java applet within your browser requires you to enter SLIM code directly into the text window labeled "SLIME 1.1 applet," as shown to the right.

It is more convenient to cut-and-paste code already written into the SLIME applet.

NOTE: If cut-and-paste does not work in your browser, you must modify your Java security policy as described in the SLIME homepage.
After entering the code into the applet, load the code into SLIM by clicking the Load button.
Another way to run SLIME is as a Java application, independently of your browser.

In this case, you manually launch SLIME from your desktop, as described on the SLIME homepage.

NOTE for this to work, the Java Runtime Environment (JRE) must be installed on your machine.
Once the SLIME application is launched, click the Load button and you can choose a file with SLIM code to be loaded.
Upon running SLIME.jar, two windows appear:

This section describes using SLIME to run the write-larger program:

     allocate-registers input-1, input-2
     allocate-registers comparison, jump-target

     read input-1
     read input-2
     sge comparison, input-1, input-2
     li jump-target, input-2-larger
     jeqz comparison, jump-target

     write input-1
     halt
      
  input-2-larger:        ; an instruction label, referring to the
     write input-2       ; write input-2 instruction
     halt
  
SLIME allows you to:
Clicking Step will cause one SLIM instruction to be executed.

In our example, since the first instruction is a read, Step causes the SLIM console to wait for input.

Here is the console after the user has entered 17:

After the user has entered 17 in the console, SLIME will increment the PC (program counter) by one and highlight (but not execute) the next instruction.

Note that register 0 contains the value 17:

If the user Steps again and enters -25 into the console, SLIME's interface will look like this:

To run the SLIM program without stepping through instructions, click the Start button.

In our example, the registers containing 17 (register 0) and -25 (register 1) are compared, and since 17 > -25, the contents of register 0 are written to the console (instruction 5):

Processing then halts after instruction 6:

To run the program again (perhaps to try different input values), first click Reset, which will: To clear previous input and output values from the SLIM console, click Clear Console.
To quit SLIME, click Quit, which dismisses both windows.