Skip to content
Official PYQ · 2020

GATE CS 2020 Q44 — Machine Instructions and Addressing Modes

Explain with AI
A processor has 6464 registers and uses 1616-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 44-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 88 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is _______.
View worked solution

Answer: 14

To find the maximum number of distinct R-type opcodes, we can use the concept of instruction space allocation (expanding opcodes).

1. Identify the parameters:

  • Instruction size = 1616 bits, which gives a total of 216=65,5362^{16} = 65,536 possible instruction combinations.
  • Number of registers = 6464, requiring log⁡2(64)=6\log_2(64) = 6 bits to specify each register.

2. Analyze I-type instructions:

  • Each I-type instruction consists of: [Opcode] [Register (6 bits)] [Immediate (4 bits)].
  • For each distinct I-type opcode, the number of combinations consumed is: 26×24=64×16=1024 combinations2^6 \times 2^4 = 64 \times 16 = 1024 \text{ combinations}
  • Since there are 88 distinct I-type opcodes, the total combinations consumed by I-type instructions is: 8×1024=8192 combinations8 \times 1024 = 8192 \text{ combinations}

3. Analyze R-type instructions:

  • Each R-type instruction consists of: [Opcode] [Register 1 (6 bits)] [Register 2 (6 bits)].
  • Each distinct R-type opcode consumes: 26×26=64×64=4096 combinations2^6 \times 2^6 = 64 \times 64 = 4096 \text{ combinations}

4. Calculate the maximum number of R-type opcodes (NN):

The remaining instruction space is allocated to R-type instructions:

N×4096≤65536−8192N \times 4096 \le 65536 - 8192 N×4096≤57344N \times 4096 \le 57344 N≤573444096=14N \le \frac{57344}{4096} = 14

Thus, the maximum number of distinct R-type opcodes is 14.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Machine Instructions and Addressing Modes questions