The GATE Grind

GATE 2024 CS (CS2) – Question 61

Computer Organization and Architecture · Instruction Set and Addressing Modes · 2 marks · Numerical answer

A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA has 150 distinct instructions, equally divided into R-type and I-type. R-type format: OPCODE, UNUSED, DST Register, SRC Register1, SRC Register 2. I-type format: OPCODE, DST Register, SRC Register, immediate value/address. In the OPCODE, 1 bit distinguishes I-type and R-type and the remaining bits indicate the operation. The processor has 50 architectural registers and all register fields are of equal size. Let $X$ be the number of bits for the UNUSED field, $Y$ for the OPCODE field, and $Z$ for the immediate value/address field. The value of $X+2Y+Z$ is ________

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 34

Explanation

150 instructions split equally: 75 R-type and 75 I-type.

**OPCODE:** 1 bit for the type plus enough bits for 75 operations: $\lceil\log_2 75\rceil=7$. So $Y=1+7=8$.

**Registers:** 50 registers need $\lceil\log_2 50\rceil=6$ bits per register field.

**R-type (32 bits):** OPCODE 8 + UNUSED $X$ + 3 registers $(3\times6=18)$ $=32$, so $X=32-8-18=6$.

**I-type (32 bits):** OPCODE 8 + DST 6 + SRC 6 + immediate $Z=32$, so $Z=32-8-12=12$.

$$X+2Y+Z=6+2(8)+12=\mathbf{34}.$$

More Instruction Set and Addressing Modes questions

All Instruction Set and Addressing Modes questions →