recategorized by
3,951 views
27 votes
27 votes
Using an expanding opcode encoding for instructions, is it possible to encode all of the following in an instruction format shown in the below figure. Justify your answer.
$$\begin{array}{ll} \text{14} & \text{double address instructions} \\  \text{127} & \text{single address instructions} \\   \text{60} & \text{no address (zero address) instructions} \\ \end{array}$$ $$\begin{array}{|c|c|c|} \leftarrow4\text{ bits}\rightarrow& \leftarrow6\text{ bits}\rightarrow & \leftarrow6\text{ bits}\rightarrow  \\ \hline \text{Opcode}& \underset{\text{Address}}{\text{Operand 1}}& \underset{\text{Address}}{\text{Operand 2}} \\\hline \end{array}$$
recategorized by

3 Answers

Best answer
30 votes
30 votes
$4$ bits are for the opcode so number of $2$ address instructions will be $2^4 =16-$ so $14$ double instructions are possible.

But out of $16$ only $14$ are used so $2$ are still left which can be used for $1$ address instruction. For $1$ address instruction we can use not only the $2$ left over but also the $6$ bits of operand $1$ (to make it one address) $-$ so $6$ bits that is $64.$ So, total $2\times 64$ single address instructions can be supported $-$ So, $127$ single instructions are possible

But out of $128,127$ are used so $1$ left which can be used for zero-address instruction. To make number of zero address we can use the operand $2$ address (we already included operand 1 address)  $- 6$ bits. So, total number possible is $64.$ So,
total $1\times 64 = 64$ zero address instructions are possible.

So, all encoding are possible.
32 votes
32 votes

There are 14 two-address instructions which consume 14*26*26 =  combinations 

There are 127 one-address instructions which consume 127*26 =  combinations 

There are 60 zero-address instructions which consume 60 combinations 

Total number of combinations consumed = 57344 + 8128 + 60 = 65532

We have a total of 216 = 65536 combinations  which is >65532 

So it is possible to encode all these instructions using the given instructions format ... Infact we will have 4 extra combinations ... 

Related questions

12 votes
12 votes
1 answer
1
go_editor asked Dec 19, 2016
3,500 views
In the program scheme given below indicate the instructions containing any operand needing relocation for position independent behaviour. Justify your answer.$$\begin{arr...
1 votes
1 votes
0 answers
2
7 votes
7 votes
3 answers
3