Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a subroutine that finds the maximum value from some sequence of integer va

ID: 3581873 • Letter: W

Question

Write a subroutine that finds the maximum value from some sequence of integer values. Then show that your subroutine work correctly calling it from “same” master.

Using Mips assembler

Below you can find links to Mars simulator, description of MIPS assembler and PCSPIM simulator that will be used by us for the second programming assignment. I recommend you to check if the links are working and to download MARS simulator and to check if you are able to run it at your computer. http://pages.cs.wisc.edu/~larus/spim.html - PCSPIM simulator PCSIM simulator http://pages.cs.wisc.edu/~larus/HP_AppA.pdf - Appendix A - Description of MIPS assembler and simulator http://courses.missouristate.edu/KenVollmar/MARS/ - MARS simulator - Missouri State University

Explanation / Answer

.text main: la $a0, array # $a0 = base address of array addi $a1, $zero, 10 # $a1 = number of elements in the array jal maximum # "maximum" function j finish # end of porgram maximum: addi $t7, $zero, 0 # $t7 starting index = 0 addi $t2, $zero, 0 # $t2 max till now = 0 maximum_loop: # if index == number of elements in the array, exit loop beq $t7, $a1, maximum_finish lw $t3, 0($a0) # $t3 = array[index] slt $t1, $t3, $t2 # if array[index]
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote