Question: # //Write the assembly for the following loop # //Use either indexed or pointer array access # int A[16], B[3*16]; # for (int i=0; i
# //Write the assembly for the following loop # //Use either indexed or pointer array access # int A[16], B[3*16]; # for (int i=0; i < 16; i+=2) { # A[i] = A[i] + B[2*i]; # } .data # DO NOT CHANGE THIS TEST DATA A: .word 0, 1, 2, 3, 4, 5, 6, 7, .word 8, 9, 10, 11, 12, 13, 14, 15 endA: B: .word 0, 0, 0, 10, 10, 10, 20, 20, 20, 30, 30, 30, .word 40, 40, 40, 50, 50, 50, 60, 60, 60, 70, 70, 70, .word 80, 80, 80, 90, 90, 90, 100,100,100, 110,110,110, .word 120,120,120, 130,130,130, 140,140,140, 150,150,150 aSize: .word 16 .text .globl main main: li $t0, 0 # Starting index of t0=i lw $s7, aSize # Loop bound la $s0, A # &A la $s6, endA # &endA la $s1, B # &B loop: #TODO: Write the loop code
exit: li $v0, 10 syscall
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
