Question

Consider a processor that has 16 general purpose registers and it uses 2-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 2 register operands and a 6-bit immediate operand. Each R-type instruction has 3 register operands. Each C-type instruction has a register operand and a 6-bit offset value. If there are 2 unique M-type opcodes and 7 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
Official answer and solution
Official answer
B
From
Official GATE 2026 answer key

Solution

Compute the bit encodings consumed by M-type and R-type instructions out of the 2162^{16} total 16-bit instruction patterns and divide the remaining space by the operand bit-space of a C-type instruction.

With 16 registers, each register operand requires log⁡2(16)=4\log_2(16) = 4 bits, and the total instruction length is 2 bytes=162 \text{ bytes} = 16 bits:

  • M-type: 2 registers (2×4=82 \times 4 = 8 bits) + 6-bit immediate =14= 14 operand bits. Each M-type opcode consumes 2142^{14} bit patterns.
  • R-type: 3 registers (3×4=123 \times 4 = 12 bits). Each R-type opcode consumes 2122^{12} bit patterns.
  • C-type: 1 register (44 bits) + 6-bit offset =10= 10 operand bits. Each C-type opcode consumes 2102^{10} bit patterns.

Total bit patterns used by 2 M-type and 7 R-type opcodes:

2×214+7×212=8×212+7×212=15×2122 \times 2^{14} + 7 \times 2^{12} = 8 \times 2^{12} + 7 \times 2^{12} = 15 \times 2^{12}

Remaining bit patterns out of 216=16×2122^{16} = 16 \times 2^{12}:

16×212−15×212=1×212=4×21016 \times 2^{12} - 15 \times 2^{12} = 1 \times 2^{12} = 4 \times 2^{10}

Therefore, at most 4×210210=4\frac{4 \times 2^{10}}{2^{10}} = 4 unique C-type opcodes can be supported.

Final answer

Option (B)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2026 Computer Science and Information Technology - Session 2 (CS2)
Question
44 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.