GATE 2025 CS (CS1) – Question 37
A processor has 64 general-purpose registers and 50 distinct instruction types. An instruction is encoded in 32-bits. What is the maximum number of bits that can be used to store the immediate operand for the given instruction?
ADD R1, #25 // R1 = R1 + 25
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) 20
Explanation
A 32-bit instruction is split into opcode, register field(s) and the immediate.
- 50 distinct instruction types need $\lceil\log_250\rceil=6$ bits for the opcode ($2^5=32<50\le64$).
- 64 registers need $\log_264=6$ bits for the single register operand (`R1`).
Remaining bits for the immediate $=32-6-6=\mathbf{20}$.