Menu

Parts of the CPU

Memory Address Register

The Memory Address Register (MAR) is a register inside the CPU that holds an address: the number of the memory location the CPU is about to read from or write to. It always holds an address, never the instruction or data itself.

Where, not what

An address is the number that labels one memory location. The data is whatever is held inside that location: an instruction, or a value the program is working on. Every location in memory is the same apart from its address, so the CPU cannot fetch anything until it has put the right location number into the MAR.

For example, if a program's instructions start at location 500, the MAR holds 500 to fetch the first one and 501 to fetch the next. If the program then saves a high score, the MAR holds the address of the location where that score will be written.

Instructions or data

The location named by the MAR might contain an instruction, as it does during the fetch stage of the fetch-decode-execute cycle, or it might contain data the program is working on. The MAR does the same job either way: it stores the location, and nothing else.

MAR or MDR?

These two registers are easy to swap over. The Memory Data Register (MDR) holds the instruction or data that has just been read from memory, or the value waiting to be written to memory. So check what the value is: if it is a location number, it belongs in the MAR; if it is the contents of that location, it belongs in the MDR.

Practise this