Question: $ 8. (15 pts) Consider two integer arrays B and D of 100 elements. Let X2 and X3 contain the base address of array B

$ 8. (15 pts) Consider two integer arrays B and D of 100 elements. Let X2 and X3 contain the base address of array "B" and "D", respectively, and the index is in X0, h is in X10. Write LEGV8 code to perform the following operations: (a) Get B[15] from memory and put it in register X5. (b) Put the value 132 in D[6]. (c) Translate the following C code into LEGv8 instructions int j = 50, h; do { D[2*j] = (B[j] + B[j+2])*9 - h; j^j -2; while {j >0}; 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 executio'n? $ 8. (15 pts) Consider two integer arrays B and D of 100 elements. Let X2 and X3 contain the base address of array "B" and "D", respectively, and the index is in X0, h is in X10. Write LEGV8 code to perform the following operations: (a) Get B[15] from memory and put it in register X5. (b) Put the value 132 in D[6]. (c) Translate the following C code into LEGv8 instructions int j = 50, h; do { D[2*j] = (B[j] + B[j+2])*9 - h; j^j -2; while {j >0}; 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 executio'n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
