retagged by
419 views
1 votes
1 votes
Consider a hypothetical processor that supports two addresses -- one address and zero address instructions. It has a $256$ word memory, and a $20$ bit instruction is placed in $1$ word of memory (where memory is word addressable).

If there exist $8$ two address instructions and $1984$ one address instructions, then the total number of zero address instructions formulated are _______.
retagged by

3 Answers

Best answer
5 votes
5 votes
With 20 bits, number of encodings = $2^{20}$ (Not all of these are distinct instructions as when only address bits differ, instructions are not distinct).

No. of address bits for one address = 8 as memory is 256 words and word addressable.

No. of encodings taken by 8 two address instructions $= 8 \times 2^{8} \times 2^8=2^{19}$.

No. of encodings taken by 1984 one addressable instructions $= 1984 \times 2^8$.

Remaining encodings can become possible 0 address instructions which is

$2^{20} - 2^{19} - 1984 \times 2^{8} \\= 2^{19} - 2^{18} -960 \times 2^8 \\= 2^{18} - 960 \times 2^8 \\= 64 \times 2^8 \\= 2^{14} \\= 16384$
selected by
3 votes
3 votes
256 words = 2^8 words , Hence 8 bits for address
With 4 bit opcode, we can have 16 operations but only 8, 2-add operations are used, so possible 1-address instructions (16 - 8 )* 2^8  = 2^11  instructions
Now possible 0-address instructions = ( 2^11 −  1984 )* 2^8 = 64 × 2^8 = 2^14 = 16,384
1 votes
1 votes

20 bit instructions. => $2^{20}$ different encodings or formulations of instructions possible.

Already explained the difference between an instruction and an instruction encoding here.

An address = 8 bits (because 256 word memory)

=> The "operand" field in the instruction format takes 8 bits.

 

there exist 8 two address instructions

Two address instructions == Two operand instructions.

So, $2^{16}$ different combinations of two operands possible, since an operand is of 8 bits.

These $2^{16}$ different operand combinations can be clubbed with 8 different types of instructions.

So, total encodings = $8 * 2^{16}$

 

1984 one address instructions

Similarly; $1984*2^8$ encodings possible for this one.

 

So, out of total possible encodings, 1AI and 2AI take $8 * 2^{16}+1984*2^8$ encodings.

= $2^{19}+507904=1032192$ encodings

 

Remaining encodings = $2^{20}-1032192=16384$

Answer:

Related questions

2 votes
2 votes
3 answers
1
Bikram asked Nov 25, 2016
602 views
A computer has $32$ bit instructions and $12$ bit addresses.If there are $250$ two-address instructions, the number of one-address instructions that can be formulated are...
1 votes
1 votes
3 answers
3