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 ____.
Explanation
64 registers need 6-bit register fields. I-type: opcode + 6-bit register + 4-bit immediate = 16 bits → opcode width = 16−6−4 = 6 bits, giving 2⁶=64 possible 6-bit prefixes, of which 8 are used, leaving 56 unused 6-bit prefixes. R-type: opcode + two 6-bit registers = 16 bits → opcode width = 16−12 = 4 bits. Each 4-bit R-type opcode prefix corresponds to 2^(6−4)=4 of the unused 6-bit prefix slots (since its remaining 2 bits are free within the 6-bit-prefix view). Maximum R-type opcodes = ⌊56/4⌋ = 14.
Source: GATE CS 2020 (2020)
This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.