Sunday 16 December 2012

MIPS (by nazirul anwar)

 Branch Addressing
}  Branch instructions specify
       -Opcode, two registers, target address
}  Most branch targets are near branch
-Forward or backward


 Decoding Machine Language

}  Refer to MIPS Reference Data

}  What is the assembly language statement corresponding to this machine instruction?
                        00af8020hex
}  Step 1: convert hex to binary to find the op fields. Set the bit based on the R-format field (since it has the most fields available of all format:
Bits:  31 28 26      20  16          10    5
            0000 0000 1010 1111 1000 0000 0010 0000
}  Step 2: determine the operation,  when bits 31-26 are 000000 and bit 5-0 has a value, it is R-format. Convert the funct value into hex.
}  You will get 20hex. Look into the reference for opcode/funct column with value 0/20hex. The pattern represents add instruction.
}  Step 3: Decode the rest of the instruction by looking the field of values.
Bits:31 28 26   20  16      10    5
            000000 00101 01111 10000 00000 100000
                  0  $a1   $t7  $s0     0     add
}  Step 4: Rearrange the values into an assembly instruction
                  add $s0, $a1, $t7

No comments:

Post a Comment