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开发者_如何学Go 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?
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.
精彩评论