In This Article
What is Accumulator?
An accumulator in reality refers to a register in the CPU or Central Processing Unit. This is actually a temporary storage that saves the intermediate values of the logical and mathematical calculations or an operation and overwrites them later when needed.
From a technical point of view, an accumulator, just like a special type of conventional register, is a design in the core of the CPU. When the computer performs multi-step operations, the intermediate results are sent here.
- Any computer system that uses only one memory to hold the values of multiple operations is considered to be an accumulator.
- The accumulator functions as a temporary storage space for the intermediate results of an operation.
- The accumulator register stores only a single operand and therefore consumes less memory space, shortens instructions and reduces save and read operations.
- This temporary storage expedites performance as it reduces the time for an instruction cycle to fetch from memory for simpler and shorter programs.
- The early computer systems were usually divided into two groups, those that had an accumulator and those that did not.
The accumulators are registers that store intermediate results of an operation, and their features may vary from one processor to another.
It improves the performance of the CPU dramatically by offering a scratchpad area to write the results of one operation and feed to the next with little or no performance consequences.
Written progressively, the previous value is overwritten in the accumulator which is why it is said that the accumulator holds the intermediate value.
For example, for the operation 3 + 4 + 5, the accumulator will store the result as follows:
- First 3
- Then 7 and
- Then 12.
When the final result is calculated, it is written in the main memory of the system or to any other register.
The advantage of an accumulator is that it helps in conserving data in the operation statement because it is not needed to be referenced explicitly.
And, the access time to it is much shorter in comparison to the main memory which is bigger.
For example, using an accumulator to calculate the basic weekly pay and placing the value in it will allow using it immediately afterwards to calculate income tax.
This eventually removes one read and save operation from the string.
This is extremely helpful for simple and short operations.
However, for more complex expressions, it increases the size of the programs because a lot of short instructions are used and need to be executed.
This increase in the number of instructions not only increased the memory size but, at the same time, made the execution time longer.
There are no accumulators in modern CPUs as such because these are now replaced by GPR or General Purpose Registers which provide more flexibility.
However, these registers also function just like an accumulator.
On the other hand, there may be some processors used for special purposes that still come with an accumulator.
Therefore, you cannot consider them to be obsolete, yet.
In the early days, the functions of the accumulators in the computers were fairly integral, offering a means to store intermediate values temporarily in scenarios where the processing needs were low.
For example, the ENIAC, or the Electronic Numerical Integrator And Computer, had more than a dozen accumulators built into it.
However, over time, with the development of cores, the use of accumulators became less extensive both in terms of design and semantic identity.
The newer architecture with its multi-core design and build used the registers mainly as the reference object in place of the accumulators.
What is the Function of an Accumulator?
The main function of the accumulator in the CPU of the computer is to store the intermediate results of an ALU operation temporarily to be used or read during the next operation in a multistep calculation.
Being a part of the ALU, this 8-bit register acts as storage for 8 bits of data and speeds up the calculation process of the 1-operand machines. It saves time by reducing the number of steps in the operations.
The accumulator also offers faster access to the data when it is needed by the CPU.
Typically, the main memory of the computer is larger in size and the technology used in it makes it pretty slow in comparison to the accumulator. Therefore, using an accumulator provides faster results.
By storing the first operand of the ALU, it acts as the default address while performing two basic types of operations namely:
- Data transfer operation – This process involves transferring data from the source to the destination. In read operations, data is transferred from the memory to the accumulator and for write operations data is transferred from the accumulator to the memory.
- ALU operation – This refers to the arithmetic operations or calculations performed on the data. Here, there is an operand and an instruction.
Another significant function of it is to provide an easy way to write and use the operands.
In the absence of this special register, the results of every calculation such as add, multiply, shift and others would be required to be written to the main memory to be read again during the subsequent operation.
And, finally, the accumulator is the only register in a CPU organization that can perform the shift function.
Therefore, this register performs some vital functions to enhance the performance of the ALU and the CPU as a whole.
What is an Accumulator in ALU?
The accumulator in ALU is a register that stores the results of the operation temporarily for the following operation to read it.
Ideally, there are four functional blocks in a processor. All these blocks use registers and are usually attached to the internal data bus.
The fourth is the accumulator, which is pretty much the same as a General Purpose Register.
During the processing cycle, this specific register stores only one of the two operands used in an ALU operation. The other operand will be stored in the GPR or the memory.
While carrying out the specific operation, both of these are served to the ALU as input to produce the final result.
As said earlier, this final output is first fed back to the accumulator and then to the main memory when the control unit gives such an instruction.
The accumulator of a CPU is the register that is used as short-term storage for the arithmetic and logic data in the interim.
Though it is not used extensively in the processors today having been replaced by the more flexible general purpose registers, it is still found in special purpose CPUs to expedite the outcome.