Question

A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA of the processor has 150 distinct instructions. The instructions are equally divided into two types, namely R-type and I-type, whose formats are shown below.

R-type Instruction Format:

Field 1Field 2Field 3Field 4Field 5
OPCODEUNUSEDDST RegisterSRC Register1SRC Register 2

I-type Instruction Format:

Field 1Field 2Field 3Field 4
OPCODEDST RegisterSRC Register# Immediate value/address

In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.

Let XX be the number of bits used to encode the UNUSED field, YY be the number of bits used to encode the OPCODE field, and ZZ be the number of bits used to encode the immediate value/address field. The value of X+2Y+ZX + 2Y + Z is ________

Official answer and solution
Official answer
34
From
Official GATE 2024 answer key

Solution

Compute the bit-widths of the OPCODE field (YY), each register field, the UNUSED field (XX), and the Immediate field (ZZ).

  1. OPCODE field size (YY):
    • The 150150 instructions are equally divided into 7575 R-type and 7575 I-type instructions.
    • Encoding 7575 operations of each type requires ⌈log⁡2(75)⌉=7\lceil \log_2(75) \rceil = 7 bits, plus 11 bit to distinguish R-type vs. I-type:
      Y=1+7=8 bitsY = 1 + 7 = 8\text{ bits}
  2. Register field size:
    • To address 5050 architectural registers, each register field requires ⌈log⁡2(50)⌉=6\lceil \log_2(50) \rceil = 6 bits.
  3. UNUSED field size (XX) in 32-bit R-type format (which has 3 register fields):
    X=32−Y−3×6=32−8−18=6 bitsX = 32 - Y - 3 \times 6 = 32 - 8 - 18 = 6\text{ bits}
  4. Immediate value/address field size (ZZ) in 32-bit I-type format (which has 2 register fields):
    Z=32−Y−2×6=32−8−12=12 bitsZ = 32 - Y - 2 \times 6 = 32 - 8 - 12 = 12\text{ bits}
  5. Final value:
    X+2Y+Z=6+2(8)+12=34X + 2Y + Z = 6 + 2(8) + 12 = 34
Final answer

34

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2024 Computer Science and Information Technology - Set 2 (CS2)
Question
61 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.