If I have a number in t3, can I use lw $s3, $t3($t0) to get the value stored at the memory referenced by base+offset where the base is in t0 and the offset is in t3 into s3?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I believe that the solution plaknas gives is only half-correct, as you have to take the word size into account when "creating" the offset in MIPS.
Here is the correct answer, assuming a word size of 4 bytes:
sll $t3, $t3, 2
add $t0, $t0, $t3
lw $s3, 0($t0)
回答2:
Apparently it cannot be done. The better way to do it is something like:
add $t4, $t0, $t3
lw $s3, 0($t4)
Thank you :)