Last Updated : 19 Nov, 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 _______ .

Note –This was Numerical Type question.
(A) 32
(B) 64
(C) 256
(D) 512


Answer: (A)

Explanation: Given, size of instruction format is 2 byte (= 16 bits), therefore number of instruction encoding = 216
Also, total number of bits in integer operand = log2(16 integer registers) = 4
Total number of bits in floating point operand = log2(64 floating point registers) = 6

So, number of encoding consumed:

By type 1 instructions = 4×23×4 = 214
By type 2 instructions = 8×22×6 = 215
By type 3 instructions = 14×2(4+6) = 14336

Now, number of encoding left for type 4 instructions = 216 − (214 + 215 + 14336) = 2048
Therefore, total number of different instructions of type 4 instructions = 2048 /64 = 32

Please note that there is difference between number of different instructions and number of different encoding, a single instruction can have different encodings when the address part differs.

So, answer is 32.

Quiz of this Question


Share your thoughts in the comments