0

Basicly, I couldn't find anywhere where this is explained thoroughly, so I though maybe anybody would have a explanation or any direction where should I search for the answer.

The question would be : If I have a CPU connected to 16384 bit RAM, the data bus width is 16 bit, how should I find the width of the adress bus?

Or from another perspective : If i have a CPU connected to RAM using 10 bit address bus and 8 bit data bus, how many bits does my RAM have?

The answer to first question I searched and could only get the answer as 2^16 and the answer would be 65535 ~ 64kB. If this is not correct, I would love to hear the explanation.

U-plus-1F92C
  • 1
  • 1
  • 2

1 Answers1

1

The address bus width determines how many addresses can be accessed by the CPU. It also determines the maximum size of your RAM.

For example, if you have an address bus of width 3, you can access 2 ^ 3 = 8 addresses from the memory, which are:

Address0 -> 000
Address1 -> 001
Address2 -> 010
Address3 -> 011
Address4 -> 100
Address5 -> 101
Address6 -> 110
Address7 -> 111

So if you have an address bus width of 10, you can access 2 ^ 10 = 1024 addresses, which is equivalent to 1 KB of RAM memory.

If you have an address bus of width 32, you can access 2 ^ 32 = 4294967296, addresses, which is around 4 GB of RAM memory.

That's the reason you can't install more than 4 GB memory on a 32-bit system - because the extra-memory cannot be addressed (the registers have a fixed 32-bit size).

Now to your question, if you have a RAM memory of size 16384, which is around 16KB, you need an address bus of width log2(16384) = 14, in order to address this entire space.

You can check this reddit thread for more details.

Cosmin Ioniță
  • 3,598
  • 4
  • 23
  • 48
  • I've found that, instead of log2(16384), the correct answer is 10 for adress bus. One way of calculating it would be 16384 / 16 ( data bus) = 1024 and then we can use log2(1024) which is 10. Another way to calculate would be using a few simple math formulas. RAM = (2^AB)*DB; 2^AB = RAM/DB; 2^AB = 16384/16; 2^AB = 1024; 2^AB=2^10; AB = 10; And to check if all this is correct, just calculate RAM by using before mentioned formula RAM = (2^AB) * DB. So RAM = 2^10*16 = 16384 kB – U-plus-1F92C Jan 04 '21 at 12:46
  • Can you point the source of where you found this? AFAIK, address bus and data bus are completely separated. If your address bus is 10, you can address only 1024 locations in memory, and not 16384 – Cosmin Ioniță Jan 04 '21 at 13:08
  • My bad, we recently had a test, and asked before hand the professor who tought us this, and you are completely right. I thought it was the other way around. Thank you. – U-plus-1F92C Jan 04 '21 at 23:59