0

PC memory module contains 512k words. Word has 64 bits. Binary instruction has four segments: indirect bit, operation code, register code part to determine one of the 32 registers and address part. Instruction binary code is stored in word memory.

  1. How many bits are needed for the opcode, register code and the address segment?

Indirect: 1 bit

Reg: 5 (2^5 = 32)

Address: 19 (2^19 = 512k)

Op-code = 64 - 5 – 19 = 40 bits

I think my answer is correct, but practically an opcode cannot have 40 bits. (That's trillion of instructions). Is 40 correct?

Trang
  • 5
  • 1
  • 3

1 Answers1

0

Your answer is correct, except that you forgot to subtract the indirect bit for a total of 64 - 5 - 19 - 1 = 39.

Not all the 39 bits need to be part of the opcode.
In general the bits of the opcode fields are calculated from the number of opcodes, which has not been given.

Those 39 bits can be used or reserved for future use.
For example, 3 bits could be used to specify a byte in each word (thereby extending the address bits).
Another 19 bits could be used to specify a second address or so on.

Margaret Bloom
  • 41,768
  • 5
  • 78
  • 124
  • Thank you very much, I am unable to upvote your answer as I don't have enough reputation. May I clarify something minor. What does it actually mean "PC memory module contains 512k words. Word has 64 bits"? As I understand, word that has 64bits means that the word is 8 bytes (64/8). Total memory size is 4MB? (512k * 8byte words)? Thanks again. – Trang Dec 30 '16 at 18:52
  • @Trang, you are welcome. Yes. Memory is addressed in words, the most known architecture use 8-bit words so sometimes people get confused about words vs bytes. Some days ago I answered a [question about memory size](https://stackoverflow.com/questions/41219266/32bit-cpu-how-much-memory-can-it-use/41222836#41222836) that maybe can help you. – Margaret Bloom Dec 30 '16 at 18:55
  • Hello again, one more question. Do these sentences mean the same? "Word has 64bits" vs "Word is 64bits". I assume that "Word has 64 bits" means the word size is "8 bytes" and "Word is is 64bit" means that the word can hold a value of 2^64? The reason is that when I see n-bits long, we often calculate 2^n. Argghh! – Trang Dec 30 '16 at 19:34
  • @Trang They mean the same thing. Word size is given in bits because 1) It may not be a multiple of 8 (e.g. 14 bits) 2) Bytes doesn't mean 8 bits everywhere. A word of 64 bits cannot hold 2^64, at most 2^64 - 1. If *n* is a number of bits, the biggest number representable using the usual binary format is 2^n - 1. The quantity 2^n is the *number of numbers*, i.e. the number of *different* values representable. For example, with 2 bits we have 00, 01, 10, 11. Max number is 3 (11) = 2^2 - 1. The number of numbers is 4 = 2^2. – Margaret Bloom Dec 30 '16 at 19:41