Question: For these programming exercises, use only those instructions that have been discussed so far in these notes: add lw sll addi mfhi sra addiu mflo
For these programming exercises, use only those instructions that have been discussed so far in these notes:
| add | lw | sll |
| addi | mfhi | sra |
| addiu | mflo | srl |
| addu | mult | sub |
| and | multu | subu |
| andi | nor | sw |
| div | or | xor |
| divu | ori | xori |
| lui |
USING MIPS
Evaluate the expression:
17xy - 12x - 6y + 12
Use symbolic addresses x, y, and answer. Assume that the values are small enough so that all results fit into 32 bits. Since load delays are turned on in SPIM be careful what instructions are placed in the load delay slot.
Verify that the program works by using several initial values for x and y. Use x=0, y=1 and x=1, y=0 to start since this will make debugging easy. Then try some other values. As an option, follow the precaution for multiplication, as above.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
