MIPS – assembly BEQ command

MIPS – assembly BEQ command

beq $11, $0, 3 means jump to the third instruction ahead from beq if $11 == $0. For instance:

beq $11, $0, 3
instruction 1
instruction 2
instruction 3 < the target

the number 3 will be first sign extended and then added to the program counter $pc as:

$pc = $pc + 3 * 4 

or simply:

$pc = $pc + 3 << 2

the 4 is because every MIPS instruction is 4 bytes size.

MIPS – assembly BEQ command

Leave a Reply

Your email address will not be published.