【发布时间】:2011-08-10 14:02:52
【问题描述】:
我试图解决这个家庭作业,但无法提出解决方案。下面是问题,
将以下 MIPS 代码翻译成高级语言程序。 假设 $t0、$t1 和 $t2 包含数组 A、B 的基地址 和 C。
add $t4, $zero, $zero
Loop:
add $t5, $t4, $t1
lw $t6, 0($t5)
add $t5, $t4, $t2
lw $t7, 0($t5)
add $t6, $t6, $t7
add $t5, $t4, $t0
sw $t6, 0($t5)
addi $t4, $t4, 4
slti $t5, $t4, 256
bne $t5, $zero, Loop
Also find the decimal value in the offset field of bne说明。
这是我尝试过的,但我还没有找到256的位置。
int *temp4 = 0;
while(1)
{
*int temp5 = temp4 +B[0];
a:
*int temp6 = temp5;
temp5 = C[0] + temp4;
*temp7 = temp5;
temp6 = temp6 + temp7;
temp5 = temp4 + A[0];
temp6 = temp5;
temp4 += 4;
if(temp5 < temp4)
goto __;
if(temp5 != 0)
goto a;
}
【问题讨论】:
标签: architecture mips computer-architecture