1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MIPS32 (ASM) greater than or equal too, pseudo instruction question

  1. Sep 25, 2006 #1
    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.

    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

    slt stands for set on less than
    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.

    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;

    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!

    thanks!
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?