A machine has a 32-bit architecture, with 1-word long instructions. It has 64 registers, each of which is 32 bits long. It needs to support 45 instructions, which have an immediate operand in addition to two register operands. Assuming that the immediate operand is an unsigned integer, the maximum value of the immediate operand is ________
GATE 2014 · Computer Organization and Architecture · Instruction Format · medium
Answer: The maximum value of the immediate operand is 16383 (= 2^14 - 1).
Calculate bits needed for opcode: 2^5 = 32 < 45 and 2^6 = 64 >= 45, so we need 6 bits for the opcode to encode all 45 instructions.
Calculate bits needed for register fields: 64 registers require log_2(64) = 6 bits each to address. With two register operands: 2 * 6 = 12 bits consumed.
Calculate immediate field width and maximum value: Immediate bits = 32 - 6 - 6 - 6 = 14 bits. Maximum unsigned value of a 14-bit field = 2^14 - 1 = 16384 - 1 = 16383.