In a computer CPU, an accumulator is a register in which intermediate arithmetic and logic 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.
Modern CPUs usually have many registers, all or many of which may be capable of being used for calculations. The characteristic which distinguishes one register as being the accumulator of a computer architecture is that the accumulator (if the architecture were to have one) would be used as an implicit operand for arithmetic instructions. For instance, a computer might have an instruction like:
ADD memaddress
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 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 in 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.
Posted By: Partial Angler, Oct 19, 17:56:20
Written & Designed By Ben Graves 1999-2025