588 views
2 votes
2 votes
First field of 3 field instruction register indicate opcode second addresses are register from a set of 100 registers and third is the memory address field.

32 bit instruction is placed in 1MW memory.

If there are K instruction which uses both register and memory reference and L address register reference instructions then the number of zero address instruction possible are

a)[(2^5-K)*2^20-L]×2^7

b)[(2^5-K)*2^7-L]×2^20

c)[(2^5-L)*2^20-K]×2^7

d)[(2^5-L)*2^20-K]×2^20

1 Answer

Best answer
0 votes
0 votes

Here the thing worth watching is that in 2 address instructions , we have two types of address : register address for register set and memory address for memory word . And it is given that in 2 address instruction format , we will have opcode , then register address field then finally memory address field. So in generation of 1 address instruction using expanded opcode technique we will have memory based instruction as register address field will be merged with the unused opcodes of 2 address instruction. So the phrase "L register reference instruction" should be "L memory reference instruction" instead . Having said that :  

Given register size      =      100 registers

Hence number of bits needed to address these registers   =    ceil(log2 (number of registers))

                                                                                    =    ceil(log2 100)

                                                                                    =    7

         number of bits needed to address memory              =    ceil(log2(Memory capacity))

                                                                                    =    ceil(log2(220))

                                                                                    =    20

Hence in a 2 address instructions , number of bits remaining for opcode   =   32 - 7 - 20    =    5 bits

Hence number of instructions = number of opcodes          =    25             =   32 instructions

But given number of 2 address instructions                      =    K

Hence number of unused opcodes                                   =    25 - K  

So this opcodes along with next 7 bits of register address will be used to generate one address instructions using expanded opcode technique.

Hence number of one address instructions possible          =   ( 25 - K )  * 27  [ As there are 27 combinations possible as we have taken 7 bits of register address field of 2 address instruction for each of its unused opcode ]

Now given number of 1 address instructions                     =   L

Hence number of unused opcodes for 0 address instruction     =   [ ( 25 - K )  * 2  -  L ]

Now each of these opcodes will be merged with each of the 220 combinations as we have 20 bits in memory address field to form 0 address instructions .

Hence number of 0 address instructions                                =   [ ( 25 - K )  * 2  -  L ] * 220

Hence B) should be the correct option .

selected by

Related questions

1 votes
1 votes
1 answer
1
Hirak asked May 23, 2019
594 views
Is pipeline hazards there in the syllabus? And are there any previous year questions from there?
0 votes
0 votes
1 answer
2
Magma asked Jan 8, 2019
376 views
Certain CPU uses expanding op-code . It has 16 bit instructions with 6-bit addresses . It has maximum 192 one-address Instructions.Then number of 2-addresses instructions...
0 votes
0 votes
0 answers
3
iarnav asked Oct 3, 2018
433 views
Say the processor runs at 600 MHz then what is CPU clock time?