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

Array IndexAddress ATO Byte Present Value New Value From Array Index &24 &28 &32

ID: 3756703 • Letter: A

Question

Array IndexAddress ATO Byte Present Value New Value From Array Index &24 &28 &32 Page 1 of 7 COSC 2440 Computer Organization and Architecture A[3 A[4 &36 &40 b. [5] For the memory locations in the table above, write MIPS code to sort the data from lowest to highest, placing the lowest value in the smallest memory location. Use a minimum number of MIPS instructions. Assume the base address of Array is stored in register $so Hint: Remember you'll be repeatedly moving the contents around of a word of memory starting at some 4-byte multiple added to $s0. So the first is 0 ($so), and putting that value into $to, for example, would be a line of MIPS code that looks like this: lw $t0, 0 ($s0) Minimize instructions, not temporary variables. I was able to sort the array in 10 instructions, and the line above was my first line of code

Explanation / Answer

INT: 4Byte

5 element:20 byte

main:

la $a1, array #loads a pointer to array into $a1

la:

la $a0, input #loads input text into $a

load $s0, 5 #loads 5 bytes into $s0

lw $t0, 0($s0)

addi $t0,$t0, 5    #add 5 to $t0, save to $t0

sw $s0,($a1) #stores input into array

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