views:

124

answers:

2

I've been reading up on memory models in an assembly book I picked up and I have a question or two. Let's say that the address bus has 32 lines, the data bus has 32 lines and the CPU is 32-bit (for simplicity). Now if the CPU makes a read request and sends the 32bit address, but only needs 8 bits, all 32 bits come back anyway? Also, the addresses in memory are still addressed per byte correct? So fetching one byte would bring back 0000 0001 to address 0000 0004?

Thanks in advance

+8  A: 

In general, yes. There's nothing to be gained by reading parts of a word from a bus, so a whole word is read. Instructions specify which parts of the words they need to actually load or store in registers.

That said, it's rare to read directly from the memory these days. CPUs have caches with which you interact 99% of the time, and when data isn't in the cache, a whole line is brought in (multiple words) and then you still read from the cache.

Also note that many modern CPUs actually have 64-bit buses.

Eli Bendersky
Any good books you can recommend in regards to cpu architecture, memory models, etc? Thanks!
IM
Eli Bendersky
Thanks, I appreciate the help.
IM
+1  A: 

You should really read this: What Every Programmer Should Know About Memory

Paul R