Question 2.10.4: Decoding Machine Code What is the assembly language statemen......

Decoding Machine Code

What is the assembly language statement corresponding to this machine instruction?

00af8020hex

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

The first step in converting hexadecimal to binary is to find the op fields:

(Bits: 31     28   26                                            5      2 0)

0000 0000 1010 1111 1000 0000 0010 0000

We look at the op field to determine the operation. Referring to Figure 2.19, when bits 31–29 are 000 and bits 28–26 are 000, it is an R-format instruction. Let’s reformat the binary instruction into R-format fi elds, listed in Figure 2.20:

op             rs        rt        rd         shamt   funct
000000 00101 01111 10000 00000 100000

The bottom portion of Figure 2.19 determines the operation of an R-format instruction. In this case, bits 5–3 are 100 and bits 2–0 are 000, which means this binary pattern represents an add instruction. We decode the rest of the instruction by looking at the field values. The decimal values are 5 for the rs field, 15 for rt, and 16 for rd (shamt is unused). Figure 2.14 shows that these numbers represent registers $a1, $t7, and $s0.

Now we can reveal the assembly instruction:

add $s0, $a1, $t7
2.19
2.00
2.14

Related Answered Questions