[SOLVED] CS101A Assignment10

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

1. [3 pts] List the three groups of a machine’s instructions and give a specific example of instruction of each group.

Using the machine language in Appendix C of the textbook1, answer the following questions.
2. [2 pts] For the following instructions, try to compute how many different instruction instances can each instruction pattern of the machine have.
(a) Op-code = 2
(b) Op-code = 4
(c) Op-code = A
(d) Op-code = C
3. [2 pts] Translate the following instruction from English into the machine language. (Answer in hexadecimal format)
(a) STORE the bit pattern found in register 2 in the memory cell whose address is
10.
(b) JUMP to the instruction located in the memory cell at address DE if the bit pattern in register C is equal to the bit pattern in register number 0. Otherwise, continue with the normal sequence of execution.
4. [3 pts, 0.5 pts for each instruction] The purpose of the following program is to calculate the result of 1+3+5+7+9 and save it to the register 1, and eventually, the program will halt execution. Assume that the machine is started with its program counter containing A4. Please fill in the blank.

1 J.G.Brookshear, “Computer Science: An Overview,” Addison-Wesley, 2011(11th Edition)

A4 2 0 _ _
A6 2 1 _ _
A8 2 2 0 1
AA 2 3 0 2
AC 2 4 0 0
AE 2 5 0 1
B0 5 1 _ _
B2 5 2 2 3
B4 5 4 _ _
B6 B 4 _ _
B8 _ _ _ _ BA C 0 0 0

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.