August 1997
CS202: COMPUTER ARCHITECTURE AND DATA COMMUNICATION

QUESTION 4

Total Marks: 20 Marks

Click here to access other questions

Click to access
SUGGESTED SOLUTIONS
for Question 4

4. (a) Write programs to compute [8]
X := (( A + B ) / ( C - D )) + ( E * F )
for 3-address and 1-address machines with instructions sets as follows:

3-address

1-address

  LOA M AC ¬ M
  STO M M ¬ AC
ADD X, Y, Z Z ¬ X + Y ADD M AC ¬ AC + M
SUB X, Y, Z Z ¬ X - Y SUB M AC ¬ AC - M
MUL X, Y, Z Z ¬ X * Y MUL M AC ¬ AC * M
DIV X, Y, Z Z ¬ X / Y DIV M AC ¬ AC / M
(b) Suppose that the instructions shown above are the only instructions available on these machines, and suppose that all addresses/operands are 4 bits. What is the minimum size for the instructions of each of the two machines? [4]
(c) Use your answer to part (b) to calculate which of your two programs will occupy more storage space (in bits). Would the answer be different if addresses were 32 bits? [4]
(d) Which component within the CPU is used to process instructions such as ADD, SUB, MUL etc.? Give two other instructions which might also be processed by this component. [4]