Question: For this assignment, you will need to install a MIPS simulator called QTSpim. Install QTSpim here: http://spimsimulator.sourceforge.net/ Download and examine this code: sillycode-1.s . .text
For this assignment, you will need to install a MIPS simulator called QTSpim.
- Install QTSpim here: http://spimsimulator.sourceforge.net/
- Download and examine this code: sillycode-1.s .
- .text is an assembler directive to indicate the assembler that whatever follows is the code section. If you want to declare some global variable, do so under .data section. You can use this code snippet as a template for your own work. You can use a word editor like notepad to write code, but note that the extension is .s.
- Load this code into your simulator (File -> Load File -> sillycode.s). You may need to reinitialize simulator (Simulator -> Reinitialize) if you get an error during loading. The code can be run by clicking on the play button, but a better way is observing step by step command execution (F10).
- In sillycode, use F10 to navigate to the line of code highlighted below. jal main indicates the starting point of your line of code. The first column is the address of each line in instruction memory, the second column is the machine code translation (in hex) of the command being executed, the next two columns are the commands in assembly language. Note that some commands in 3rdand 4th columns look different, but one is a pseudo code representation of the other.
- You can keep using F10 to rerun the code. Also note how the last line of code is li $v0, 10 syscall Remember to always put these two lines at the end of every code piece you write on this simulator

Question 3 0.5 pts What is the machine code equivalent of "addi $s1, $0,1". Attach a scratch sheet of your work, or type it out here. Does it match with the value displayed in the second column? (use the image insertion option, rather than attach file) 12ptParagraph B I U D Question 4 1.5 pts 1. Write your own assembly code to take two integer input from user, store them in two different registers and add/subtract them. Refer to the class lectures for the system call codes and arguments needed to read these integers. 2. Attach a copy of your code in this text field, followed by screenshots of: A. Code loaded into the user text segment B. The console when prompted for a user input C. Both values loaded in registers D. The final value in destination register after executing the add/subtract operation (use the image insertion option, rather than attach file) 12ptParagraph B I U
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
