Skip to main content

Full subtractor using a 2×4 decoder

Short answer

Apply A,B to a 2×4 decoder. OR decoder outputs to form A⊕B (from Y1,Y2) and A⊙B (from Y0,Y3). Then D = (A⊕B) ⊕ Bin, and Bout = Y1 + (A⊙B)·Bin using one XOR, one AND, and OR gates.

Realize a full-subtractor circuit using a single 2×4 decoder and necessary logic gates.

A full subtractor computes A−B−BinA - B - B_{in}, giving difference DD and borrow BoutB_{out}. A single 2×4 decoder has only two inputs, so feed it AA and BB; its outputs are the minterms of A,BA, B, and BinB_{in} is combined with gates.

Truth table grouped by AB

ABBinB_{in}DBoutB_{out}
00000
00111
01011
01101
10010
10100
11000
11111
ABDecoder lineDBoutB_{out}
00Y0Y_0BinB_{in}BinB_{in}
01Y1Y_1Bin′B_{in}'1
10Y2Y_2Bin′B_{in}'0
11Y3Y_3BinB_{in}BinB_{in}

Equations

D=(Y1+Y2)⊕BinBout=Y1+(Y0+Y3) Bin\begin{aligned} D &= (Y_1 + Y_2) \oplus B_{in} \\ B_{out} &= Y_1 + (Y_0 + Y_3)\,B_{in} \end{aligned}

(Here Y1+Y2=A⊕BY_1 + Y_2 = A \oplus B and Y0+Y3=A⊙BY_0 + Y_3 = A \odot B.)

          +--------+
  A ----->| 2x4  Y0|---> E (OR)
  B ----->|      Y1|---> P (OR), Bout (OR)
          |      Y2|---> P (OR)
          |      Y3|---> E (OR)
          +--------+
  Y0, Y3 ---[OR]--- E  (= A xnor B)
  Y1, Y2 ---[OR]--- P  (= A xor B)
  P, Bin ---[XOR]------------------ D
  E, Bin ---[AND]--- E.Bin --+
  Y1 ------------------------+-[OR]-- Bout

Gates: 2 OR (2-input), 1 XOR, 1 AND, 1 OR.

Check: A=0,B=1,Bin=1A=0, B=1, B_{in}=1: Y1=1Y_1 = 1, P=1P = 1, D=1⊕1=0D = 1 \oplus 1 = 0, Bout=1B_{out} = 1; indeed 0−1−1=−20 - 1 - 1 = -2, i.e. D=0D = 0 with borrow 1. All 8 rows were verified.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 4 questions →