Memory address register
The memory address register (MAR), also known as the address buffer, is a specialized register within the central processing unit (CPU) of a computer that temporarily holds the memory address of the location from which data or instructions are to be read or to which they are to be written.[1] In the von Neumann architecture, the foundational model for most modern computers, the MAR plays a critical role in the fetch-decode-execute cycle by receiving addresses from the program counter (PC) or other sources, such as effective addresses for operands, and driving these addresses onto the address bus to access random access memory (RAM) or read-only memory (ROM).[2][1] The MAR interacts closely with the memory data register (MDR), where the MAR specifies the target memory location while the MDR handles the actual transfer of data to or from that location, enabling efficient read and write operations.[1] For instance, during a memory read operation, the desired address is loaded into the MAR, a read signal is sent to the memory unit, and the requested data is then placed into the MDR for processing by the CPU.[2] The bit width of the MAR determines the maximum addressable memory space—for example, a 16-bit MAR can address up to 65,536 unique locations—directly influencing the system's memory capacity and supporting various addressing modes such as direct, indirect, indexed, or base-relative addressing.[1] This register's design ensures precise and rapid memory access, forming an essential component of the processor's interface with main memory in both historical and contemporary computer architectures.[3]Introduction
Definition and Purpose
The Memory Address Register (MAR) is a special-purpose register within the central processing unit (CPU) that temporarily holds the memory address indicating the specific location in random access memory (RAM) or other memory devices from which data is to be read or to which data is to be written.[3][4] This register ensures that memory operations target the precise address required by the current instruction, preventing errors in data retrieval or storage. The primary purpose of the MAR is to facilitate access to specific memory locations by supplying the address to the memory unit, thereby serving as a critical interface between the processor and the memory subsystem.[3] By latching the address during a memory cycle, it allows the CPU to coordinate read or write actions efficiently, enabling seamless execution of programs that rely on stored instructions and data. The MAR works alongside the Memory Data Register (MDR) to complete these operations, where the MAR handles addressing while the MDR manages data transfer.[3] Key characteristics of the MAR include its typical integration as part of the CPU's control unit, which orchestrates overall processor operations.[2] In many designs, it operates unidirectionally, outputting addresses solely to the memory via the address bus without receiving data in return.[5] Additionally, the MAR's bit width aligns with the system's address bus to support the full range of addressable memory; for instance, it is 32 bits wide in systems addressing up to 4 gigabytes or 64 bits in modern architectures capable of addressing vastly larger spaces.[5] As an example, in a basic CPU design, the MAR might receive an address directly from the program counter for fetching the next instruction or from an operand field in the current instruction for data access, holding that address stable throughout the ensuing memory cycle to ensure reliable transfer.[3]Historical Development
The concept of the memory address register (MAR) emerged in the mid-1940s as a fundamental component of stored-program computers, enabling the central processing unit to specify locations in a shared memory for instructions and data. John von Neumann's 1945 "First Draft of a Report on the EDVAC" outlined the stored-program architecture, describing mechanisms for the CPU to access memory locations for reading or writing operations, which laid the groundwork for dedicated address-handling registers like the MAR.[6] This design addressed the need for efficient access in systems where programs and data resided in the same addressable memory space, laying the groundwork for von Neumann-style computing. By 1949, early implementations appeared in pioneering stored-program machines. The Manchester Mark 1, an advancement from the 1948 "Baby" computer, introduced index registers (B-lines) to modify addresses dynamically, building on basic address storage mechanisms required for instruction fetching and execution. Similarly, the EDSAC at the University of Cambridge, operational in the same year, used control logic and binary counters to specify addresses for its mercury delay-line memory access, later incorporating index registers to enhance addressing flexibility. These systems demonstrated the practical necessity of dedicated address handling in real-time computing tasks. Key milestones in the 1950s and 1960s formalized explicit MAR hardware in commercial designs. The IBM 701, introduced in 1952 as one of the first production scientific computers, featured an address register within its instruction structure—a 12-bit component combining a trigger register and binary counter for memory addressing in its electrostatic storage tubes.[7] This evolved further in minicomputers like the DEC PDP-8 (1965), which included a dedicated 12-bit Memory Address (MA) register to select locations across its core memory banks, supporting up to 4K words initially and enabling widespread use in embedded applications.[8] The 1970s brought integration into microprocessors, with the MOS Technology 6502 (1975) embedding address generation circuitry—functionally equivalent to a MAR—onto a single chip, driving its 16-bit address bus for 64 KB access in cost-effective systems.[9] By the 1980s, the MAR became integral to reduced instruction set computing (RISC) architectures, such as MIPS (initiated in 1981), where it supported load/store operations in a register-rich design optimized for pipelining.[10] Extensions for virtual addressing appeared in processors like the Intel 80386 (1985), where the memory management unit translates 32-bit virtual addresses to physical addresses that are then loaded into the MAR for access to up to 4 GB of physical memory space.[11]Functionality
Role in Memory Operations
In memory read operations, the Memory Address Register (MAR) is loaded with the target memory address, which is then placed on the address bus to select the specific location in memory.[12] The control unit asserts a read enable signal, prompting the memory to retrieve the data from that address and transfer it to the Memory Data Register (MDR) without any modification to the contents of the MAR during this process.[5] This ensures that the address remains stable, allowing the memory module to accurately decode and access the intended location.[13] For memory write operations, the MAR holds the destination address, which is driven onto the address bus to identify the target location.[12] The data to be stored, sourced from the MDR, is simultaneously placed on the data bus, and the control unit activates a write enable signal to instruct the memory to store the data at the address specified by the MAR.[5] During the write, the MAR content is not altered, maintaining address integrity throughout the transfer.[13] The timing and control of MAR involvement in these operations are governed by memory control signals such as read/write enable and memory enable, synchronized to the system clock to ensure stable address presentation on the bus.[14] These signals dictate the direction of data flow and the duration of the access cycle, with the MAR required to hold its value steadily until the operation completes, which may span one or more clock cycles in synchronous designs depending on the architecture and memory subsystem.[5] Invalid memory addresses, such as those resulting from calculation overflow when loaded into the MAR, can trigger hardware-detected exceptions like bus errors or OS-handled faults such as segmentation faults or page faults, depending on the system architecture.[15]Interaction with CPU Components
The Memory Address Register (MAR) receives memory addresses from the Program Counter (PC) during the instruction fetch phase, where the PC maintains the location of the next instruction in memory.[16] This transfer occurs via internal data paths controlled by timing signals, ensuring the MAR holds the precise address for accessing the instruction from primary memory.[17] Following the fetch, the MAR links to the Instruction Register (IR) by loading addresses decoded from the instruction stored in the IR, particularly for operations requiring operand access from memory.[18] These addresses, often derived from the instruction's opcode or operands, are routed to the MAR to initiate subsequent memory reads, supporting the execution of instructions that reference external data.[19] The MAR integrates indirectly with the Arithmetic Logic Unit (ALU) by providing memory addresses for operands needed in computations, allowing data fetched via the MAR to reach ALU inputs through intermediate registers like the Memory Data Register (MDR).[17] This address specification enables the ALU to perform operations on memory-sourced values without direct MAR-ALU wiring, relying instead on the processor's data path for operand delivery.[16] In bus interactions, the MAR outputs addresses to the unidirectional address bus to drive memory selection, while it accepts inputs from internal buses that convey addresses from general-purpose registers or immediate values encoded directly in instructions.[1] These bidirectional internal connections facilitate flexible addressing modes, such as register-indirect or immediate-offset, enhancing the CPU's ability to handle diverse memory references.[18] The control unit oversees MAR operations by generating latching signals to load addresses into the MAR and unlatching signals to transfer them to the address bus, implemented either via hardwired combinatorial logic for fixed sequences or microprogrammed sequences for configurable control.[20] These signals synchronize MAR activity with the processor clock, ensuring precise timing in data flows across CPU components.[21] Such coordination forms a key part of the fetch-execute cycle in von Neumann architectures.[22]Technical Aspects
Structure and Implementation
The Memory Address Register (MAR) is typically implemented as a parallel-in, parallel-out register composed of D flip-flops, one for each address bit, to synchronously latch the memory address on the rising edge of the clock signal. This structure ensures stable address holding during memory access cycles, with each flip-flop providing temporary storage for a single bit while the overall register supports parallel loading from sources like the program counter or arithmetic logic unit. In VLSI designs, such as those using 90 nm CMOS processes, the MAR integrates into the processor's memory unit as part of a latch array, operating at speeds up to 200 MHz under a 1.2 V supply to facilitate high-performance RAM addressing via decoders.[23] The width of the MAR directly corresponds to the system's addressable memory space, as the number of bits determines the maximum number of unique locations that can be addressed. For instance, a 16-bit MAR, common in early microprocessors like the MOS Technology 6502, supports up to 65,536 bytes (64 KB) of memory.[24] In contrast, contemporary 64-bit systems employ a 64-bit MAR to address up to 2^64 bytes, or approximately 16 exabytes, aligning with the address bus width to enable efficient, contention-free transfers without additional segmentation.[25] Implementation in modern VLSI chips often incorporates the MAR as a special-purpose register, utilizing multiplexers to select and route addresses from multiple CPU sources, such as instruction decoding outputs or branch targets, thereby optimizing control flow and reducing wiring complexity. Decoders and enable signals further manage read/write operations to the MAR, ensuring precise synchronization. Performance considerations emphasize minimal latency in address latching and decoding; for example, edge-triggered flip-flops in the MAR contribute to access times under 2.5 ns in static RAM-integrated designs, though larger systems must account for propagation delays in address decoding paths that can extend to several clock cycles.[26][27]Operation in Instruction Cycle
In the fetch phase of the CPU's instruction cycle, the program counter (PC) loads the memory address of the next instruction into the memory address register (MAR), which then drives the address bus to retrieve the instruction from memory and store it in the instruction register (IR).[28][29] This step ensures the processor accesses the correct location in main memory, typically using the MAR's output to select the word-addressable unit.[28] During the decode phase, the control unit examines the instruction in the IR; if the instruction involves memory operands, such as in load or store operations, it calculates the effective address—often by adding a base register value to an offset from the instruction—and loads this into the MAR for subsequent access.[30][28] This preparation allows the MAR to hold the precise operand address without redundant memory fetches.[29] In the execute phase, for load or store instructions, the MAR retains the operand address to facilitate data transfer between memory and the memory data register (MDR), enabling operations like addition or data movement.[28] For branch or jump instructions, the MAR may temporarily hold the target address before it updates the PC, directing the flow of execution.[30] Upon cycle completion, the MAR is typically cleared or updated to reflect the next required address, and in cases of interruptions, its state may be preserved to maintain program continuity.[29] A representative example is the load instruction (LDA addr), where the MAR first holds the PC value during fetch to retrieve the instruction, then receives the computed effective address (addr) in decode and execute phases to load the operand into the accumulator.[28][30]Comparisons and Variations
MAR versus Memory Data Register
The Memory Address Register (MAR) and Memory Data Register (MDR) serve complementary yet distinct functions in computer architecture, with the MAR exclusively managing memory addresses to specify locations for data access, while the MDR handles the actual data payloads transferred to or from those locations. The MAR operates unidirectionally, outputting the address via the address bus to select the target memory cell, whereas the MDR is bidirectional, enabling data to flow in both directions—receiving data during reads and providing it during writes—over the data bus. This separation ensures efficient memory operations by isolating location control from content transfer, a design principle fundamental to the von Neumann architecture.[31][32] In typical memory operations, the MAR precedes the MDR in the data flow sequence: the address is first loaded into the MAR to initiate access to the specified memory location, after which the MDR facilitates the subsequent movement of data between the memory and the processor. For instance, during a memory read cycle, the MAR sets the location by driving the address onto the bus, prompting the memory to retrieve the data, which is then latched into the MDR for transfer to the CPU; conversely, in a write cycle, the MAR first establishes the location, followed by the MDR supplying the data payload to be stored. Both registers act as temporary buffers to synchronize these transfers, often matching the width of their respective buses—typically the address bus for the MAR and the data bus for the MDR—and responding to shared control signals like clock pulses or enable lines for timing coordination.[31][32]| Aspect | Memory Address Register (MAR) | Memory Data Register (MDR) |
|---|---|---|
| Primary Function | Holds and outputs memory address for location selection | Holds and transfers data payload for read/write operations |
| Directionality | Unidirectional (output to address bus) | Bidirectional (input/output via data bus) |
| Role in Data Flow | Initiates access by specifying location first | Follows MAR to handle data exchange |
| Typical Width | Matches address bus (e.g., number of addressable locations) | Matches data bus (e.g., word size like 32 or 64 bits) |
| Control Signals | Load address, enable output | Load data, read/write enable |