int i; for(i=0;i<256;i++) A[i]+=B[i]-1;// array that it don\'t understand how to
ID: 3530313 • Letter: I
Question
int i; for(i=0;i<256;i++) A[i]+=B[i]-1;// array that it don't understand how to do in mips assembly this is my assembly mips.
#$t0=i
#t1=256;constant
#s0 array A
#s1 array B
.text
main:
li $t0,0 #t0 is initialize the counter i=0
li $t1,257#load constant 256
la $s0,A # load aaray A
la $s1,B # load aaray B
li $t5,1 #load constant 1 for calculation
loop: addi $t0,$t0,1#counter i++ #
###this is starting to do array. A[i]+=B[i]-1
add $t2,$t0,$s0 # address of B[i]
lw $t3,0($t2)# t3=B[i]
sub $t4,$t3,$t5# B[i]-1
add $t2,$t0,$t5 #A[i]
add $t2,$t2,$t4 #A[i]+=B[i]-1
bli $t0,$t,loop # if i<256 goback to loop
j loop
exit:
Explanation / Answer
int i; for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.