Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

Full subtractor using 4-to-1 multiplexers, live

A full subtractor can be built from two 4-to-1 multiplexers and one NOT gate. A and B drive the select lines, and each mux's data inputs are read from the truth table: the difference mux gets Bin, NOT Bin, NOT Bin, Bin, and the borrow mux gets Bin, 1, 0, Bin.

A full subtractor computes A minus B minus a borrow in, Bin, giving a difference D = A XOR B XOR Bin and a borrow out Bout = A'B + A'Bin + B Bin. For each fixed pair A, B, both outputs reduce to 0, 1, Bin or NOT Bin, so a 4-to-1 mux with A and B on its selects can pick the right one. For the difference that is Bin when A = B and NOT Bin when they differ, the same pattern as the sum of the full adder using 4-to-1 muxes. The borrow is where they part: with A = 0, B = 1 the subtraction always borrows (1), with A = 1, B = 0 it never does (0), and when A = B it borrows exactly when Bin does. The 4-to-1 mux is the verified 4-to-1 multiplexer, saved as a part. The gate version is the full subtractor.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

Embed or cite this circuit

Free to embed on a course page, blog or worksheet: paste this code. The circuit stays live, and the small digiwleea badge links back here.

To cite it: digiwleea, “full subtractor using 4:1 multiplexers”, https://digiwleea.wleeaf.dev/tools/build/full-subtractor-mux/

What you need

Step by step

  1. Place inputs A, B and Bin, two 4-to-1 muxes and probes D and Bout.
  2. Wire A to S1 and B to S0 on both muxes.
  3. Difference mux: D0 = Bin, D1 = NOT Bin, D2 = NOT Bin, D3 = Bin.
  4. Borrow mux: D0 = Bin, D1 = 1, D2 = 0, D3 = Bin.
  5. Try all eight rows: with A = 0, B = 1 the borrow is always 1, and with A = 1, B = 0 it is always 0.

Full subtractor truth table, grouped by the selects

ABBinDBout
00000
00111
01011
01101
10010
10100
11000
11111

Each pair of rows with the same A and B is one mux input: read D and Bout against Bin to see Bin, NOT Bin, 1 or 0. All eight rows are checked on the live circuit before the page is built.

You can also read the full theory in the lesson on the multiplexer as a universal block. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

More builds: Arithmetic

All 246 build guides, by topic

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the full subtractor using 4:1 multiplexers in the lab →

Frequently asked

How do you implement a full subtractor with a 4-to-1 multiplexer?

Put A and B on the select lines. For the difference connect Bin, NOT Bin, NOT Bin, Bin to D0 to D3; for the borrow connect Bin, 1, 0, Bin. Two 4-to-1 muxes and one NOT gate do the whole subtractor.

How many multiplexers does a full subtractor need?

Two 4-to-1 multiplexers, one per output, if A and B drive the selects and Bin (or its complement, or a constant) is the data.

What is the difference between the full adder and full subtractor mux designs?

The difference and the sum use the same inputs (Bin or Cin, its complement, its complement, itself). Only the second mux changes: the carry gets 0, Cin, Cin, 1 and the borrow gets Bin, 1, 0, Bin.