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$