tags:

views:

45

answers:

1

How to convert following C conditional statement in MIPS? if (A<=B || B == D) where suppose A is stored in $t2, B in $t4, D in $t6

A: 

Some pointers

Compare A and B using sltu or slt instruction (they are not the interchangeable). If the condition is satisfied, then that's all (lazyness). Its probably easier using these instructions to check if B < A act on that.

If not, compare B and D using the bneq or beq instruction. Choose one whether you want to fallthrough or branch to the if's body.

Tom