how long is a memory address typically in bits

29,753

The processor uses 32 bits to store an address. With 32 bits, you can store 2^32 distinct numbers, ranging from 0 to 2^32 - 1. "Byte addressing" means that each byte in memory is individually addressable, i.e. there is an address x which points to that specific byte. Since there are 2^32 different numbers you can put into a 32-bit address, we can address up to 2^32 bytes, or 4 GB.

It sounds like the key misconception is the meaning of "byte addressing." That only means that each individual byte has its own address. Addresses themselves are still composed of multiple bytes (4, in this case, since four 8-bit bytes are taken together and interpreted as a single 32-bit number).

I was under the impression that for a 32-bit processor, it can address upto 2^32 bits, which is 4.29 X 10^9 bits (NOT BYTES).

This is typically not the case -- bit-level addressing is quite rare. Byte addressing is far more common. You could design a CPU that worked this way, though. In that case as you said, you would be able to address up to 2^32 bits = 2^29 bytes (512 MiB).

Share:
29,753
eagertoLearn
Author by

eagertoLearn

Updated on September 26, 2020

Comments

  • eagertoLearn
    eagertoLearn over 3 years

    I am confused with so many terminologies that my instructor talks about such as word,byte addressing and memory location.

    I was under the impression that for a 32-bit processor, it can address upto 2^32 bits, which is 4.29 X 10^9 bits (NOT BYTES).

    The way I think now is:

    The memory is like an array of buckets each of 1 byte length.

    when we say byte addressing (which I guess is the most common ones), each char is 1 byte and is retrieved from the first bucket (say for example). for int the next 4 bytes are put together in little-endian ordering to compute the Integer value.

    so each memory, I see it as, 8 bits or 1 byte, which can give upto 2^8 locations, this is far less than what cpu can address.

    There is some very basic mis-understanding here on my part which if some experts can explain in simple terms that a prosepective CS-major student can it in once forever.

    I have read various pages including this one on word and here the unit of address resolution is given as 8b for ARM, which adds more to my confusion.

  • eagertoLearn
    eagertoLearn over 10 years
    I read this 3 times and each time I am understanding it better. how does the word size come into play here?
  • TypeIA
    TypeIA over 10 years
    @eagertoLearn The "word size" is the size of the numbers that the processor operates on. When it (say) adds two numbers together, the word size is the size of those numbers. Word size is commonly, but not always, the same as the address size.
  • eagertoLearn
    eagertoLearn over 10 years
    is there any advantage of using byte addressing. since the technology has grown so much, why the addressing has not gone up?
  • TypeIA
    TypeIA over 10 years
    @eagertoLearn The advantage would be being able to address more total memory. The disadvantage is that any code that needs to deal with individual bytes becomes much more complex, since it has to separate the bytes from each addressable word. These days, with 64-bit machines allowing (currently) up to 2^44 = 16 TB (current 64-bit implementations do not use all address bits), and (eventually) up to 2^64 = 16 exabytes, there is no motivation to move away from byte addressing.
  • eagertoLearn
    eagertoLearn over 10 years
    right now int takes up to 4 bytes and there is byte-ordering involved.if my memory addressing is not 1-byte not 4-bytes, I actually get access faster and with 64-bit, I could access that memory address I guess
  • Peter Cordes
    Peter Cordes over 6 years
    Even though a DIMM itself might only be word-addressable, you need a memory controller to talk to it. The memory controller / cache is what provides byte-addressability. (But doesn't DDR DRAM have enable / disable lines that do allow a byte store without a read-modify-write cycle in the memory controller, for uncacheable stores?)
  • ViníciusPJ
    ViníciusPJ over 4 years
    "You could design a CPU that worked this way, though. In that case as you said, you would be able to address up to 2^32 bits = 1 GBytes" I think it should be 512 MB (Mega Bytes): 2^32 = 4294967296 aderesses (each point to a bit); 4294967296 / 8 = 536870912 Bytes (8 bits is 1 byte); 536870912 / (1024*1024) = 512 MB. Is this correct?
  • TypeIA
    TypeIA over 4 years
    @ViníciusPJ Quite right. Well spotted - I've edited the answer. Thanks!
  • Peter Cordes
    Peter Cordes over 4 years
    Yup, 4Gib / (8 bits/byte) = 512MiB. The bits cancel, leaving the units as bytes.