0
votes

I am little bit confuse about following machine code 0001 1001 0110 0000 0000 0000 0000 0010 this is binary code for machine language and I translated to mips 32 bit instruction.

000110 01011 00000 0000 0000 0000 0010

blez   $t3,        2

I am not sure if I translated correctly.

I am not sure why the immediate value is 2 instead of address of target location.

1
MIPS b instructions use a relative displacement for the target (i.e. relative to PC). It's left-shifted., though, which you left out. cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/addr.htmlPeter Cordes
okay so if that instruction is in address of 1122334C, adding 8 to the current address is destination? therefore, it should jump to 11223354?Yeram Hwang

1 Answers

1
votes

I am getting a different offset than you are so re-check either the bits you gave us or your math.

.word 0x19600002
nop
nop
nop
nop
.word 0x19600002

mips-elf-as so.s -o so.o
mips-elf-objdump -D so.o


00000000 <.text>:
   0:   19600002    blez    $11,0xc
   4:   00000000    nop
    ...
  14:   19600002    blez    $11,0x20

Is there an assumed/implied 0x4 added to the offset?