IAE Academy

GATE 2024 EC Q.27: solution and answer

GATE 2024 · ECQ.27 · 1 mark · NAT

A machine has a 32-bit architecture with 1-word long instructions. It has 24 registers and supports an instruction set of size 40. Each instruction has five distinct fields, namely opcode, two source register identifiers, one destination register identifier, and an immediate value. Assuming that the immediate operand is an unsigned integer, its maximum value is ________.

See the question in the paper

Answer and solution

ANSWER

The immediate field has bits, so the largest unsigned immediate value is .

Official answer: 2047Source: Official answer key, GATE 2024 EC (IISc Bengaluru)

  1. Instruction length: the architecture is 32-bit and each instruction is 1 word long, so every instruction is bits.

  2. Opcode field: it must encode 40 distinct instructions, so it needs bits. Since , the opcode takes bits.

  3. Register field: it must name one of 24 registers, so it needs bits. Since , each register identifier takes bits.

  4. There are three register fields (two sources and one destination): bits.

  5. The immediate field gets all the bits that are left:

  6. The largest unsigned -bit integer is (all bits set to 1), so the maximum immediate value is

KEY IDEA

A field that must tell apart items needs bits. Give the opcode and every register field the smallest width that works, and whatever is left of the fixed 32-bit instruction goes to the immediate. An unsigned -bit field can hold values up to .

WATCH OUT FOR

Using without rounding up: that gives a 5-bit opcode for 40 instructions, when 5 bits cover only 32, or a 4-bit register field for 24 registers, when 4 bits cover only 16. Other errors are counting only two register fields instead of three, and giving as the answer instead of the largest value an 11-bit field can hold, which is .

From the GATE 2024 EC paper. Every question of this paper · Download the full paper · All 9 Processors & memory questions, with notes

More Processors & memory questions