Computer Science – How Many Bits Address Required for n Bytes of Memory?

bytecomputer sciencecomputer-architecture

How many bits of address is required (for the program counter for example) in a byte-addressed computer with 512 Mbyte RAM?

What does the formula look like?

How is this connected with the fact that 32 bits can address no more than 4 GB RAM?

Best Answer

You need log2(n) bits to address n bytes. For example, you can store 256 different values in an 8 bit number, so 8 bits can address 256 bytes. 210 = 1024, so you need 10 bits to address every byte in a kilobyte. Likewise, you need 20 bits to address every byte in a megabyte, and 30 bits to address every byte in a gigabyte. 232 = 4294967296, which is the number of bytes in 4 gigabytes, so you need a 32 bit address for 4 GB of memory.

Related Topic