HOME

TheInfoList



OR:

An adder, or summer, is a digital circuit that performs addition of numbers. In many computers and other kinds of
processor Processor may refer to: Computing Hardware * Processor (computing) **Central processing unit (CPU), the hardware within a computer that executes a program *** Microprocessor, a central processing unit contained on a single integrated circuit (I ...
s adders are used in the arithmetic logic units (ALUs). They are also used in other parts of the processor, where they are used to calculate
address An address is a collection of information, presented in a mostly fixed format, used to give the location of a building, apartment, or other structure or a plot of land, generally using political boundaries and street names as references, along ...
es, table indices, increment and decrement operators and similar operations. Although adders can be constructed for many number representations, such as binary-coded decimal or
excess-3 Excess-3, 3-excess or 10-excess-3 binary code (often abbreviated as XS-3, 3XS or X3), shifted binary or Stibitz code (after George Stibitz, who built a relay-based adding machine in 1937) is a self-complementary binary-coded decimal (BCD) cod ...
, the most common adders operate on binary numbers. In cases where
two's complement Two's complement is a mathematical operation to reversibly convert a positive binary number into a negative binary number with equivalent (but negative) value, using the binary digit with the greatest place value (the leftmost bit in big- endian ...
or
ones' complement The ones' complement of a binary number is the value obtained by inverting all the bits in the binary representation of the number (swapping 0s and 1s). The name "ones' complement" (''note this is possessive of the plural "ones", not of a sin ...
is being used to represent negative numbers, it is trivial to modify an adder into an adder–subtractor. Other
signed number representations In computing, signed number representations are required to encode negative numbers in binary number systems. In mathematics, negative numbers in any base are represented by prefixing them with a minus sign ("−"). However, in RAM or CPU regis ...
require more logic around the basic adder.


Binary adders


Half adder

The half adder adds two single binary digits ''A'' and ''B''. It has two outputs, sum (''S'') and carry (''C''). The carry signal represents an overflow into the next digit of a multi-digit addition. The value of the sum is . The simplest half-adder design, pictured on the right, incorporates an
XOR gate XOR gate (sometimes EOR, or EXOR and pronounced as Exclusive OR) is a digital logic gate that gives a true (1 or HIGH) output when the number of true inputs is odd. An XOR gate implements an exclusive or (\nleftrightarrow) from mathematical log ...
for ''S'' and an
AND gate The AND gate is a basic digital logic gate that implements logical conjunction (∧) from mathematical logic AND gate behaves according to the truth table. A HIGH output (1) results only if all the inputs to the AND gate are HIGH (1). If not al ...
for ''C''. The Boolean logic for the sum (in this case ''S'') will be whereas for the carry (''C'') will be ''AB''. With the addition of an
OR gate The OR gate is a digital logic gate that implements logical disjunction. The OR gate returns true if either or both of its inputs are true; otherwise it returns false. The input and output states are normally represented by different voltage lev ...
to combine their carry outputs, two half adders can be combined to make a full adder. The half adder adds two input bits and generates a carry and sum, which are the two outputs of a half adder. The input variables of a half adder are called the augend and addend bits. The output variables are the sum and carry. The
truth table A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional argumen ...
for the half adder is: :


Full adder

A full adder adds binary numbers and accounts for values carried in as well as out. A one-bit full-adder adds three one-bit numbers, often written as ''A'', ''B'', and ''C''in; ''A'' and ''B'' are the operands, and ''C''in is a bit carried in from the previous less-significant stage. The full adder is usually a component in a cascade of adders, which add 8, 16, 32, etc. bit binary numbers. The circuit produces a two-bit output. Output carry and sum typically represented by the signals ''C''out and ''S'', where the sum equals . A full adder can be implemented in many different ways such as with a custom
transistor upright=1.4, gate (G), body (B), source (S) and drain (D) terminals. The gate is separated from the body by an insulating layer (pink). A transistor is a semiconductor device used to Electronic amplifier, amplify or electronic switch, switch ...
-level circuit or composed of other gates. The most common implementation is with and The above expressions for and can be derived from using a
Karnaugh Map The Karnaugh map (KM or K-map) is a method of simplifying Boolean algebra expressions. Maurice Karnaugh introduced it in 1953 as a refinement of Edward W. Veitch's 1952 Veitch chart, which was a rediscovery of Allan Marquand's 1881 ''logi ...
to simplify the truth table. In this implementation, the final
OR gate The OR gate is a digital logic gate that implements logical disjunction. The OR gate returns true if either or both of its inputs are true; otherwise it returns false. The input and output states are normally represented by different voltage lev ...
before the carry-out output may be replaced by an
XOR gate XOR gate (sometimes EOR, or EXOR and pronounced as Exclusive OR) is a digital logic gate that gives a true (1 or HIGH) output when the number of true inputs is odd. An XOR gate implements an exclusive or (\nleftrightarrow) from mathematical log ...
without altering the resulting logic. This is because when A and B are both 1, the term is always 0, and hence can only be 0. Thus, the inputs to the final OR gate can never be both 1's (this is the only combination for which the OR and XOR outputs differ). Recall that due the Functional completeness property of the NAND and NOR gates, a full adder can also be implemented using nine NAND gates, or nine NOR gates . Using only two types of gates is convenient if the circuit is being implemented using simple integrated circuit chips which contain only one gate type per chip. A full adder can also be constructed from two half adders by connecting ''A'' and ''B'' to the input of one half adder, then taking its sum-output ''S'' as one of the inputs to the second half adder and ''C''in as its other input, and finally the carry outputs from the two half-adders are connected to an OR gate. The sum-output from the second half adder is the final sum output (''S'') of the full adder and the output from the OR gate is the final carry output (''C''out). The critical path of a full adder runs through both XOR gates and ends at the sum bit ''s''. Assumed that an XOR gate takes 1 delays to complete, the delay imposed by the critical path of a full adder is equal to :T_\text = 2 \cdot T_\text = 2 D. The critical path of a carry runs through one XOR gate in adder and through 2 gates (AND and OR) in carry-block and therefore, if AND or OR gates take 1 delay to complete, has a delay of :T_\text = T_\text + T_\text + T_\text = D + D + D = 3D. The
truth table A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional argumen ...
for the full adder is: : Inverting all inputs of a full adder also inverts all of its outputs, which can be used in the design of fast ripple-carry adders, because there is no need to invert the carry.


Adders supporting multiple bits


Ripple-carry adder

It is possible to create a logical circuit using multiple full adders to add ''N''-bit numbers. Each full adder inputs a ''C''in, which is the ''C''out of the previous adder. This kind of adder is called a ripple-carry adder (RCA), since each carry bit "ripples" to the next full adder. Note that the first (and only the first) full adder may be replaced by a half adder (under the assumption that ''C''in = 0). The output of previous adder (Cout n-1)passed as input to next adder (Cin) . The layout of a ripple-carry adder is simple, which allows fast design time; however, the ripple-carry adder is relatively slow, since each full adder must wait for the carry bit to be calculated from the previous full adder. The
gate delay Propagation delay is the time duration taken for a signal to reach its destination. It can relate to networking, electronics or physics. ''Hold time'' is the minimum interval required for the logic level to remain on the input after triggering ed ...
can easily be calculated by inspection of the full adder circuit. Each full adder requires three levels of logic. In a 32-bit ripple-carry adder, there are 32 full adders, so the critical path (worst case) delay is 3 (from input to carry in first adder) + 31 × 2 (for carry propagation in latter adders) = 65 gate delays. The general equation for the worst-case delay for a ''n''-bit carry-ripple adder, accounting for both the sum and carry bits, is :T_\text(n) = T_\text + (n-1) \cdot T_\text + T_\text = T_\text + (n-1) \cdot T_c = 3 D + (n-1) \cdot 2 D = (2n+1) \cdot D. A design with alternating carry polarities and optimized AND-OR-Invert gates can be about twice as fast.


Carry-lookahead adder

To reduce the computation time, engineers devised faster ways to add two binary numbers by using
carry-lookahead adder A carry-lookahead adder (CLA) or fast adder is a type of electronics adder used in digital logic. A carry-lookahead adder improves speed by reducing the amount of time required to determine carry bits. It can be contrasted with the simpler, b ...
s (CLA). They work by creating two signals (''P'' and ''G'') for each bit position, based on whether a carry is propagated through from a less significant bit position (at least one input is a 1), generated in that bit position (both inputs are 1), or killed in that bit position (both inputs are 0). In most cases, ''P'' is simply the sum output of a half adder and ''G'' is the carry output of the same adder. After ''P'' and ''G'' are generated, the carries for every bit position are created. Some advanced carry-lookahead architectures are the Manchester carry chain,
Brent–Kung adder The Brent–Kung adder (BKA or BK), proposed in 1982, is an advanced binary adder design, having a gate level depth of O(\log_2(n)). Introduction The Brent–Kung adder is a parallel prefix adder (PPA) form of carry-lookahead adder (CLA). Propos ...
(BKA), and the Kogge–Stone adder (KSA). Some other multi-bit adder architectures break the adder into blocks. It is possible to vary the length of these blocks based on the
propagation delay Propagation delay is the time duration taken for a signal to reach its destination. It can relate to networking, electronics or physics. ''Hold time'' is the minimum interval required for the logic level to remain on the input after triggering ed ...
of the circuits to optimize computation time. These block based adders include the carry-skip (or carry-bypass) adder which will determine ''P'' and ''G'' values for each block rather than each bit, and the
carry-select adder In electronics, a carry-select adder is a particular way to implement an adder, which is a logic element that computes the (n+1)-bit sum of two n-bit numbers. The carry-select adder is simple but rather fast, having a gate level depth of O(\sqrt ...
which pre-generates the sum and carry values for either possible carry input (0 or 1) to the block, using multiplexers to select the appropriate result ''when'' the carry bit is known. By combining multiple carry-lookahead adders, even larger adders can be created. This can be used at multiple levels to make even larger adders. For example, the following adder is a 64-bit adder that uses four 16-bit CLAs with two levels of lookahead carry units. Other adder designs include the
carry-select adder In electronics, a carry-select adder is a particular way to implement an adder, which is a logic element that computes the (n+1)-bit sum of two n-bit numbers. The carry-select adder is simple but rather fast, having a gate level depth of O(\sqrt ...
, conditional sum adder,
carry-skip adder A carry-skip adder (also known as a carry-bypass adder) is an adder implementation that improves on the delay of a ripple-carry adder with little effort compared to other adders. The improvement of the worst-case delay is achieved by using sever ...
, and carry-complete adder.


Carry-save adders

If an adding circuit is to compute the sum of three or more numbers, it can be advantageous to not propagate the carry result. Instead, three-input adders are used, generating two results: a sum and a carry. The sum and the carry may be fed into two inputs of the subsequent 3-number adder without having to wait for propagation of a carry signal. After all stages of addition, however, a conventional adder (such as the ripple-carry or the lookahead) must be used to combine the final sum and carry results.


3:2 compressors

A full adder can be viewed as a ''3:2 lossy compressor'': it sums three one-bit inputs and returns the result as a single two-bit number; that is, it maps 8 input values to 4 output values. Thus, for example, a binary input of 101 results in an output of (decimal number 2). The carry-out represents bit one of the result, while the sum represents bit zero. Likewise, a half adder can be used as a ''2:2 lossy compressor'', compressing four possible inputs into three possible outputs. Such compressors can be used to speed up the summation of three or more addends. If the addends are exactly three, the layout is known as the carry-save adder. If the addends are four or more, more than one layer of compressors is necessary, and there are various possible designs for the circuit: the most common are
Dadda The Gurjaras of Lata, also known as Gurjaras of Nandipuri or Bharuch Gurjaras, was a dynasty which ruled Lata (region), Lata region (now South Gujarat, India) as a feudatory of different dynasties from c. 580 CE to c. 738 CE. Sources of Informa ...
and Wallace trees. This kind of circuit is most notably used in multipliers, which is why these circuits are also known as Dadda and Wallace multipliers.


Quantum adders

Using only the Toffoli and
CNOT In computer science, the controlled NOT gate (also C-NOT or CNOT), controlled-''X'' gate'','' controlled-bit-flip gate, Feynman gate or controlled Pauli-X is a quantum logic gate that is an essential component in the construction of a gate-base ...
quantum logic gates, it is possible to produce quantum full- and half-adders. The same circuits can also be implemented in classical reversible computation, as both CNOT and Toffoli are also classical logic gates. Since the
quantum Fourier transform In quantum computing, the quantum Fourier transform (QFT) is a linear transformation on quantum bits, and is the quantum analogue of the discrete Fourier transform. The quantum Fourier transform is a part of many quantum algorithms, notably Shor' ...
have a low
circuit complexity In theoretical computer science, circuit complexity is a branch of computational complexity theory in which Boolean functions are classified according to the size or depth of the Boolean circuits that compute them. A related notion is the circui ...
, it can efficiently be used for adding numbers as well.


Analog adders

Just as in Binary adders, combining two input currents effectively adds those currents together. Within the constraints of the hardware, non-binary signals (i.e. with a base higher than 2) can be added together to calculate a sum. Also known as a "summing amplifier", this technique can be used to reduce the number of transistors in an addition circuit.


See also

*
Binary multiplier A binary multiplier is an electronic circuit used in digital electronics, such as a computer, to multiply two binary numbers. A variety of computer arithmetic techniques can be used to implement a digital multiplier. Most techniques involve comp ...
*
Subtractor In electronics, a subtractor – a digital circuit that performs subtraction of numbers – can be designed using the same approach as that of an adder. The binary subtraction process is summarized below. As with an adder, in the general case o ...
*
Electronic mixer An electronic mixer is a device that combines two or more electrical or electronic signals into one or two composite output signals. There are two basic circuits that both use the term ''mixer'', but they are very different types of circuits: ...
— for adding analog signals


References


Further reading

* * * * *


External links


Hardware algorithms for arithmetic modules
includes description of several adder layouts with figures.
8-bit Full Adder and Subtractor
a demonstration of an interactive Full Adder built in JavaScript solely for learning purposes.
Interactive Full Adder Simulation
(requires Java), Interactive Full Adder circuit constructed with Teahlab's online circuit simulator.
Interactive Half Adder Simulation
(requires Java), Half Adder circuit built with Teahlab's circuit simulator.
4-bit Full Adder Simulation
built in Verilog, and the accompanyin
Ripple Carry Full Adder Video Tutorial
* {{DEFAULTSORT:Adder (Electronics) Binary arithmetic