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 bits each.
- Floating point register operands: 64 registers bits each.
Trace opcode capacity by category:
- Type-1 (3 integer registers = bits for operands): Opcode has bits, giving possible patterns. Using 4 instructions leaves patterns free.
- Type-2 (2 FP registers = bits for operands): Opcode has bits. Using 8 of the available 12 patterns leaves patterns of 4-bit prefixes free.
- Type-3 (1 int + 1 FP = bits for operands): Opcode has bits. Expanding the 4 available 4-bit prefixes by 2 bits yields patterns. Using 14 instructions leaves patterns of 6-bit prefixes free.
- Type-4 (1 FP register = 6 bits for operand): Opcode has bits. Expanding the 2 available 6-bit prefixes by 4 bits yields:
Thus, the maximum value of is 32.
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.