Install QtSpim — Windows, Linux and Mac, the lab settings and your first MIPS program in 10 minutes (and the day QtSpim couldn’t see my file)
First assembly lab of IC1. I write my program in Notepad, save it as suma.s, open QtSpim, File > Load File… and the folder is empty. No sign of the file. I save it again, close, open, nothing. In the end the classmate next to me shows me what was going on: Notepad had saved it as suma.s.txt (Windows hides the second extension) and QtSpim only shows .a, .s and .asm files.
In this guide you install QtSpim (the MIPS simulator used in the IC1 labs and in the practical exam), set it up exactly as in the lab and run your first program. When you finish, carry on with how to use QtSpim, which explains every panel, and with Notepad++ for MIPS, the editor you write the programs in.
Table of Contents
What QtSpim is and why we use it in IC1
QtSpim is a simulator of the MIPS32 processor (the R2000 from the course notes): it reads a program written in assembly language, loads it into a simulated memory and runs it instruction by instruction while it shows you the registers and the memory. It doesn’t compile anything or produce an .exe: everything happens inside the simulator.
Why not program a real MIPS directly? Because your computer has an x86 or ARM processor, which understands other instructions. QtSpim plays the part of a “pretend MIPS processor” and, on top of that, lets you see what you can’t see on a real processor: the value of every register after every instruction.
In IC1 you use it in three places:
- In the assembly lab sessions (the ones in the second half of the course).
- In the practical exam: about 90 minutes programming MIPS assembly with QtSpim, and the program has to work with any data.
- In the theory exam you don’t have it in front of you, but knowing how to read its text panel (address, machine code and instruction) helps with the instruction-encoding questions.
QtSpim has no text editor. The program is written in another program (in the lab, Notepad++) and QtSpim only loads and runs it. That’s why the workflow is always the same:
Before you start: what you need
- A computer with Windows 10/11, Linux or macOS. QtSpim is tiny: any laptop you take to class will do.
- Permission to install programs (Windows will ask for administrator confirmation).
- A plain-text editor to write the programs. I recommend Notepad++ with MIPS colours (guide here); for this first test any editor will do, except Word, which adds formatting and breaks the file.
Step 1 — Download QtSpim
QtSpim is free and open source (BSD licence). It’s written by James Larus and you download it from the project’s official page on SourceForge: spimsimulator.sourceforge.net, in the downloads section. Pick the file for your system:
| System | File (version 9.1.24, August 2023) | How to install it |
|---|---|---|
| Windows 10/11 | QtSpim_9.1.24_Windows.msi | Double-click and “Next” |
| Linux (Ubuntu, Debian…) | qtspim_9.1.24_linux64.deb | sudo apt install ./qtspim_9.1.24_linux64.deb |
| macOS | QtSpim_9.1.24_mac.mpkg.zip | Unzip and open the package |
The IC1 campus recommends 9.1.12 (from 2013), which is the one on the lab virtual machine. 9.1.24 is the latest and has the same menus, panels and shortcuts: a program that works on one works on the other. If you want to play it safe for the exam, practice with whichever you have installed and take a look at the lab one on the first day.
Step 2 — Install it
On Windows
- Open
QtSpim_9.1.24_Windows.msi. - Accept the licence and keep the folder it suggests: it installs into
C:\Program Files (x86)\QtSpim. - When it finishes you’ll have QtSpim in the Start menu. Pin it to the taskbar: you’ll open it a lot.
If Windows shows “Windows protected your PC”, click More info > Run anyway: SmartScreen warns about programs that aren’t downloaded very often. For exactly that reason, download it only from the official page on SourceForge, never from download sites.
On Linux
On Ubuntu or Debian, from the folder where the .deb is:
sudo apt install ./qtspim_9.1.24_linux64.deb qtspim &
On Fedora (the IC2 distribution) there’s no QtSpim package, but there is spim, the terminal version of the same simulator: sudo dnf install spim and then spim -file suma.s. It runs programs just the same, only without windows. To practice with panels and stepping, the easiest option on Fedora is QtSpim on Windows or the lab virtual machine.
On macOS
Unzip QtSpim_9.1.24_mac.mpkg.zip and open the package. If macOS says it’s from an unidentified developer, right-click the package > Open. With Homebrew, brew install --cask qtspim also works.
Step 3 — First launch: the windows
When you open QtSpim two windows appear: the main one and a smaller one, Console, which usually ends up behind it. This is how the main window is laid out:
And this is what it really looks like, with a program already loaded and the Data tab open (the first time, the right-hand panel will be almost empty):

Each area has its detailed guide in how to use QtSpim. For now, keep three things in mind:
- Left: the processor registers (
R0toR31with their name in brackets:[t0],[a0]…). - Right: the loaded code (Text tab) and the data memory (Data tab).
- Bottom: QtSpim’s messages. If the program has a typo, the warning appears here, not in the console.
Looking for the program’s output in the main window. What your program prints (and what you type when it asks for a value) goes in the Console window. If you can’t see it, Window > Console.
Step 4 — The lab settings
QtSpim can simulate a “bare” MIPS, like the real processor, or one with conveniences for programming. In IC1 we work with the Simple Machine configuration, which is the default. Check it in Simulator > Settings, MIPS tab:

| Option | In IC1 | What it does |
|---|---|---|
| Bare Machine | No | Simulates the “bare” MIPS: no pseudo-instructions and with delayed branches and loads |
| Enable Delayed Branches | No | The instruction after a branch always runs, whether it branches or not (as on the real pipelined MIPS) |
| Enable Delayed Loads | No | The value of an lw isn’t available until one instruction later |
| Enable Mapped IO | No | Memory-mapped input/output (not used in the labs) |
| Accept Pseudo Instructions | Yes | Lets you write li, la, move, blt… and QtSpim swaps them for real instructions when loading |
| Load Exception Handler | Yes | Loads the exception handler and the code that calls your main |
If you ever change something and don’t know how to go back, click Simple Machine and leave Load Exception Handler ticked. The other tab, QtSpim, only changes the look (fonts and colours of the panels and the recent-files list):

If the panel text feels small, in the QtSpim tab click the “…” next to Font and go up to 11 or 12 points. It doesn’t change anything about the program and the machine code becomes much easier to read.
Step 5 — Your first program
We’re going to add up the minutes you studied on four days (45, 30, 60 and 25) and print the total. You don’t need to understand every instruction yet: what matters today is the path of writing, saving, loading and running. Copy it into your editor:
# suma.s: adds up the study minutes of four days
.data
minutes: .word 45, 30, 60, 25 # minutes of each day (4-byte words)
days: .word 4 # how many days there are
msg: .asciiz "Minutes in total: "
.text
.globl main
main: la $t0, minutes # $t0 = address of the first day
lw $t1, days # $t1 = days left to add
li $t2, 0 # $t2 = running total
loop: beq $t1, $zero, end # if there are no days left, leave the loop
lw $t3, 0($t0) # $t3 = minutes of the current day
add $t2, $t2, $t3 # total = total + minutes
addi $t0, $t0, 4 # move on to the next word (4 bytes)
addi $t1, $t1, -1 # one day fewer
j loop
end: li $v0, 4 # syscall 4: print a string
la $a0, msg
syscall
li $v0, 1 # syscall 1: print an integer
move $a0, $t2
syscall
li $v0, 10 # syscall 10: end the program
syscall
In two sentences: the .data part reserves the data in memory (the four days, how many there are and the message) and the .text part is the code. The loop goes through the four numbers with $t0 pointing at each one, adds them up in $t2 and at the end three system calls (syscall) print the message and the number and end the program.
- Save it as
suma.s(in Notepad++, File > Save As, type “All types”). Check that it really ends in.s. - In QtSpim, File > Reinitialize and Load File, find the folder and choose
suma.s. Look at the dialog’s filter, bottom right: Assembly (\.a \.s \.asm)*. Anything without one of those extensions doesn’t show up (the problem in the anecdote).

- If there are no errors, the Text panel fills up with your instructions and the messages at the bottom say nothing new. If there’s an error, QtSpim shows it in an Error window and repeats it in the messages at the bottom, with the line number (more in common problems).
- Click Run/Continue (the triangle on the toolbar or F5). The Console window shows:
Minutes in total: 160
Check it by hand: 45 + 30 + 60 + 25 = 160. And look at the registers panel: the ones that changed are in red, and R10 [t2] is a0, which is 160 in hexadecimal (10 × 16 = 160).

QtSpim shows the registers in hexadecimal by default. If you prefer decimal while you’re learning, Registers > Decimal. In the exam it pays to be able to read both.
Final check: is everything ready?
- Does QtSpim open and do the messages at the bottom say SPIM Version 9.1.x?
- In Simulator > Settings > MIPS, are only Accept Pseudo Instructions and Load Exception Handler ticked?
- Does your
suma.sappear in the Reinitialize and Load File dialog? (if not, check the extension) - With F5, does the console say
Minutes in total: 160? - Do you know where to look if something fails? (the messages at the bottom, with the line number)
If you answered yes to all of them, you now have the lab environment at home.
Common problems and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| The file doesn’t appear when loading | It was saved as suma.s.txt | In File Explorer, View > Show > File name extensions and rename it to suma.s |
spim: (parser) syntax error on line 14 of file … | A typo on that line (for example $to instead of $t0) | Go to that line in the editor; the ^ underneath marks where it stopped understanding |
The following symbols are undefined: end | A misspelt label, or a syntax error before it that cut the loading short | Fix the syntax error that appears higher up first |
| You press F5 and nothing shows | The console is behind the main window | Window > Console |
| The program never ends | A loop with no way out (you forgot to move the counter on) | Simulator > Pause or Stop, and look at the registers (you’ll see how in how to use QtSpim) |
| You change the program and QtSpim still does the old thing | You didn’t save, or you used Load File without reinitialising | Save in the editor and always use Reinitialize and Load File |
Using Load File twice in a row. That option adds the program to what’s already in memory, so the second time all your labels exist twice and QtSpim complains with an Error window: spim: (parser) Label is defined for the second time on line 8 of file …, pointing at your main:. To reload after a change, Reinitialize and Load File (it wipes everything and loads from scratch).
What next?
You now have QtSpim installed, set up as in the lab and with a program that works. Next:
- Notepad++ for MIPS: the lab editor with colours and autocompletion for MIPS (I’ll give you the file ready to import).
- How to use QtSpim: what every number in the text panel means, how to run step by step, set breakpoints and read the memory.
Did this article help you? Here is how you can support SergioLearns →



