Question
A processor has 40 distinct instructions and 24 general purpose registers. A 32-bit instruction word has an opcode, two register operands and an immediate operand. The number of bits available for the immediate operand field is ________.
Official answer and solution
- Official answer
- 16
- From
- Official GATE 2016 answer key
Solution
Calculate the bits required for opcode and register specifiers, then subtract from the 32-bit instruction length.
Instruction word format:
Calculate the bit width of each component:
-
Opcode field: The processor has 40 distinct instructions.
-
Register fields: The processor has 24 general purpose registers.
For two register operands: bits.
- Remaining bits for immediate operand:
Therefore, 16 bits are available for the immediate operand field.
16
Using floor instead of ceiling for logarithmic bit requirements, giving 5 bits for opcode instead of 6.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 2
- Question
- 20 of 65, printed as CS Q.10
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.