A,B,C are arrays of length 6, and the base address are found in the registers as follows:
A=[0 1 2 3 4 5], Base = $t0
B=[1 3 5 7 9 11] Base = $t1
C=[0 5 2 6 3 8] Base = $t2
And now for the code itself:
add $t4, $zero, $zero
Loop: add $t5, $t4, $t1
lw $t6, 0($t5)
add $t5, $t4, $t2
lw $t7, 0($t5)
or $t6, $t6, $t7
add $t5, $t4, $t0
sw $t6, 0($t5)
addi $t4, $t4, 4
slti $t5, $t4, 20
bne $t5, $zero, Loop
My questions are:
1.) When adding $t4 and $t1, are we adding zero to every B[i]?
2.) When adding arrays in mips, lets say add $t6, $t0,$t1
are we doing:
3.) how exactly do you use OR on an array?
t4
does not stay zero. Also that's pointer arithmetic, does not deal with the value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.