A processor has 64 registers and uses 16-bit instruction format. It has two…
2020
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 _______ .
Answer: 14 — Key facts: 16-bit instructions, 64 registers (so a register name needs 6 bits). Count how many distinct bit patterns I-type instructions use: there are 8…
Attempted by 60 students.
Show answer & explanation
Correct answer: 14
Key facts: 16-bit instructions, 64 registers (so a register name needs 6 bits).
Count how many distinct bit patterns I-type instructions use: there are 8 I-type opcodes, 64 choices for the register, and 16 choices for the 4-bit immediate, so I-type uses 8 × 64 × 16 = 8192 instruction encodings.
Each R-type opcode uses one encoding for each pair of registers: 64 × 64 = 4096 encodings per R-type opcode.
Total available 16-bit encodings = 2^16 = 65536. Remaining encodings for R-type = 65536 − 8192 = 57344.
Maximum number of distinct R-type opcodes = floor(57344 / 4096) = 14.
Answer: 14