Andy Glew's comp-arch.net wiki, http://semipublic.comp-arch.net

If you are reading this elsewhere, e.g. at site waboba.info, it is an unauthorized copy, and probably a malware site.
comp-arch.net wiki on hold from October 17, 2011

Accumulators

From CompArch

Jump to: navigation, search

Contents

The Prototypical Accumulator

The prototypical accumulator is the combination of a register with an adder (or an ALU in general). Typically, the output of the adder is directed to the accumulator register, and the accumulator register supplies one of the inputs of the adder. (Possibly through a MUX, so that other possible inputs can be provided.) Typically, a separate operation must be used to transfer values between the accumulator and other data locations, such as other (non-accumulator) registers or memory.

A slight generalization is to have a single adder/ALU in association with more than one accumulator registers.

What differentiates such a single ALU / multiple accumulator configuration from an ALU in association with a large register file?

  • Number - typically accumulators are few, 1, 2, 4, 8, while registers are many
  • Technology - registers are many enough to be in a special array, whereas accumulators are often implemented as flip flop logic, not in an array

But more importantly

  • Generality and Asymmetry in the instruction set

Accumulators are typically used in instruction sets with the source-destination format, e.g.

Accumulator += Operand

e.g.

Accumulator += Memory
Accumulator += General Purpose Register
Accumulator += Constant

or even

Accumulator += Some Other Accumulator

whereas general purpose registers may be used more generically, e.g. in the 3-operand, non-source-destination format

regDst := regSrc1 + regSrc2

Moreover, accumulators are often special purpose, and cannot be used wherever a register operand may be needed. E.g. an accumulator may not be allowed in a memory address at all, or not as a base register, only as an index register.

The x86 architecture provides an example of evolution from an accumulator based architecture to a GPR architecture. The early 8080 (from wikipedia):

 The processor had seven 8-bit registers, (A, B, C, D, E, H, and L) where A was the 8-bit accumulator and the other six could be used as either byte-registers or as three 16-bit register pairs (BC, DE, HL) depending on the particular instruction. Some instructions also enabled HL to be used as (a limited) 16-bit accumulator.
 ...
 Most 8-bit operations could only be performed on the 8-bit accumulator (the A register). 

The 8080 instructions were very short, typically 1 byte. Having the implicit accumulator operand permitted this compact encoding. 8086 registers AX, BX, CX, DX were called accumulators, while SI, DI, BP, SP were used for memory addressing, but even by this time the registers were much more uniform than in the 8080. By the 80386 these registers were nearly completely uniform, usable in all operands of all instructions, with minor exceptions.

Accumulators in Modern Machines

Most modern machines, as of 2010, do not really have accumulators. Rather, they have registers, general purpose registers to a large degree.

However, the accumulator concept occasionally re-surfaces

  • as a way of compacting instructions, particularly for wide VLIW
  • as a way of simplifying bypass logic
  • in aid of high speed or simplified hardware design

FMA vs. FMAC

The other place where the term "accumulator" crops up is in FMAC instructions.

FMA
Floating Point Multiply Add
or Fused Multiply Add
FMAC
Floating Point Multiply Accumulate

also, non-floating point

MAC
Multiply Accumulate

However, the dual "Multiply Add" is seldom if ever abbreviated MA, in my experience.

These terms "FMA" and "FMAC" are used almost interchangeably. I know that I, myself, when working as a computer architect at Intel and AMD, often used the term FMAC to describe what I perhaps should have called FMA according to pedantic rules below:

For example, ARM:

The FMAC instruction calculates Fd  + Fn  * Fm  and places the result in Fd.
The FNMAC instruction calculates Fd – Fn * Fm and places the result in Fd.
The FMSC instruction calculates –Fd + Fn * Fm and places the result in Fd.
The FNMSC instruction calculates –Fd – Fn * Fm and places the result in Fd.

where FMAC = as expected, FNMAC = negative multiply and accumulate. The final "C" in FMSC and FNMSC seems to be stylistic.

Sun SPARC uses FMA to refer to a fused multiply add, and FMAC to refer to a multiply add with an intermediate rounding. They say "floating point multiply-accumulate (FMA or FMAC) instructions", indicating a relaxed terminology.

When FMA/FMAC got added to the x86, original terminology was often FMAC, but it was officially FMA (fused multiply add) by the time it was added to Intel x86. However, many Intel compiler files look like www.intel.com/software/products/compilers/docs/fmac/doc_files/source/e. indicating the historic use of the term FMAC.

By the way, wikipedia describes the amusing evolution of FMA instructions between Intel and AMD, oscillating between FMA3 3 operand form ( d += a*b ) and FMA4 4 operand form ( d = a*b+c ). Arguably the FMA3 form is accumulator oriented, although almost solely as an instruction encoding technique, unrelated to other issues of wiring and control that have historically motivated accumulators. I.e. FMA3 is really an instruction with general purpose register operands that happens to have a combined src/dest operand because of instruction operand limitations, than a true accumulator architecture.

Superaccumulators

The historic, original, meaning of the term "accumulator" is maintained when there are special purpose registers, such as the superaccumulator of IBM's ACRITH instruction set. This superaccumulator is so special purpose, so different from other registers, in size, and in how it is specified by instructions.

Other "extended accumulators" often include extra wide registers to prevent overflow/underflow/saturation, etc.

Conclusion

If you hear the term "accumulator" ask yourself

  • is it a special purpose register, specially bound to an ALU
  • is it special wrt instruction encodings
  • or is the term accumulator just being used as a historical accident

?

See Also

Personal tools
No more shadowing