GATE 2020 CS – Question 54
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 ______.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 14 to 14
Explanation
R-type has 12 bits of register fields, leaving a 4-bit opcode field (16 codes). I-type has 6+4 = 10 bits of operands, so its opcode is 6 bits and 8 I-type opcodes occupy 8/4 = 2 of the 4-bit prefixes. That leaves 16-2 = 14 R-type opcodes.