Question: 8. (15 pts) Consider two integer arrays A and B of 100 elements. Let X10 and X11 contain the base address of array A and

8. (15 pts) Consider two integer arrays A and B of 100 elements. Let X10 and X11 contain the base address of array "A" and B, respectively, and the index i is in X30, sum is in X5. Write LEGV8 code to perform the following operations: (a) Get B[10] from memory and put it in register X10. (b) Put the value sum*10 in A[12]. (c) Translate the following code into LEGv8 instructions int sum = 0; for (i = 40; i >10; i++) sum = sum + B[i+5] - A[i+1]*20; DO NOT use multiply instruction in your code, use shift instruction for multiplication instead! (d)How many instructions are executed during the running of the code in (c), and how many memory data references are made during execution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
