Given the following high level Instructions convert Into MIP
Given the following high level Instructions, convert Into MIPS Instructions Convert the for loop into MIPS Instructions. Use the sit Instruction to determine the branch. Be sure to initialize I properly. for (int i = 1; i min && i
Solution
1)
# value = $s0 //defining register for each variable
# i = $t0
main:
li $t0,1 //assigning value to register t0 (which is i and according to loop it starts with 1)
loop:
bgt $t0,6,exit //starting the loop with i having 1 as initial value and goes it 6 as in given condition i<7)
add $s0 $t0 $s0 // adds the register $t0 and $s0 and assigning the result to $s0, which is adding value and i , assiging the result to value
i loop
exit:
