Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试学习 MIPS,并且遇到了以下示例,该示例显示了如何将 C 代码转换为 MIPS:
我不明白第三条 MIPS 线的目的是什么。lw 操作数不是简单地将值从 t1 复制到 t0 吗?
不,它从 $t1. 这是代码的注释版本:
$t1
Loop: sll $t1, $s3, 2 # $t1 = i * sizeof(int) add $t1, $t1, $s6 # $t1 += save (== &save[i]) lw $t0, 0($t1) # $t0 = *(&save[i]) (== save[i]) bne $t0,$s5, Exit # if (save[i] != k) goto Exit addi $s3, $s3, 1 # i += 1 j Loop # repeat