Skip to content
Official PYQ · 2014

GATE CS 2014 Set 1 Q9 — Machine Instructions and Addressing Modes

Explain with AI
A machine has a 32-bit32\text{-bit} architecture, with 1-word1\text{-word} long instructions. It has 6464 registers, each of which is 3232 bits long. It needs to support 4545 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 ____________
View worked solution

Answer: 16383

To find the maximum value of the immediate operand, we need to determine the maximum number of bits that can be allocated to it within the 32-bit instruction format.

Let's break down the instruction fields:

  1. Opcode Field:
    The machine needs to support 4545 distinct instructions.
    Opcode bits=⌈log⁡2(45)⌉=6 bits\text{Opcode bits} = \lceil \log_2(45) \rceil = 6 \text{ bits}
  2. Register Operands:
    There are 6464 registers, so each register operand requires:
    Register bits=log⁡2(64)=6 bits\text{Register bits} = \log_2(64) = 6 \text{ bits}
    Since the instruction contains two register operands, they require a total of:
    2×6=12 bits2 \times 6 = 12 \text{ bits}
  3. Immediate Operand Field:
    The total instruction length is 1 word=32 bits1 \text{ word} = 32 \text{ bits}.
    The bits remaining for the immediate operand (II) are:
    I=32−(Opcode bits+Register bits)I = 32 - (\text{Opcode bits} + \text{Register bits})
    I=32−(6+12)=14 bitsI = 32 - (6 + 12) = 14 \text{ bits}

Since the immediate operand is an unsigned integer, the maximum value it can represent with 1414 bits is:

Maximum Value=214−1=16384−1=16383\text{Maximum Value} = 2^{14} - 1 = 16384 - 1 = 16383

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Machine Instructions and Addressing Modes questions