5
$\begingroup$

So what happens if we're transfering lots of 8 bit words in a 32 bit bus? Does each bus cycle only transfers 8 bit at the time, wasting the other 24 lines of the bus? Or does it transfer 4 words in each bus cycle?

$\endgroup$
4
$\begingroup$

I would say "it depends":

  • most likely you ask for 8 bits to be retrieved and you get 8 bits and ignore the other 24 lines;
  • if you know you're dealing with sequential data, that you want to consider bytewise, you could retrieve 4 bytes at a time, but you'll have to split or handle the retrieved 4 bytes in code.

On specific architectures you have alignment considerations.

Specifically addressing your question, no, it is very unlikely a system would retrieve 4 words in each cycle only to then "split" them into single words to process, without a program catering for that itself.

$\endgroup$
1
$\begingroup$

It transfers 4 8-bit words on each bus cycle. I would not say the other 24 lines are wasted; the data on them is unused and may have no valid values. Writing code and trying to put 3 8-bit words on those lines would waste time; each cycle (either reading or writing the bus) has 32 bits of data or instruction on it. Therefore, it is more efficient (and easier) to just send the 8 bits as part of the 32 and ignore the (useless) data on the other 24 lines.

This is really a conceptual question and not a question about the workings of the bus. The processor's job is to faithfully transfer 32 bits on each cycle. It does not know which of those bits are important to you, the programmer. It does not know or care whether it contains 2 BCD digits, 8-bit ASCII, 8-bit unsigned integer, 16-bit signed integer, 32-bit floating point, or a 32-bit instruction. The processor's state machine guided by your program must work together to use only those parts of the data which are important to the task at hand. If you only want to transfer 8-bit words, the receiving process (your program) must make sure it only uses the proper 8 bits of the 32 bits sent to it.

$\endgroup$
  • 1
    $\begingroup$ I find this answer confusing. Your first sentence makes it sound like you are saying it transfers 4 8-bit words in each cycle, but the rest of your answer sounds like you are saying it transfers 1 8-bit word in each cycle. So which is it? I suggest editing to pick one, clarify what you are trying to say and to explain more clearly. $\endgroup$ – D.W. May 28 '15 at 4:51
  • $\begingroup$ Yes, that was the feeling I got from reading it. I'll mark it as an answer after clarification. Thanks! $\endgroup$ – Pedro Gordo May 28 '15 at 9:19
  • $\begingroup$ The answer is quite clear. It transfers always 4 8-bit words, and it is up to the program to decide what is useful. I guess, the extra unneeded 8-bit words can come from many sources depending on what the bus is used for, including random information left over in a register, or whather bytes followed the interesting one in memory. Can you confirm? $\endgroup$ – babou May 29 '15 at 10:55
  • 1
    $\begingroup$ @babou I would not use the word 'random' since a properly operating digital computer cannot do anything random. That is why I used the word 'invalid'. But, the data is invalid only from the point of view of the user--not from the point of view of the computer. So, yes, the invalid data can come from previous register use or other bytes in memory other than the one intended byte. $\endgroup$ – Emmett Redd May 29 '15 at 15:27
  • $\begingroup$ @babou D.W.'s comment was on the answer before I edited it. Your first comment came after. $\endgroup$ – Emmett Redd May 29 '15 at 17:41

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.