GATE CS 2025 Set 1 | Question 37

MCQ · 2 marks · −0.66

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
  1. Option A: 16
  2. Option B: 20 (correct)
  3. Option C: 22
  4. Option D: 24

Answer

(B)

Explanation

The 32-bit instruction must hold the opcode, one register field (R1) and the immediate value; the immediate gets whatever bits are left.

  • Opcode: 50 instruction types need 6 bits, since \(2^5 = 32 \lt 50 \le 64 = 2^6\).
  • Register: 64 registers need \(\log_2 64 = 6\) bits.
  • Immediate: \(32 - 6 - 6 = 20\) bits.

Answer: B