MIPS: instruction fields
addu    $r10,$r8,$r9  # add 2 numbers
hex: 0x01095021
0 1 0 9 5 0 2 1
binary: 0000 0001 0000 1001 0101 0000 0010 0001
fields: 000000   01000   01001      01010   00000   100001
b31-26  b25-21    b20-16  b15-11   b10-6    b5-0
opcode    $rs      $rt $rd   shamt       function
# bits
6 opcode: operation code
5 $rs: first source register
5 $rt: second source register
5 $rd: destination register
5 shamt: shift amount
6 function: modifies opcode
Why function field?
Notice that the form of the machine instruction is very close to assembler,
but the order of the source and target is reversed
Example of R-type (register) instruction
1 of 3 formats