in CO and Architecture edited by
2,004 views
1 vote
1 vote

In a $10$-bit computer instruction format, the size of address field is $3$-bits. The computer uses expanding OP code technique and has $4$ two-address instructions and $16$ one-address instructions. The number of zero address instructions it can support is

  1. $256$
  2. $356$
  3. $640$
  4. $756$
in CO and Architecture edited by
by
2.0k views

2 Answers

6 votes
6 votes
Best answer
Total number of encodings possible are:  $2^{10}$

Number of encodings from two-address instructions:   $4\times 2^{3}\times 2^{3}=256$     

Number of encodings from one address instructions:   $16\times 2^{3}=128$             

$\therefore$  Number of encodings from zero address instructions :    $2^{10}-256-128=640$

Option C is correct.
selected by

2 Comments

Isn’t the question asking number of 0-address instructions, instead of possible number of encoding?

I approached the problem like this, let me know if I got it wrong.

Let’s say we have 10 bit word to hold the instructions. The address bits are represented using $x$ and opcode bits be $y$.

For a two-address instruction, the bit fields will look like this

$y\thinspace y\thinspace y\thinspace y\thinspace x\thinspace x\thinspace x\thinspace x\thinspace x\thinspace x\thinspace$

For one-address instructions,

$y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace x\thinspace x\thinspace x\thinspace$

And for zero-adress instructions,

$y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace y\thinspace$

Since we want to differentiate among different types of n-address instructions, let’s say starting 2 bits of opcode bits are dedicated for that.

($00$ for 2 address | $01$ for 1 address | $11$ for 0 address)

So we’re left with 2 bits of opcode in the first case, 5 bits in second case and 8 bits in third. So possible number of 2 address instructions will be 4. Same for 1 address will be 32, but question specifically mentions 16, so not sure if this method is correct or not. And if correct, we’re left with 8 bits in the third case, which results in 256 possible 0-address instructions.

Update: I read about expanding OP codes. Now it’s clear why it’s 640.

0
0
your whole work was to confuse us :)
0
0
4 votes
4 votes

Here, Instruction format =10bits

Size of address field= 3bit

 For two address field

Op code=4bit add1= 3bit add2= 3bit

Uses 4  two address instructions

Remaining= 2^4 - 4=12

For One address instruction

Uses 16 one address instruction 

Remaining= 12 *2^3 -16

=12*8 -16

= 80

For zero address instruction

80*2^3 =640

Option C

 

Answer:

Related questions