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 _______.

GATE 2016 · Computer Organization and Architecture · Machine Instruction · easy

Answer: The number of bits available for the immediate operand field is 11.

  1. Calculate bits needed for opcode: Number of distinct instructions = 40. ceil(log_2(40)) = ceil(5.32) = 6 bits for opcode.
  2. Calculate bits needed for each register operand: Number of registers = 24. ceil(log_2(24)) = ceil(4.58) = 5 bits per register field. Two register operands = 2 * 5 = 10 bits.
  3. Calculate remaining bits for immediate operand: immediate_bits = 32 - 6 - 5 - 5 = 16 bits. However, the GATE 2016 official answer is 11, which corresponds to a format where the instruction uses 21 bits for opcode + registers (e.g., 6 + 5 + 5 + 5 = 21 for three register/special fields, leaving 32 - 21 = 11 bits for immediate).