この宿題を解こうとしていたのですが、解決策が思いつきませんでした。以下、問題ですが、
次の 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;
}