Question
A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is _______.
Official answer and solution
- Official answer
- 14
- From
- Official GATE 2020 answer key
Solution
Use the expanding opcode technique to find the maximum number of R-type opcodes.
Instruction format details:
- Total instruction length = 16 bits.
- Number of registers = 64 register address field = bits.
- I-type instruction format: Opcode, 1 register (6 bits), 4-bit immediate.
- Total operand bits = bits.
- Opcode bits for I-type = bits.
- R-type instruction format: Opcode, 2 registers ( bits).
- Opcode bits for R-type = bits.
Expanding opcode relationship:
- The R-type opcode is 4 bits long, supporting up to bit patterns.
- Let be the number of patterns allocated to R-type instructions.
- The remaining 4-bit patterns can be expanded by 2 additional bits () to form 6-bit I-type opcodes.
- Total possible I-type opcodes = .
Solve for :
Therefore, the maximum number of distinct R-type opcodes is 14.
14
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2020 Computer Science and Information Technology (CS)
- Question
- 54 of 65, printed as CS Q.44
- 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.