GATE CS 2024 Set 2 — Question 57

NAT+2 / -0MediumInstruction FormatsInstructions & Addressing ModesComputer Organization & Architecture

Computer Organization & Architecture → Instructions & Addressing Modes → Instruction Formats

Last updated

Question

A processor with 16 general purpose registers uses a 32-bit instruction format. The instruction format consists of an opcode field, an addressing mode field, two register operand fields, and a 16-bit scalar field. If 8 addressing modes are to be supported, the maximum number of unique opcodes possible for every addressing mode is _________

Correct answer

32 to 32

Solution

Given:
  • Instruction size = 32 bits
  • Number of registers = 16. Bits required per register = log216=4\lceil \log_2 16 \rceil = 4 bits.
  • Two register operand fields. Total bits = 2×4=82 \times 4 = 8 bits.
  • Scalar field size = 16 bits.
  • Number of addressing modes = 8. Bits required = log28ceil=3\lceil \log_2 8 ceil = 3 bits.
Let nn be the number of bits for the opcode field.
The sum of the lengths of all fields must equal the total instruction size:n+Addressing Mode bits+Register bits+Scalar bits=32n + \text{Addressing Mode bits} + \text{Register bits} + \text{Scalar bits} = 32n+3+8+16=32n + 3 + 8 + 16 = 32n+27=32n + 27 = 32n=5 bitsn = 5 \text{ bits}The maximum number of unique opcodes possible is 2n=25=322^n = 2^5 = 32.

More questions on Instructions & Addressing Modes

Practice GATE CS PYQs with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free