Tuesday, July 03, 2007

Accumulator

In a computer CPU, an accumulator is a register in which intermediary 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, possibly 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 huge main memory is slower (but cheaper) than that used for a register.

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

No comments: