Question

a computer has 128 operations having opcodes to be executed with 512000 addresses (32-bit word). How many bits required for 1 address instruction?How many bits required for 2 address instruction?

I just want hints to solve it because i don't understand what to do. I don't know what's the relation between opcodes and the number of address instruction, so if you clarify it to me i'll be gratefull.

Was it helpful?

Solution

I think that a vital piece of information is missing in your question:

How many operations take 1 operand, and how many operations take 2 operands?

Suppose 97 operations take 1 operand, and 31 operations take 2 operands:

  • In the first group we have:

    • Operation length = 7 bits

    • Operand length = 19 bits (check the binary representation of 512000)

    • Total length = 7 + 19 = 26 bits

  • In the second group we have:

    • Operation length = 5 bits

    • Operand length = 19 bits (check the binary representation of 512000)

    • Total length = 5 + 19*2 = 43 bits

And of course, you will have to define the operations in a manner that will allow the CPU to translate them without ambiguities (for example, 1000011... can be a 7 bit operation, or it can be a 5 bit operation with 11... as the first operand).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top