Memory Address and Data Registers
You'll learn how the CPU uses two special registers—MAR and MDR—to talk to main memory.
The Bridge Between CPU and Memory
When your CPU needs to read or write data in main memory (RAM), it can't just magically teleport information back and forth. It needs a clear protocol, like addressing a letter before mailing it. Two specialized registers handle this job: the Memory Address Register (MAR) and the Memory Data Register (MDR).
Memory Address Register (MAR)
The MAR holds the address of the memory location the CPU wants to access. Think of it like writing down a house number before sending a delivery truck—the MAR tells the memory system where to go.
When the CPU wants to read from or write to memory, it first loads the target address into the MAR. This address then travels along the address bus to main memory.
Memory Data Register (MDR)
The MDR holds the actual data being transferred. It's a two-way holding area:
- During a read: Memory places the data from the requested address into the MDR, and the CPU retrieves it from there
- During a write: The CPU places data into the MDR, which then gets written to the address specified in the MAR
It's like the delivery truck's cargo hold—on pickup (read), it receives goods from the house; on delivery (write), it drops off goods at the house.
Working Together
These registers always work as a pair. The MAR says "where," the MDR carries "what." This separation keeps the CPU organized and allows the memory system to operate independently once it receives its instructions.
Key Takeaway: The MAR holds memory addresses for access locations, while the MDR holds the actual data being transferred—together they form the essential communication link between CPU and RAM.