Accumulator (computing)


In a computer's central processing unit, the accumulator is a register in which :wikt:intermediate|intermediate arithmetic and logic results are stored.
Without a register like an accumulator, it would be necessary to write the result of each calculation to main memory, perhaps only to be read right back again for use in the next operation. Access to main memory is slower than access to a register like the accumulator because the technology used for the large main memory is slower than that used for a register. Early electronic computer systems were often split into two groups, those with accumulators and those without.
Modern computer systems often have multiple general purpose registers that operate as accumulators, and the term is no longer as common as it once was. However, a number of special-purpose processors still use a single accumulator for their work to simplify their design.

Basic concept

Mathematical operations often take place in a stepwise fashion, using the results from one operation as the input to the next. For instance, a manual calculation of a worker's weekly payroll might look something like:
  1. look up the number of hours worked from the employee's time card
  2. look up the pay rate for that employee from a table
  3. multiply the hours by the pay rate to get their basic weekly pay
  4. multiply their basic pay by a fixed percentage to account for income tax
  5. subtract that number from their basic pay to get their weekly pay after tax
  6. multiply that result by another fixed percentage to account for retirement plans
  7. subtract that number from their basic pay to get their weekly pay after all deductions
A computer program carrying out the same task would follow the same basic sequence of operations, although the values being looked up would all be stored in computer memory. In early computers, the number of hours would likely be held on a punch card and the pay rate in some other form of memory, perhaps a magnetic drum. Once the multiplication is complete, the result needs to be placed somewhere. On a "drum machine" this would likely be back to the drum, an operation that takes considerable time. And then the very next operation has to read that value back in, which introduces another considerable delay.
Accumulators dramatically improve performance in systems like these by providing a scratchpad area where the results of one operation can be fed to the next one for little or no performance penalty. In the example above, the basic weekly pay would be calculated and placed in the accumulator, which could then immediately be used by the income tax calculation. This removes one save and one read operation from the sequence, operations that generally took tens to hundreds of times as long as the multiplication itself.

Accumulator machines

An accumulator machine, also called a 1-operand machine, or a CPU with accumulator-based architecture, is a kind of CPU where, although it may have several registers, the CPU mostly stores the results of calculations in one special register, typically called "the accumulator". Almost all early computers were accumulator machines with only the high-performance "supercomputers" having multiple registers. Then as mainframe systems gave way to microcomputers, accumulator architectures were again popular with the MOS 6502 being a notable example. Many 8-bit microcontrollers that are still popular as of 2014, such as the PICmicro and 8051, are accumulator-based machines.
Modern CPUs are typically 2-operand or 3-operand machines. The additional operands specify which one of many general purpose registers are used as the source and destination for calculations. These CPUs are not considered "accumulator machines".
The characteristic which distinguishes one register as being the accumulator of a computer architecture is that the accumulator would be used as an implicit operand for arithmetic instructions. For instance, a CPU might have an instruction like: ADD memaddress that adds the value read from memory location memaddress to the value in the accumulator, placing the result back in the accumulator. The accumulator is not identified in the instruction by a register number; it is implicit in the instruction and no other register can be specified in the instruction. Some architectures use a particular register as an accumulator in some instructions, but other instructions use register numbers for explicit operand specification.

History of the computer accumulator

Any system that uses a single "memory" to store the result of multiple operations can be considered an accumulator. J. Presper Eckert refers to even the earliest adding machines of Gottfried Leibniz and Blaise Pascal as accumulator-based systems. Percy Ludgate was the first to conceive a multiplier-accumulator in his Analytical Machine of 1909.
Historical convention dedicates a register to "the accumulator", an "arithmetic organ" that literally accumulates its number during a sequence of arithmetic operations:
Just a few of the instructions are, for example :
No convention exists regarding the names for operations from registers to accumulator and from accumulator to registers. Tradition, for example, uses two instructions called load accumulator from register/memory and store accumulator to register/memory. Knuth's model has many other instructions as well.

Notable accumulator-based computers

The 1945 configuration of ENIAC had 20 accumulators, which could operate in parallel. Each one could store an eight decimal digit number and add to it a number it received. Most of IBM's early binary "scientific" computers, beginning with the vacuum tube IBM 701 in 1952, used a single 36-bit accumulator, along with a separate multiplier/quotient register to handle operations with longer results. The IBM 650, a decimal machine, had one 10 digit distributor and two ten-digit accumulators; the IBM 7070, a later, transistorized decimal machine had three accumulators. The IBM System/360, and Digital Equipment Corporation's PDP-6, had 16 general purpose registers, although the PDP-6 and its successor, the PDP-10, call them accumulators.
The 12-bit PDP-8 was one of the first minicomputers to use accumulators, and inspired many later machines. The PDP-8 had but one accumulator. The HP 2100 and Data General Nova had 2 and 4 accumulators. The Nova was created when this follow-on to the PDP-8 was rejected in favor of what would become the PDP-11. The Nova provided four accumulators, AC0-AC3, although AC2 and AC3 could also be used to provide offset addresses, tending towards more generality of usage for the registers. The PDP-11 had 8 general purpose registers, along the lines of the System/360 and PDP-10; most later CISC and RISC machines provided multiple general purpose registers.
Early 4-bit and 8-bit microprocessors such as the 4004, 8008 and numerous others, typically had single accumulators. The 8051 microcontroller has two, a primary accumulator and a secondary accumulator, where the second is used by instructions only when multiplying or dividing ; the former splits the 16-bit result between the two 8-bit accumulators, whereas the latter stores the quotient on the primary accumulator A and the remainder in the secondary accumulator B. As a direct descendant of the 8008, the 8080, and the 8086, the modern ubiquitous Intel x86 processors still uses the primary accumulator EAX and the secondary accumulator EDX for multiplication and division of large numbers. For instance, MUL ECX will multiply the 32-bit registers ECX and EAX and split the 64-bit result between EAX and EDX. However, MUL and DIV are special cases; other arithmetic-logical instructions may specify any of the eight registers EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI as the accumulator. This is also supported for multiply if the upper half of the result is not required. x86 is thus a fairly general register architecture, despite being based on an accumulator model. The 64-bit extension of x86, x86-64, has been further generalized to 16 instead of 8 general registers.