All Topics  
Accumulator (computing)

 

   Email Print
   Bookmark   Link






 

Accumulator (computing)



 
 
In a computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
's central processing unit (CPU
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
), an accumulator is a register
Processor register

In computer architecture, a processor register is a small amount of Computer storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere....
 in which intermediate arithmetic and logic
Arithmetic logic unit

In computing, an arithmetic logic unit is a digital circuit that performs arithmetic and logicaloperations. The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers....
 results are stored. Without a register like an accumulator, it would be necessary to write the result of each calculation (addition, multiplication, shift, etc.) 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 (but cheaper) than that used for a register.

The canonical example for accumulator use is summing a list of numbers.






Discussion
Ask a question about 'Accumulator (computing)'
Start a new discussion about 'Accumulator (computing)'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In a computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
's central processing unit (CPU
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
), an accumulator is a register
Processor register

In computer architecture, a processor register is a small amount of Computer storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere....
 in which intermediate arithmetic and logic
Arithmetic logic unit

In computing, an arithmetic logic unit is a digital circuit that performs arithmetic and logicaloperations. The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers....
 results are stored. Without a register like an accumulator, it would be necessary to write the result of each calculation (addition, multiplication, shift, etc.) 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 (but cheaper) than that used for a register.

The canonical example for accumulator use is summing a list of numbers. The accumulator is initially set to zero, then each number in turn is added to the value in the accumulator. Only when all numbers have been added is the result held in the accumulator written to main memory or to another, non-accumulator, CPU register.

An accumulator machine, also called a 1-operand machine, or a CPU with accumulator-based architecture, is a kind of CPU in which -- although it may have several registers -- the CPU always stores the results of most calculations in one special register -- typically called "the" accumulator of that CPU. Historically almost all early computers were accumulator machines; and many microcontroller
Microcontroller

A microcontroller is a small computer on a single integrated circuit consisting of a relatively simple CPU combined with support functions such as a crystal oscillator, timers, watchdog, serial and analog I/O etc....
s still popular as of 2008 (such as the Freescale 68HC12
Freescale 68HC12

The 68HC12 is a 16-bit microcontroller family from Freescale Semiconductor. Originally introduced in the mid 1990s, the architecture is an enhancement of the Freescale 68HC11....
 and the PICmicro) are accumulator machines.

Modern CPUs are typically 2-operand or 3-operand machines -- the additional operands specify which one of many general purpose registers (also called "general purpose accumulators") 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
Computer architecture

Computer architecture in computer engineering is the conceptual design and fundamental operational structure of a computer system. It is a blueprint and functional description of requirements and design implementations for the various parts of a computer, focusing largely on the way by which the central processing unit performs internally an...
 is that the accumulator (if the architecture were to have one) would be used as an implicit operand
Operand

An operand is one of the inputs of an operator in mathematics. The following arithmetic expression shows an example of operators and operands:...
 for arithmetic instruction
Instruction (computer science)

In computer science, an instruction is a single operation of a central processing unit defined by an instruction set architecture. In a broader sense, an "instruction" may be any representation of an element of an executable program, such as a bytecode....
s. For instance, a CPU might have an instruction like:

ADD memaddress
Memory address

In computer science, a memory address is an identifier for a computer memory location, at which a computer program or a hardware device can store a piece of data and later retrieve it....


This instruction would add the value read from the memory location at memaddress to the value from the accumulator, placing the result in the accumulator. The accumulator is not identified in the instruction by a register number; it is implicit
Addressing mode

Addressing modes are an aspect of the instruction set architecture in most central processing unit designs. The various addressing modes that are defined in a given instruction set architecture define how Machine code Instruction in that architecture identify the operand of each instruction....
 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.

In the common x86 microprocessor architecture, the 32-bit EAX register (or one of its subcomponents AX or AL, or part or all of the separate 32-bit EDX register for multiplication of large numbers) is an accumulator in some arithmetic instructions, such as MUL and DIV, but in other arithmetic instructions EAX is one of several registers that can be specified. For instance, MUL ecx will multiply the contents of 32-bit register ECX by those of EAX and split the result between EAX and EDX (for 64 bits total, avoiding overflow). ADD, however, accepts two arguments: ADD ecx, edx will add ECX and EDX and place the result in ECX, and likewise for most registers.

History of the computer accumulator

Historical convention dedicates a register to "the accumulator", an "arithmetic organ" that literally accumulates its number during a sequence of arithmetic operations:

"The first part of our arithmetic organ ... should be a parallel storage organ which can receive a number and add it to the one already in it, which is also able to clear its contents and which can store what it contains. We will call such an organ an Accumulator. It is quite conventional in principle in past and present computing machines of the most varied types, e.g. desk multipliers, standard IBM counters, more modern relay machines, the ENIAC" (Goldstine and von Neumann, 1946; p. 98 in Bell and Newell 1971).


Just a few of the instructions are, for example (with some modern interpretation):
  • Clear accumulator and add number from memory location x
  • Clear accumulator and subtract number from memory location x
  • Add number copied from memory location x to the contents of the accumulator
  • Subtract number copied from memory location x from the contents of the accumulator
  • Clear accumulator and shift contents of register into accumulator


No convention exists regarding the names for operations from registers to accumulator and from accumulator to registers. Tradition (e.g. Donald Knuth
Donald Knuth

Donald Ervin Knuth is a renowned computer science and Emeritus of the Art of Computer Programming at Stanford University.Author of the seminal multi-volume work The Art of Computer Programming , Knuth has been called the "father" of the run-time analysis, contributing to the development of, and systematizing formal mathematical techn...
's (1973) imaginary MIX
MIX

MIX is a hypothetical computer used in Donald Knuth’s monograph, The Art of Computer Programming . MIX’s model number is 1009, which was derived by combining the model numbers and names of several contemporaneous, commercial machines deemed significant by the author....
 computer), for example, uses two instructions called LOAD ACCUMULATOR from memory/register (e.g. "LDA r") and STORE ACCUMULATOR in register/memory (e.g. "STA r"). Knuth's model has many other instructions as well.