Question

A processor has 16 integer registers (R0, R1, .. , R15) and 64 floating point registers (F0, F1,… , F63). It uses a 2-byte instruction format. There are four categories of instructions: Type-1, Type-2, Type-3, and Type-4. Type-1 category consists of four instructions, each with 3 integer register operands (3Rs). Type-2 category consists of eight instructions, each with 2 floating point register operands (2Fs). Type-3 category consists of fourteen instructions, each with one integer register operand and one floating point register operand (1R+1F). Type-4 category consists of N instructions, each with a floating point register operand (1F).

The maximum value of N is __________.

Official answer and solution
Official answer
32
From
Official GATE 2018 answer key

Solution

Apply expanding opcode principles to determine the maximum number of instructions for the final category.

Instruction length is 2 bytes = 16 bits.

  • Integer register operands: 16 registers   ⟹  log⁡216=4\implies \log_2 16 = 4 bits each.
  • Floating point register operands: 64 registers   ⟹  log⁡264=6\implies \log_2 64 = 6 bits each.

Trace opcode capacity by category:

  1. Type-1 (3 integer registers = 3×4=123 \times 4 = 12 bits for operands): Opcode has 16−12=416 - 12 = 4 bits, giving 24=162^4 = 16 possible patterns. Using 4 instructions leaves 16−4=1216 - 4 = 12 patterns free.
  2. Type-2 (2 FP registers = 2×6=122 \times 6 = 12 bits for operands): Opcode has 16−12=416 - 12 = 4 bits. Using 8 of the available 12 patterns leaves 12−8=412 - 8 = 4 patterns of 4-bit prefixes free.
  3. Type-3 (1 int + 1 FP = 4+6=104 + 6 = 10 bits for operands): Opcode has 16−10=616 - 10 = 6 bits. Expanding the 4 available 4-bit prefixes by 2 bits yields 4×26−4=4×4=164 \times 2^{6-4} = 4 \times 4 = 16 patterns. Using 14 instructions leaves 16−14=216 - 14 = 2 patterns of 6-bit prefixes free.
  4. Type-4 (1 FP register = 6 bits for operand): Opcode has 16−6=1016 - 6 = 10 bits. Expanding the 2 available 6-bit prefixes by 4 bits yields:
N=2×210−6=2×24=2×16=32N = 2 \times 2^{10-6} = 2 \times 2^4 = 2 \times 16 = 32

Thus, the maximum value of NN is 32.

Final answer

32

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

Source

Paper
GATE 2018 Computer Science and Information Technology (CS)
Question
61 of 65, printed as CS Q.51
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.