Question: 5.(15 points) Consider the following C code, which adds d to first 100 elements of array B and stores the result in array A. Both

5.(15 points) Consider the following C code, which adds d to first 100 elements of array B and stores the result in array A. Both A and B are arrays of 64-bit integers, and d is a 64-bit integer. Assume A, B, and d are stored in memory. The address of d is 5000. The address of A and B are in R1 and R2, respectively. Variable i is kept in a register. for (i = 0; i 100 ; i ++) Implement the loop with ten (10) MIPS64 instructions. What is the size (in bytes) of your code? What is the total number of instructions that would be executed? What is the total number of data memory accesses? Hints: MIPS64 instructions can be found in Figure A.26 on page A-40. Load d once before the loop. Increment i by 8 in each iteration. It can also be used as offset for accessing A and B. 5.(15 points) Consider the following C code, which adds d to first 100 elements of array B and stores the result in array A. Both A and B are arrays of 64-bit integers, and d is a 64-bit integer. Assume A, B, and d are stored in memory. The address of d is 5000. The address of A and B are in R1 and R2, respectively. Variable i is kept in a register. for (i = 0; i 100 ; i ++) Implement the loop with ten (10) MIPS64 instructions. What is the size (in bytes) of your code? What is the total number of instructions that would be executed? What is the total number of data memory accesses? Hints: MIPS64 instructions can be found in Figure A.26 on page A-40. Load d once before the loop. Increment i by 8 in each iteration. It can also be used as offset for accessing A and B
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
