MIPS X C语言中的嵌套循环
我在理解MIPS中的嵌套循环时遇到了问题,而internet上的代码太复杂,无法理解。请帮助我获得这个概念,可能是使用C语言,因为我对C语言非常熟悉。我在MIPS中的嵌套循环代码:MIPS X C语言中的嵌套循环,c,C,我在理解MIPS中的嵌套循环时遇到了问题,而internet上的代码太复杂,无法理解。请帮助我获得这个概念,可能是使用C语言,因为我对C语言非常熟悉。我在MIPS中的嵌套循环代码: li $t0, 0 # We store the value of constant from which the counting of the outer loop starts. li $t1, 30 # We store the value of constant at whic
li $t0, 0 # We store the value of constant from which the counting of the outer loop starts.
li $t1, 30 # We store the value of constant at which the counting of the outer loop ends.
start_loop_1:
beq $t0, $t1, end_loop_1
################# Start of code for Inner loop
li $t2, 0 # We store the value of constant from which the counting of the inner loop starts.
li $t3, 100 # We store the value of constant from which the counting of the inner loop ends.
start_loop_2:
beq $t2, $t3, end_loop_2
addi $t2, $t2, 1 # In this statement we increment the counter by 1.
b start_loop_2
end_loop_2:
################ End of code for Inner loop
addi $t0, $t0, 1 # In this statement we increment the counter by 1.
b start_loop_1
end_loop_1:
其对应的C语言版本:
for (int j=0; j<30; j++) {
for (int k=0; k<100; k++) {
}
}
for(int j=0;j