GATE 2018 CS – Question 61
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 ________.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 32
Explanation
An instruction is 16 bits, so there are $2^{16}=65536$ encodings. Count how many each type uses (number of opcodes $\times$ operand encodings).
- **Type-1:** 4 instructions, 3 integer registers of 4 bits each $=12$ operand bits: $4\times2^{12}=16384$.
- **Type-2:** 8 instructions, 2 float registers of 6 bits each $=12$ bits: $8\times2^{12}=32768$.
- **Type-3:** 14 instructions, 1 integer register (4 bits) and 1 float register (6 bits) $=10$ bits: $14\times2^{10}=14336$.
Used so far: $16384+32768+14336=63488$. Remaining encodings: $65536-63488=2048$.
- **Type-4:** each instruction has 1 float register (6 bits) $\Rightarrow$ $2^6=64$ encodings per instruction.
$$N_{max}=\frac{2048}{64}=\mathbf{32}.$$