August 1999
CS202 : COMPUTER ARCHITECTURE AND DATA COMMUNICATIONS

QUESTION 2

Total Marks: 20 Marks

Click here to access other questions

SUGGESTED SOLUTIONS
Solutions and allocated marks are indicated in green.
Return to
Question 2

(a) An instruction word has two components. Name them, and explain the use of each. [2]
The Opcode is the part of the instruction word which specifies the operation to be performed. The other part of an instruction is the Operand that specifies either the data value or an address.

 

(b) The length of an instruction word affects many aspects of the system, both hardware and software. Briefly describe three of the effects that varying instruction sizes have. [6]
Programming flexibility : fewer addresses per instruction, less complex CPU but more complex programs. Higher number of addresses per instruction, more complex CPU but less complex programs.
The memory size and organization, the number of addressable locations.
The size of data/address buses (with explanations).

 

Consider a set of four processors P0, P1, P2, and P3, where Pi is an i-address machine. P0 is a zero-address stack machine, while P1, P2, and P3 are conventional computers each with 16 general-purpose registers R0-R15 for data and address storage. All four processors have instructions with the (assembly language) opcodes ADD, SUB, MUL, and DIV to implement the operations +, - , * and / respectively.

 

(c) Using as few instructions as you can, write a program for each of the four machines to evaluate the following arithmetic expression :

X := (A+B) * C * D / E

[8]
0-Address Format 1-Address Format 2-Address Format 3-Address Format
PUSH A LOA A ADD A B ADD A B B
PUSH B ADD B DIV D E DIV D E E
ADD STO B MUL C D MUL C E E
PUSH C LOA D MUL A C MUL B E X
PUSH D DIV E MOV X A
MUL MUL C
PUSH E MUL B
DIV STO X
MUL
POP X

 

(d) Assuming that the only instructions are those which you have used, and that all addresses are 8 bits long, calculate the total object-program size in bits for your programs for P1, Pr2, and P3.

State any additional assumptions you make.

[4]
P1
6 instructions = 3 bits for opcode, plus 8 bits for address. Therefore program size is 11 * 8 = 88 bits minimum, or 12 * 8 = 96 bits if instruction word size is rounded up to 12 bits.

P2
5 instructions = 3 bits for opcode, plus 16 bits for address. Therefore program size is 19 * 5 = 95 bits minimum, or 20 * 5 = 100 bits if instruction word size is rounded up to 20 bits.

P3
4 instructions = 2 bits for opcode, plus 24 bits for address. Therefore program size is 26 * 4 = 104 bits minimum.