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 ________.
GATE 2024 EC Q.27: solution and answer
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)
Instruction length: the architecture is 32-bit and each instruction is 1 word long, so every instruction is bits.
Opcode field: it must encode 40 distinct instructions, so it needs bits. Since , the opcode takes bits.
Register field: it must name one of 24 registers, so it needs bits. Since , each register identifier takes bits.
There are three register fields (two sources and one destination): bits.
The immediate field gets all the bits that are left:
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
- GATE 2020 EC Q.19 · NAT · 1 markIn an 8085 microprocessor, the number of address lines required to access a 16 K byte memory bank is.
- GATE 2020 EE Q.54 · NAT · 2 marksAn 8085 microprocessor accesses two memory locations (2001H) and (2002H), that contain 8-bit numbers 98H and…
- GATE 2018 EC Q.32 · MCQ · 2 marksA 2 × 2 ROM array is built with the help of diodes as shown in the circuit below.
- GATE 2018 IN Q.45 · NAT · 2 marksA portion of an assembly language program written for an 8-bit microprocessor is given below along with…
