Hello everyone.
I'm trying to figure this questoin out, it says:
We want to tr4anslate the pseduo instruction "bge $s1, $s2, Lb1" into two real MIPS assembly instructions. Which one is correct.
slt stands for set on less thanCode:A: slt $t0, $s2, $s1 beq $t0, $zero, Lb1 B: slt $t0, $s2, $s1 bne $t0, $zero, Lb1 C: slt $t0, $s1, $s2 beq $t0, $zero, Lb1 D: slt $t0, $s1, $s2 bne $t0, $zero, Lb1
bne means branch if not equal
beq means branch if equal
and bge is the pseudo instruction that means branch if greater than or equal.
I translated each of the following and none seem to be "if greather than or equal too" i only see, if greather than.
None of these seem to work, but B looks like it operates as the branch if $s1 > $s2, but not greather than or equal to. ANy help would be great!Code:A: slt $t0, $s2, $s1 if($s2 < $s1) $t0 = 1 else $t0 = 0 beq $t0, $zero, Lb1 if($t0 == 0) goto Lb1 B: slt $t0, $s2, $s1 if($s2 < $s1) $t0 = 1 else $t0 = 0 bne $t0,$zero, Lbl if( $t0 != 0) goto Lb1 C: if($s1 < $s2) $t0 = 1 else $t0 = 0; if($t0 == 0) goto Lb1 D: if($s1 < $s2) $t0 = 1 else $t0 = 0 if($t0 != 0) goto Lb1;
thanks!




Reply With Quote