retagged by
24,274 views
66 votes
66 votes
A processor has $16$ integer registers $\text{(R0, R1}, \ldots ,\text{ R15)}$ and $64$ floating point registers $\text{(F0, F1}, \ldots , \text{F63)}.$ It uses a $2\text{- byte}$ instruction format. There are four categories of instructions: $\text{Type-1, Type-2, Type-3},$ and $\text{Type-4. Type-1}$ category consists of four instructions, each with $3$ integer register operands $\text{(3Rs). Type-2}$ category consists of eight instructions, each with $2$ floating point register operands $\text{(2Fs). Type-3}$ category consists of fourteen instructions, each with one integer register operand and one floating point register operand $\text{(1R+1F). Type-4}$ category consists of $\text{N}$ instructions, each with a floating point register operand $\text{(1F)}.$

The maximum value of $\text{N}$ is _________.
retagged by

7 Answers

1 votes
1 votes

Instruction size = 2−byte.
So, total number of instruction encodings = 216
There are 16 possible integer registers, so no. of bits required for an integer operand = 4
There are 64 possible floating point registers, so no. of bits required for a floating point operand = 6
Type-1 instructions:
There are 4 type-1 instructions and each takes 3 integer operands.
No. of encodings consumed by type-1 = 4 × 24 × 24 × 24 = 214.
Type-2 instructions:
There are 8 type-2 instructions and each takes 2 floating point operands.
No. of encodings consumed by Type-2 instructions = 8 × 26 x 26 = 215.
Type-3 instructions:
There are 14 type-3 instructions and each takes one integer operand and one floating point operand.
No. of encodings consumed by Type-3 instructions = 14 × 24 × 26 = 14336.
So, no. of encodings left for Type-4 = 216 − (214 + 215 + 14336) = 2048.
Since type-4 instructions take one floating point register, no. of different instructions of Type-4 = 2048 / 64 = 32.

0 votes
0 votes
4*(2^12) + 8*(2^12)  + 14*(2^(6+4)) + N*(2^6)=2^16

Here We get N=32
0 votes
0 votes

The processor has a $2$ byte instruction format.

$\therefore$ Total possible combination of bits $=2^{2\times8} = 2^{16}$

 

Let’s solve this problem by finding the bit combinations of each type of instruction format.


 

Type 1:

OpCode (4 bit) RegInt1 (4 bit) RegInt2 (4 bit) RegInt3 (4 bit)

 

 

No. of OpCodes = 4

No. of bit combinations = (No. of OpCodes) x (bit-combination of the rest)

$C_{t1}= 4\times 2^{4+4+4} \\ = 2^2\times2^{12}\\ = 2^{14}$


 

Type 2:

OpCode (4 bit) RegFloat1 (6 bit) RegFloat2 (6 bit)

 

No. of OpCodes = 8

No. of bit combinations = (No. of OpCodes) x (bit-combination of the rest)

$C_{t2}= 8\times 2^{6 + 6} \\ = 2^3\times 2^{12} \\ = 2^{15}$


 

Type 3:

OpCode (6 bit) RegFloat (6 bit) RegInt (4 bit)

 

No. of OpCodes = 14

No. of bit combinations = (No. of OpCodes) x (bit-combination of the rest)

$C_{t3}= 14\times 2^{6 + 4} \\ = 14\times 2^{10}$


 

Type 4:

OpCode (10 bit) RefFloat (6 bit)

 

No. of OpCodes = $N$

No. of bit combinations = (No. of OpCodes) x (bit-combination of the rest)

$C_{t4}= N\times 2^6$

 

However, we know that:

Total Combinations:  $= 2^{16}$

 

After Type-1, Type-2, and Type-3 have used up some combinations, let’s calculate the remaining:

Remaining: $= 2^{16} – (C_{t1} + C_{t2} + C_{t3} )$

 

We can assign all remaining combinations to Type-4

$\therefore C_{t4} = 2^{16}-(2^{14} + 2^{15} + 14\times 2^{10})$

$C_{t4} = 2^{16} – 2^{10}(2^4 + 2^5 + 14)$

$C_{t4} = 2^{10}(2^6 – (16 + 32 + 14))$

$C_{t4} = 2^{10}(64 - 62)$

$C_{t4} = 2^{10}\times 2 \\ = 2^{11}$

Replacing $C_{t4}$ in the above line:

$N\times 2^6 = 2^{11}$

$N = \frac{2^{11}}{2^6} \\ = 2^5 \\ = 32$

$\therefore$ Max Number of Instructions in Type-4 possible is $32$

Answer:

Related questions