Skip to main content

Decoder; 2-to-4 decoder as a full adder

Short answer

A decoder converts an n-bit input into 2^n mutually exclusive minterm outputs. For a full adder, feed A and B to a 2-to-4 decoder to obtain D0–D3. Then S = (D1+D2) XOR Cin, and Cout = D3 + (D1+D2)·Cin, using OR, XOR, AND gates.

What is a decoder? Realize a 2-to-4 line decoder as a full adder circuit.

Decoder

A decoder is a combinational circuit that converts an nn-bit binary input code into 2n2^n output lines, of which exactly one is active for each input combination. Each output is one minterm of the inputs (e.g. 2-to-4, 3-to-8 (74138), BCD-to-decimal decoders).

Full adder using a 2-to-4 decoder

A 2-to-4 decoder has only two inputs, so feed it AA and BB. Its outputs are the minterms of A,BA, B:

D0=A′B′,D1=A′B,D2=AB′,D3=ABD_0 = A'B',\quad D_1 = A'B,\quad D_2 = AB',\quad D_3 = AB

Group the full-adder truth table by ABAB and write SS and CoutC_{out} in terms of CinC_{in}:

ABActive lineSCoutC_{out}
00D0D_0CinC_{in}0
01D1D_1Cin′C_{in}'CinC_{in}
10D2D_2Cin′C_{in}'CinC_{in}
11D3D_3CinC_{in}1

Let P=D1+D2P = D_1 + D_2 (=A⊕B= A \oplus B). Then

S=(D0+D3)Cin+(D1+D2)Cin′=P⊕CinCout=D3+(D1+D2)Cin=D3+P Cin\begin{aligned} S &= (D_0 + D_3)C_{in} + (D_1 + D_2)C_{in}' = P \oplus C_{in} \\ C_{out} &= D_3 + (D_1 + D_2)C_{in} = D_3 + P\,C_{in} \end{aligned}

Circuit

          +--------+
  A ----->| 2-to-4 |-- D0 (unused)
  B ----->| decoder|-- D1 --+
          |        |-- D2 --+--[OR]-- P
          |        |-- D3 ------------- D3
          +--------+

  P, Cin ---[XOR]--------------------- S
  P, Cin ---[AND]--- P.Cin ---+
  D3 -------------------------+--[OR]-- Cout

Gates: 2 OR, 1 XOR, 1 AND.

Check

A B CinC_{in}PSCoutC_{out}A+B+C (binary)
0 1 110110
1 1 000110
1 1 101111
1 0 011001

All eight combinations were verified.

Alternative: two 2-to-4 decoders with enable can be joined (using AA on the enables) into a 3-to-8 decoder; then S=Σm(1,2,4,7)S = \Sigma m(1,2,4,7) and Cout=Σm(3,5,6,7)C_{out} = \Sigma m(3,5,6,7) are taken with two 4-input OR gates.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 4 questions →