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.
Open this circuit in the lab →
What you need
- 2× 4-to-1 MUX: one for D and one for Bout, both with S1 = A and S0 = B
- 1× NOT: NOT Bin for the difference mux
- 2× constant: 1 (VDD) and 0 (GND) on the borrow mux
Step by step
- Place inputs
A,BandBin, two 4-to-1 muxes and probesDandBout. - Wire A to S1 and B to S0 on both muxes.
- Difference mux: D0 = Bin, D1 = NOT Bin, D2 = NOT Bin, D3 = Bin.
- Borrow mux: D0 = Bin, D1 = 1, D2 = 0, D3 = Bin.
- 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
| A | B | Bin | D | Bout |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
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.