askvity

What is the difference between MDR and MAR?

Published in Computer Architecture 2 mins read

The core difference between the MDR (Memory Data Register) and the MAR (Memory Address Register) lies in their function during memory access within a computer system: the MAR holds the address of the memory location being accessed, while the MDR holds the data being transferred to or from that memory location.

In-Depth Explanation

Think of it like sending a letter. The MAR is like the address you write on the envelope – it specifies where the letter needs to go. The MDR is like the letter itself – it contains the information you want to send.

Here's a more detailed breakdown:

  • Memory Address Register (MAR):

    • Function: Stores the memory address to be accessed. The CPU needs to specify which location in memory it wants to read from or write to. This address is loaded into the MAR.
    • Analogy: The house number and street name of a recipient's address.
    • Example: If the CPU wants to read data from memory location 1000, the value 1000 is placed in the MAR.
    • Purpose: Directs the memory controller to the correct location in RAM.
  • Memory Data Register (MDR):

    • Function: Holds the data being transferred between the CPU and the memory location specified by the MAR. When reading from memory, the data at the MAR address is loaded into the MDR. When writing to memory, the data in the MDR is written to the memory location specified by the MAR.
    • Analogy: The contents of the letter you are sending or receiving.
    • Example: If the CPU reads from memory location 1000 and the value stored there is 25, then 25 will be placed in the MDR. If the CPU wants to write the value 75 to memory location 1000, then 75 is placed into the MDR and the MAR holds 1000.
    • Purpose: Acts as a buffer, holding the data being read or written, allowing the CPU and memory to operate at different speeds.

Summary

In essence, the MAR tells where in memory to go, and the MDR carries the actual information to or from that location. They work together as key components of the memory access process.

Related Articles