MC logo

R-Format Coding

  Coding Examples

I Format Coding>>
The R format instructions are the simplest. Consider,

sub $s2, $s3, $t1

  1. Look up the values of the registers in the table on p. A-23: $s2 is 18 = 100102, $s3 is 19 = 100112, and $t1 is 9 = 010012.

  2. Look up the instruction to find its type and format. (You'll find it on p. A-59.) Plug the numbers into the format, being careful to get the registers in the right places:
    00000010011010011001000000100010

  3. Regroup the bits.
    00000010011010011001000000100010

  4. Represent as a hex number: 02699022
I Format Coding>>