This assignment is intended to get you started with MIPS assembly language programming and familiarize you with the SPIM simulator and assembler. Taking the time to play with the simulator and verify your answers will pay off when you start on the labs and the next homework.
You will not be graded on this assignment. When you’ve answered the five questions at the end, check yourself using the solution. You are encouraged to work together and use whatever sources you find useful. There is a list of MIPS resources on the class homepage.
Go ahead and start getting in the practice of writing good comments as you write your code, rather than inserting them when you are done with the program. This will make it much easier for you to track down problems as you are writing, and will save you a lot of time when debugging. Leave the comments in the program when you turn it in as this will make it much easier for the TAs to figure out what you were trying to do with your code, and will be essential for getting partial credit if necessary.
The following problems are short exercises that will get you thinking about the details of assembly programming. Most of these problems can be completed successfully in 5 instructions or less. Note: Do No Harm! The problems describe the available registers. Your solutions may not use other registers, or destroy the input values. Also, for this exercise, avoid using pseudo-operations. It may be helpful to refer to the list of available MIPS instructions listed in Appendix B (starting on page B-51). When you are finished, a sample solution file is provided in a super secret location*.
lui), how would you load constant values into registers? (Your answer should be in English, not MIPS)
$9. (Be Careful)
$9contain 32-bit signed integers. Put the larger of the two in
$8contains 4 ASCII characters in the range [a-z]. Make the first and third characters upper-case. You may use
$9as a temporary register.
$8holds the main memory address of an array of words;
$9is a signed integer index to the array, which we'll call N. Set the Nth entry in the array to
0x00000001. You may use
* At the bottom of the MIPS Resources web page. Shhhhhhhhh........