Because this class is so large, there is not room in the lab for everyone at once. For this reason, you are not required to be in the lab at the official lab times. You can also download the MIPS simulator software (which also runs on Xxxrosoft Zzzindows) and do much of the work at home, if that is more convenient.
If you are a new user, you may want to download a sample C shell initialization file: sample .cshrc, which you could use as your .cshrc
pandora% spim -file fact.s
(You should type 4 (carriage return) at the prompt; then the program will calculate and print 4! or 24.)
Next use the xwindows (interactive) version of spim, by typing:
pandora% xspim -file fact.s
When the simulator comes up, you can click on run to execute the entire program. After clicking on ok, you will get the same prompt in a new window as before. After entering 4, the program will respond with 24 just as before. Finally click on quit. It is more interesting and useful to execute one instruction at a time: after invoking xspim, click on step instead of run. In the small prompt window, you should keep clicking on step to execute one MIPS instruction at a time.
After 6 steps, you will execute the instruction jal 0x0040020 [main], followed by the first actual instruction of the fact.s program: addu $s7, $zero, $ra, which appears as addu $23, $0, $31 in the xspim window.
Continue stepping. When you execute the first syscall MIPS instruction, a window with an Enter n: prompt will appear. After executing the next syscall type 4 and return as before. Then after over 50 more steps, the program will eventually respond with the value 24. (You must enter the 4 and return immediately after stepping through the second syscall instruction.)
To get checked off in this laboratory: