Jump to content

Digital Electronics/Mathematic and Logic Operations/Digital Adder

From Wikibooks, open books for an open world

Digital Adder

[edit | edit source]

Digital Adder is a digital device capable of adding two digital n-bit binary numbers, where n depends on the circuit implementation. Digital adder adds two binary numbers A and B to produce a sum S and a carry C.

Half adder

[edit | edit source]

The Half Adder is a digital device used to add two binary bit 0 and 1 The half adder outputs a sum of the two inputs and a carry value.

0 + 0 = Sum 0 Carry 0
0 + 1 = Sum 1 Carry 0
1 + 0 = Sum 1 Carry 0
1 + 1 = Sum 0 Carry 1

Truth Table below

[edit | edit source]
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0

Construction

[edit | edit source]
              ___________
     A ------|           |
             |   Half    |----- 
             |   Adder   |
             |           |----- 
     B ------|___________|


Half Adder can constructed from AND gate and XOR gate as shown below

Half adder circuit diagram

Full adder

[edit | edit source]

A full adder is a logical circuit that performs an addition operation on three one-bit binary numbers. The full adder produces a sum of the two inputs and carry value. It can be combined with other full adders (see below) or work on its own.

Truth Table

[edit | edit source]
Input Output
0 0 0 0 0
0 1 0 0 1
1 0 0 0 1
1 1 0 1 0
0 0 1 0 1
0 1 1 1 0
1 0 1 1 0
1 1 1 1 1

Construction

[edit | edit source]
Full adder circuit diagram Inputs: {A, B, CarryIn} → Outputs: {Sum, CarryOut}
Schematic symbol for a 1-bit full adder

Note that the final OR gate before the carry-out output may be replaced by an XOR gate without altering the resulting logic. This is because the only difference between OR and XOR gates occurs when both inputs are 1; for the adder shown here, this is never possible. Using only two types of gates is convenient if one desires to implement the adder directly using common IC chips.

A full adder can be constructed from two half adders by connecting A and B to the input of one half adder, connecting the sum from that to an input to the second adder, connecting Ci to the other input and OR the two carry outputs. Equivalently, S could be made the three-bit XOR of A, B, and Ci, and Co could be made the three-bit majority function of A, B, and Ci.

Multiple-bit adders

[edit | edit source]

Ripple carry adder

[edit | edit source]

It is possible to create a logical circuit using multiple full adders to add N-bit numbers. Each full adder inputs a Cin, which is the Cout of the previous adder. This kind of adder is a ripple carry adder, 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.

The layout of ripple carry adder is simple, which allows for 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 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 32 full adders, so the critical path (worst case) delay is gate delays.

Carry look-ahead adders

[edit | edit source]

To reduce the computation time, engineers devised faster ways to add two binary numbers by using carry lookahead adders. 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'), a carry is generated in that bit position (both inputs are '1'), or if a carry is 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 look ahead architectures are the Manchester carry chain, Brent-Kung adder, and the Kogge-Stone adder.

4-bit adder with Carry Look Ahead

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 of the circuits to optimize computation time. These block based adders include the carry bypass adder which will determine P and G values for each block rather than each bit, and the carry select adder which pre-generates sum and carry values for either possible carry input to the block.

Other adder designs include the conditional sum adder, carry skip adder, and carry complete adder.

Lookahead Carry Unit

[edit | edit source]

By combining multiple carry look-ahead 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 LCUs.

A 64-bit adder


Reference

[edit | edit source]
  1. Digital Adder on Wikipedia