328 views

3 Answers

1 votes
1 votes

Method-1

No. of possible instruction encoding =$2^{24}$

No. of encoding taken by two-address instructions =255×$2^{8}$×$2^{8}$

No. of encoding taken by one-address instructions =254×$2^{8}$

So, no. of possible zero-address instructions =$2^{24}$−(255×$2^{8}$×$2^{8}$+254×$2^{8}$) = 512

----------------------------------------------------------------------------------

Method-2

Out of 24 bits, 8 bits are for opcode in 2-Address. So $2^{8}$=256 instructions(2-Address) are possible.

But 255 are being used. So 1 is free.

We use this 1 for 1-address instruction by using 8 bits of 1 of the address i.e. 1*256=256

Now out of 256 1-address instructions, 254 are being used. So we are left with 2.

Again use these 2 for 0-address instruction by using 8 bits of address i.e. 2*256=512

0 votes
0 votes

Ans: 256

 

The system has 24 bits which look as under

_ _ _ _ _ _ _ _    _ _ _ _ _ _ _ _    _ _ _ _ _ _ _ _

 

Two address instructions would look as below

_ _ _ _ _ _ _ _    _ _ _ _ _ _ _ _    _ _ _ _ _ _ _ _

   [OPCODE]       [ADDRESS-1]    [ADDRESS-2]

Question says supports 255 two address instructions means $2^8$ $=$ $256$, so $8$ bits are required to support 255 instructions

 

One address instructions would look as below

0 0 0 0 0 0 0 0    _ _ _ _ _ _ _ _    _ _ _ _ _ _ _ _

                              [OPCODE]          [ADDRESS]

Question says supports 254 two address instructions means $2^8$ $=$ $256$, so $8$ bits are required to support 254 instructions.

Here all other MSB is all zeros as they are used for OPCODES of two address instructions.

 

Zero address instructions would look as below

0 0 0 0 0 0 0 0   0 0 0 0 0 0 0 0   _ _ _ _ _ _ _ _

                                                       [OPCODE]

Since 8 bits are available, so $2^8$ $=$ $256$, so 256 zero address instructions are supported

Related questions

12 votes
12 votes
3 answers
1
0 votes
0 votes
0 answers
2
0 votes
0 votes
0 answers
3
8 votes
8 votes
1 answer
4