178k views
5 votes
Here are some instructions in English. Translate each of them into the Simple Machine language.

a. LOAD register 3 with the hex value 56.
b. ROTATE register 5 three bits to the right.
c. JUMP to the instruction at location F3 if the contents of register 7 are equal to the contents of register 0.
d. AND the contents of register A with the contents of register 5 and leave the result in register 0.

User WebViewer
by
5.7k points

1 Answer

6 votes

Answer:

a. LOAD register 3 with the hex value 56

2356

b. ROTATE register 5 three bits to the right.

A503

c. JUMP to the instruction at location F3 if the contents of register 7 are equal to the contents of register 0

B7F3

d. AND the contents of register A with the contents of register 5 and leave the result in register 0

80A5

Step-by-step explanation:

To translate the English instructions to Machine language we have to consider Appendix C of A Simple Machine Language sheet.

a. LOAD register 3 with the hex value 56

The OP code for LOAD is:

2

Operand is:

RXY

Description is:

LOAD the register R with the bit pattern XY.

In a.

3 represents R

56 represents XY

Now following this we can join OP and Operand together to translate a.

2356

b. ROTATE register 5 three bits to the right

The OP code for ROTATE is:

A

Operand is:

R0X

Description is:

ROTATE the bit pattern in register R one bit to the right X times. Each time place the bit that started at the low-order end at the high-order end

In b.

5 represents R

three represents X

Now following this we can join OP and Operand together to translate b.

A503

c. JUMP to the instruction at location F3 if the contents of register 7 are equal to the contents of register 0.

The OP code for JUMP is:

B

Operand is:

RXY

Description is:

JUMP to the instruction located in the memory cell at address XY if the bit pattern in register R is equal to the bit pattern in register number 0.

In c.

7 represents R register

F3 represents XY

Now following this we can join OP and Operand together to translate c.

B7F3

d. AND the contents of register A with the contents of register 5 and leave the result in register 0.

The OP code for AND is:

8

Operand is:

RST

Description is:

AND the bit patterns in registers S and T and place the result in register R

In d.

A represents register S

5 represents register T

0 represents register R

Now following this we can join OP and Operand together to translate d.

80A5

User Wsgeorge
by
5.4k points