Question
2.5) In the following problems, we will be investigating memory operations in the context of a MIPS processor. The table below shows the values of
2.5) In the following problems, we will be investigating memory operations in the context of a MIPS processor. The table below shows the values of an array stored in memory.
Address: 12, 8, 4, 0
Data: 1, 6, 4, 2
a) For the memory locations in the table above, write C code to sort the data from lowest-to-highest, placing the lowest value in the smallest memory location shown in the fi gure. Assume that the data shown represents the C variable called Array, which is an array of type int. Assume that this particular machine is a byte-addressable machine and a word consists of 4 bytes.
b) 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 $s6.
c) To sort the array above, how many instructions are required for the MIPS code? If you are not allowed to use the immediate fi eld in lw and sw instructions, how many MIPS instructions do you need?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started