Lab 04 Install SPIM solution


Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment


5/5 - (1 vote)

Lab 04

Install SPIM
SPIM is the MIPS simulator. You can download the appropriate installer here. After installing it, run
helloworld.s in the SPIM simulator. Modify it from saying, “Hello World” to “Hello CSCI-2500.”
MIPS translation
Re-write the snippet below in MIPS using $t0 as the location holding x. Print out the result for initial
values of $t0 of 2, 4, 6, and 8. (It may be helpful to look at this page for help on printing out values.) This
may require the slt (set on less than) and beq (branch equal) instructions and their counterparts. You may
find the instruction reference from the front of your book useful.
if (x < 5) {
x += 5;
Loops in MIPS
Now we will implement GCD in MIPS. Look at the second implementation (the one that uses subtraction
and not mod). Using that algorithm and the reference card linked above, try and implement GCD using
subtraction. You can hard-code the two values using li (load immediate) instructions before the routine
begins. Make sure you use positive values smaller than 32,768. Print out the resulting GCD of the two
values you entered.