A processor has 16 integer registers (R0, R1, .. , R15) and 64 floating point…

2018

A processor has 16 integer registers (R0, R1, .. , R15) and 64 floating point registers (F0, F1,… , F63). It uses a 2-byte instruction format. There are four categories of instructions: Type-1, Type-2, Type-3, and Type-4. Type-1 category consists of four instructions, each with 3 integer register operands (3Rs). Type-2 category consists of eight instructions, each with 2 floating point register operands (2Fs). Type-3 category consists of fourteen instructions, each with one integer register operand and one floating point register operand (1R+1F). Type-4 category consists of N instructions, each with a floating point register operand (1F).

The maximum value of N is __________.

Attempted by 136 students.

Show answer & explanation

Correct answer: 32

Key idea: count total instruction encodings (2^16) and subtract encodings used by the given instruction categories to find how many encodings remain for Type-4.

  • Total possible encodings = 2^16 = 65536.

  • Type-1: 4 instructions, each with 3 integer registers. Integer registers = 16, so combinations per instruction = 16^3 = 4096. Encodings used = 4 × 4096 = 16384.

  • Type-2: 8 instructions, each with 2 floating-point registers. FP registers = 64, so combinations per instruction = 64^2 = 4096. Encodings used = 8 × 4096 = 32768.

  • Type-3: 14 instructions, each with 1 integer (16) and 1 FP (64) register. Combinations per instruction = 16 × 64 = 1024. Encodings used = 14 × 1024 = 14336.

  • Total encodings used by Type-1, Type-2 and Type-3 = 16384 + 32768 + 14336 = 63488.

  • Remaining encodings for Type-4 = 65536 − 63488 = 2048.

    So, Reamining encodings N * 2^6 = 2048
    So value of N is = 2048 / 64 = 32

  • Each Type-4 instruction has 1 FP register operand (64 choices), so each Type-4 instruction consumes 64 encodings. Therefore maximum N = 32

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir