Skip to content
BetterDL

Memory address register (MAR)

Also called: memory address reg

The CPU register that holds the address of the memory word being read or written. Its width equals the number of address bits.

The MAR is the CPU's "where" register for memory. Memory's address input is wired to it and nothing else, so any memory access starts by putting an address in the MAR.

In Tiny8 it's loaded from one of two places, chosen by a multiplexer:

  • from the PC in step F1, to fetch an instruction;
  • from the IR's address field in step D, to reach an operand.

Its partner is the MDR, the "what" register: the data word read or about to be written. Together they're the CPU's only connection to memory.

Sizing rule: the MAR holds an address, so its width is the number of address bits. A memory of N words needs ⌈log₂ N⌉ bits. Tiny8 has 16 words, so its MAR is 4 bits. The MAR's width has nothing to do with the word size; that sets the MDR.

Why a separate register at all? The address must stay steady for the whole read or write. Holding it in the MAR keeps it still while the PC moves on.

Worked example

Example

Sizing the MAR and MDR

A machine has 8192 words of memory, each 32 bits wide.

  1. 1.

    Address bits: 2¹³ = 8192, so 13.

  2. 2.

    MAR: 13 bits, because it holds an address.

  3. 3.

    MDR: 32 bits, because it holds a whole word.

  4. 4.

    The two widths are independent. Doubling the word size changes the MDR only.

Common mistakes

  • Sizing the MAR by the word size. That's the MDR.

  • Reading memory in the same step that loads the MAR. The address only reaches the MAR at that edge, so the read comes one step later.

Practice Memory address register (MAR)

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Memory address register (MAR) is taught in Basic CPU / Computer Architecture and Memory.