Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

  1. Install QTSpim here: http://spimsimulator.sourceforge.net/
  2. Download and examine this code: sillycode-1.s .
  3. .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.
  4. 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).
  5. 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.
  6. 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
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago