Redirected
1,608 views
4 votes
4 votes
A register to register machine support two address one address and zero address instruction. Instruction register size is 24bits and register set size is 480.

If there are 48 two address instruction and 2048 zero address instruction then what is the maximum possible number of one address instruction?

3 Answers

Best answer
4 votes
4 votes

Here the keyword to be noticed is : "register to register instruction" . Hence address refers to register set here instead of memory location and hence defined by register size .

Given register size      =      480 registers

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

                                                                                    =    ceil(log2 480)

                                                                                    =    9

Hence in a 2 address instructions , number of bits remaining for opcode   =   24 - 9 - 9    =    6 bits

Hence number of instructions = number of opcodes          =    26             =   64 instructions

But given number of 2 address instructions                      =    48.

Hence number of unused opcodes                                   =    64  -  48    =   16 

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

Hence number of one address instructions possible          =    16 * 29  [ As there are 29 combinations possible as we have taken 9 bits of address field of 2 address instruction for each of its unused opcode ]

Now for zero address instructions , let number of unused opcode   =   x  

Then , similar to above for each opcode we have 29 combinations from the bits of the address field of the 1 address instruction.

Hence number of zero address instructions   ==>    x * 29   =    2048 [ Number of zero address instructions given in question ]

                                                                 ==>    x          =    4

Hence number of opcodes used in one address instructions      =    16 * 29  -   x   =   16 * 29  -   4

                                                                                                                       =    8188

Hence number of 1 address instruction in this scenario possible     =     8188

                   

selected by
1 votes
1 votes
Number of bits required to identify register is 9 bits

$2^{24}-(48*2^{18}+2048)/2^{9}$=
1 votes
1 votes
This Computer supports 2 Address, 1-Address ,Zero Instruction instructions.

Instruction register size =24 bit

Register Set size = 480 = 2^9 = 9 bits  needed to address these registers

Address 1 = 9 bit Address 2 = 9bit

Opcode = 24-(9+9) =6 =2^6 =64 instructions are possible.

48 2- Address Instruction then 64-48 = 16, then 1 Address be 16(2^9).

Now for Zero address instructions, let x be a number of unused opcode = 2^9*x = 2048, x =4

Number of Opcodes used in 1 Address instruction = 16 *2^9 -4 =8188
edited by

Related questions

1 votes
1 votes
1 answer
1