MC logo

I Format Coding

  Coding Examples

<<R-Format Coding Load Coding Example>>
The immediate operations are fairly straight-forward. Consider:

addi $t5, $15, 40

  1. Look up the values of the registers: $t5 is 13 = 011012, but $15 is just plain 15, or 01111.

  2. Convert the immediate value to binary: 40 = 1010002.

  3. Look up the instruction to find its type and format. (You'll find it on p. A-55.) Plug the numbers into the format, being careful to get the registers in the right places, and pad the immediate to 16 bits:
    00100001111011010000000000101000

  4. Regroup the bits.
    00100001111011010000000000101000

  5. Represent as a hex number: 21ED0028
<<R-Format Coding Load Coding Example>>