I am looking for an answer regarding the CPU read and write. We know there are two clocks that are working in the computer system, one is the peripheral clock and the other is the CPU own clock on which its control systems are working. I am familiar with the clock domain crossing but I dont understand how the CPU read and write data working on different clocks. For example the CPU sends the data to be written on the data bus and address on the address bus. Since the rest of the peripherals are working on their own clocks such as PCI or other standards, Now the CPU which is working on its own clock will execute the next instruction send the address again on the address bus and the data on the data bus to the same peripheral but data bits have still not been read by the peripheral so doesnt the data will be lost in this process or is there any mechanism of handling this situation ?

  • $\begingroup$ Clock domain crossings are complex, and waste several cycles for recsynchronizing. If the peripheral is seldom used, the CPU will waste many cycles, but not often. If you need performance, you will have to store data in double-port RAMs and FIFOs where blocks of data enters at one frequency and exits at another. $\endgroup$ – TEMLIB Jul 31 '17 at 20:03

That's why buffers are used.

While the transfer is in progress the peripheral writes the data into a buffer and the cpu ignores it and just works on its own clock.

Then when the transfer to the buffer is complete the peripheral will issue an interrupt (or other toggle a transfer complete pin) and the cpu will read from the buffer and if applicable let the next transfer start.

The buffer used can be the RAM this is often referred to as Direct Memory Access. The peripheral is attached to the memory bus and can issue reads and writes to ram directly.


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.