1
$\begingroup$

If you have byte addressable memory, does it matter if you have a 32 bit or 64 bit databus for the range of the memory addresses for the words of the memory?

E.g. : Assume a 32-bit word. If you have a processor connected to a byte addressable $2^{32}$ byte memory,

Would the address of the lowest word be 0 and the address of the highest word simply be $2^{32}-4$ (0xFFFFFFFC), regardless of whether your databus size is 32 bit or 64 bit?

What difference would it make when you assume a 64-bit word or a 16-bit word?

$\endgroup$
  • $\begingroup$ The intel 8088 and 8086 differed in having 8 and 16 bit data buses, both had the same machine language and addressed 1MiB. $\endgroup$ – vonbrand Sep 19 '15 at 14:07
  • $\begingroup$ @vonbrand Are you trying to say that the address of the highest word does not depend on the databus size? $\endgroup$ – QuantumD Sep 19 '15 at 14:26
1
$\begingroup$

On most general purpose CPUs since the '70s, addresses are byte addresses. This includes 6800, 680X0, PowerPC, x86, ARM, MIPS, SPARC, SuperH, Z80, PA-RISC...

  • There are sometimes exceptions with DSPs that are not meant for processing bytes. (example : Analog Devices SHARC)
  • Some small embedded CPUs may also have different addressing, or separate address spaces for instructions (example : Microsemi PIC)
  • Some CPU support address spaces where data is aliased and expanded. For example mapping each bit at a different byte address (example : Some ARMs)

The actual width of the data bus is not directly related to the CPU internal architecture, wether it is a 8bits, 16bits or 32bits CPU.

For example:

  • The MC68008 was a 16/32bits CPU with a 8 bits bus.
  • The G3/G4 PowerPCs (PPC603, MPC755, MPC7450...) are 32bits CPUs with a 64bits data bus.

With a 32bits CPU, aligned 32bits word adresses are 0000_0000, 0000_0004, 000_0008 ... to ... FFFF_FFF0, FFFF_FFF4, FFFF_FFF8, FFFF_FFFC.

Some CPUs can do unaligned accesses, usually slower than aligned ones. An example : x86.

In that case, you could access a 32bits value at address 0000_0001.

$\endgroup$
  • $\begingroup$ What is the benefit of the x86, having the value start at 0000_0001? Wouldn't that kind of alignment result into unused memory? The x86 does have another rather strange property, it is a 32-bit processor nowadays (actually since 1985?), but the x86 words are 16-bit (see x86 documentation). $\endgroup$ – QuantumD Sep 21 '15 at 11:29
  • $\begingroup$ "Words" is quite a loaded term, there is no official definition and it could be sometimes 16bits, sometimes 32bits. As the x86 had a transition from being 16bits CPUs (8086-80186-80286) to 32bits ones (80386-) and even 64bits (Athlon), it is particularly confusing. $\endgroup$ – TEMLIB Sep 21 '15 at 20:48
  • $\begingroup$ Compilers try to align data in structures, for faster accesses, it can actually waste memory as gaps are inserted. Anyway, sometimes values are not aligned (in files, network packets...), and directly supporting misaligned accesses is handy. $\endgroup$ – TEMLIB Sep 21 '15 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.