August
1999 QUESTION 2 Total Marks: 20 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS |
(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 :
|
[8] | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
(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 P3
|