in CO and Architecture retagged by
3,009 views
1 vote
1 vote
Consider a hypothetical CPU which supports 16 bit instruction, 64 registers and 1 KB memory space. If there exist 12 2-address instruction which uses register reference and 12 1-address memory reference instructions how many O-address instructions are possible?
in CO and Architecture retagged by
by
3.0k views

3 Comments

51712 should be the ans..
0
0
Explain me ur approach
0
0
i'm getting 4096.

((2^4-12)*2^2-12)*2^10=4096. please tell me what's wrong in this approach
0
0

3 Answers

4 votes
4 votes
Best answer

|-------------------------------------------------16 bits-------------------------------------------------------|

Opcode ( 4 bits) Register (6 bits ) Register (6 bits )

so that Total no of opcode operation is =2^4=16 operation 

so that there exist 12 2's address instruction which uses the register reference  & 12 1-address memory reference instructions

then no of Free opcode operation after 2 address =16-12=4 

then no of   12 1-address memory reference instructions

4

|---------------------------------------------16 bits ------------------------------------------------------------| 

opcode  memory 

|-----------------6 bits --------------------------------|--------------------10 bits ---------------------------|

Memory 1 kb = 2^10 ( 10 bits for memory ) ( 16 -10=6 bits for opcode)

then no of opcode  bits for 1 address for the memory reference  (6-4 =2 bits )

((2^4-12)*2^2-12)*2^10 = 4096 O-address instructions are possible

how many =4096 

edited by

3 Comments

But why did you (6-4=2bit)?

I did'nt understand it please help
0
0

then no of opcode  bits for 1 address for the memory reference  (6-4 =2 bits )

yes !! even i didn't get this!

why u did this?? 

0
0

@Things To Know (Thin

can u pls tell me why u did 6-4 bits;

why not like 4*(64)-12=244

no of 0 address instruction = 244* $2^{10}$=249856 

0
0
7 votes
7 votes
Total encodings$=2^{16}$

Number of encodings used in $12$ two address instructions$=12*2^6*2^6$

Number of encodings used in $12$ one address memory reference instructions$=12*2^{10}$

The number encodings left for zero address instructions/ number of zero address instructions possible$=2^{16}-(12*2^6*2^6+12*2^{10})=4096$

1 comment

For ease of calculation you can also do

Total 64 K

2-addr - $12 \times 4K = 48K$

1-addr - 12K

So, remaining 4K.
3
3
1 vote
1 vote

This is the method ..

3 Comments

thanks For approach
0
0
wrong see above approach
0
0

@SHUBHAM SHASTRI

even i feel ur approach is wrong!.

although am not very much sure but i dont if we can do it like this also

0
0

Related questions