Data communication between CPU and memory
The Central Processing Unit(CPU) has a Memory Data Register (MDR) and a Memory Address Register (MAR). The Memory Data Register (MDR) keeps the data which is transferred between the Memory and the CPU. The Program Counter (PC) is a special register in the CPU which always keeps the address of the next instruction to be executed. The Arithmetic and Logic unit of CPU places the address of the memory to be fetched, into the Memory Address Register.
A bus is a collection of wires used for communication between the internal components of a computer. The address bus is used to point a memory location. A decoder, a digital circuit is used to point to the specific memory location where the word can be located. The address register is connected with the address bus, which provides the address of the instruction. A data bus is used to transfer data between the memory and the CPU. The data bus is bidirectional and the address bus is unidirectional. The control bus controls both read and write operations. The read operation fetches data from memory and transfers to MDR. A single control line performs two operations like Read/Write using 1or 0. Also, the write operation transfers data from the MDR to memory. This organization is shown in Figure 3.3.
The word in the RAM has the same size (no. of bits) as the Memory Data Register (MDR). If the processor is an 8-bit processor like Intel 8085, its MDR and the word in the RAM both have 8 bits.
If the size of the MDR is eight bits, which can be connected with a word in the memory which is also eight bits size. The data bus has eight parallel wires to transfer data either from MDR to word or word to MDR based on the control(Read or write). This control line is labeled as R/W , which becomes 1 means READ operation and 0 means WRITE operation. Figure 3.4 shows the content of MDR and the word before the READ operation.Also, Figure 3.5 shows the content of MDR and the word after the READ operation.
The read operation transfers the data(bits) from word to Memory Data Register. The write operation transfers the data(bits) from Memory Data Register to word.