Skip to content
Official PYQ · 2026

GATE CS 2026 Set 2 Q34 — Machine Instructions and Addressing Modes

Explain with AI

Consider a processor that has 1616 general purpose registers and it uses 22-byte instruction format for all its instructions. Variable-sized opcodes are permitted. There are three different types of instructions; M-type, R-type, and C-type. Each M-type instruction has 22 register operands and a 66-bit immediate operand. Each Rtype instruction has 33 register operands. Each C-type instruction has a register operand and a 66 -bit offset value. If there are 22 unique M-type opcodes and 77 unique R-type opcodes, which one of the following options gives the maximum number of unique opcodes possible for C-type instructions?

Choose one option
View worked solution

Answer: B

To find the maximum number of unique opcodes for C-type instructions, we use the expanding opcode technique.

1. Basic Parameters:

  • Instruction size = 2 bytes=16 bits2\text{ bytes} = 16\text{ bits}.
  • Number of registers = 1616, so each register operand requires log⁡2(16)=4 bits\log_2(16) = 4\text{ bits}.

2. Opcode Sizes for Each Type:

  • M-type: Requires 22 registers (2×4=8 bits2 \times 4 = 8\text{ bits}) and a 66-bit immediate.
    Opcode size=16−(8+6)=2 bits\text{Opcode size} = 16 - (8 + 6) = 2\text{ bits}.
    Total possible 2-bit opcodes = 22=42^2 = 4. Since 22 are used, remaining unused 2-bit prefixes = 4−2=24 - 2 = 2.
  • R-type: Requires 33 registers (3×4=12 bits3 \times 4 = 12\text{ bits}).
    Opcode size=16−12=4 bits\text{Opcode size} = 16 - 12 = 4\text{ bits}.
    Using the 22 remaining 2-bit prefixes, total possible 4-bit opcodes = 2×24−2=82 \times 2^{4-2} = 8.
    Since 77 are used, remaining unused 4-bit prefixes = 8−7=18 - 7 = 1.
  • C-type: Requires 11 register (4 bits4\text{ bits}) and a 66-bit offset.
    Opcode size=16−(4+6)=6 bits\text{Opcode size} = 16 - (4 + 6) = 6\text{ bits}.
    Using the 11 remaining 4-bit prefix, maximum possible 6-bit opcodes = 1×26−4=22=41 \times 2^{6-4} = 2^2 = 4.

Thus, the maximum number of unique opcodes possible for C-type instructions is 4.

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

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