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 (16-bit) instruction format. There are four categories of instructions: Type-1, Type-2, Type-3, and Type-4. The Type-1 category consists of four instructions, each with three integer-register operands (3Rs). The Type-2 category consists of eight instructions, each with two floating-point-register operands (2Fs). The Type-3 category consists of fourteen instructions, each with one integer-register operand and one floating-point-register operand (1R + 1F). The Type-4 category consists of N instructions, each with one floating-point-register operand (1F).

The maximum value of N is __________.

Answer: 32Concept In a fixed-length instruction format, every instruction and every legal operand combination must map to a distinct bit pattern. If a category has k…

Attempted by 151 students.

Show answer & explanation

Correct answer: 32

Concept

In a fixed-length instruction format, every instruction and every legal operand combination must map to a distinct bit pattern. If a category has k instructions and c operand combinations per instruction, it consumes k × c encodings.

A 16-bit instruction provides 216 total encodings. The encodings used by all instruction categories together cannot exceed this total.

Application

  1. The instruction length is 2 bytes = 16 bits, so the total number of encodings is 216 = 65,536.

  2. An integer-register operand has 16 choices. Type-1 therefore uses 4 × 163 = 16,384 encodings.

  3. A floating-point-register operand has 64 choices. Type-2 therefore uses 8 × 642 = 32,768 encodings.

  4. A Type-3 instruction has 16 × 64 operand combinations. Type-3 therefore uses 14 × 16 × 64 = 14,336 encodings.

  5. The encodings left for Type-4 are 65,536 − (16,384 + 32,768 + 14,336) = 2,048.

  6. Each Type-4 instruction has one floating-point-register operand, so it needs 64 encodings. Hence N = 2,048 ÷ 64 = 32.

Cross-check

With N = 32, the used encodings are 16,384 + 32,768 + 14,336 + 32 × 64 = 65,536, exactly the available total. N = 33 would require 65,600 encodings, which is too many. Therefore, the maximum value of N is 32.

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

Explore the full course: Computer Architecture

Loading lesson…