Question: Q3 (60 Marks): Suppose that we need to write a RISC-style program that adds the two arrays ARR1-[2, 3, 5, 6] and ARR2-[3,6, 4, 2]
Q3 (60 Marks): Suppose that we need to write a RISC-style program that adds the two arrays ARR1-[2, 3, 5, 6] and ARR2-[3,6, 4, 2] in a reverse order and store the result in ARR3 (that is add the first element of ARRI with last element of ARR2 and put the result in the first element of ARR3, the second element of ARR1 added with second last element of ARR2 and put the result in the second element of ARR3, an so What instructions you will use at lines: 2, 6,9,12, 14, and 15. Solution: Movia R1,#N 2. Movia Movia Movie R2, #ARRI R3, ARR2 R4, #ARR3 3. 7. Loop: Load R. R2) Load R6, (R3) 8. 9. 10. R5, (R4) R2, R2, #4 Store Add 12. 13. 14. 15. Add R4, R4, #4 ORIGIN 0x500 16. 17. NDATAWORD4 18. ARRI: DATAWORD 2,3, 5, 6 19. ARR2: DATAWORD 3, 6,4,2 20. ARR3: RESERVE 16
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
