QuestionQuestion

Note that for these questions it may be helpful to first consider an answer using C and then translate that to MIPS code, but only submit your MIPS code.

- For this question we assume MIPS has no divide instructions so you are not allowed to use them. You are to implement a MIPS function labelled div that divides two 16-bit unsigned numbers. Adjust appropriately for 16 bit numbers and 32 bit arithmetic. When the function is called the dividend is in $a0 and the divisor is in $a1. Upon return the quotient should be in $vo and the remainder in $v1. Your submitted file must be called div.asm and should only contain your div function and not the code you used to test it. We will be inserting your function into our own code to test it so make sure it follows the specifications above and the standard MIPS register usage conventions presented in class.

B2 [50]You are to extend the MIPS assembly language program fmean.asm provided with this assignment.
In addition to computing and displaying the mean, your modified program is to compute and display the range of the input data. The range is the maximum input value minus the minimum input value (the values are not input in any particular order).
Your program must have a new function for computing the range Use the given display routine for displaying the results. Your output should be appropriately labeled.
Your submitted file must be named fp.asm.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

div:
move $t0, $zero # set quotient = 0
move $t1, $a0 # set remainder = devidend
sll $t2, $a1, 16   # set divisor

move $t3, $zero # set counter = 0
#move $t4, $zero # set number of loop
addi $t4, $zero, 17 # add 17

Loop:
# sub $t1, $t1, $t2 # rem = rem - divisor

slt $t5, $t1, $t2 # if(t1 < t2) t5 = 1 else t5 = 0
beq $t5, $zero, Greater # if rem >= 0 move to Greater...
$105.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats