How to build a half subtractor using only NOR gates
A half subtractor can be built from five NOR gates. The second gate, NOR(A, NOR(A, B)), is already the borrow Bout = NOT A AND B, and four NORs make an XNOR that a fifth NOR inverts into the difference D = A XOR B.
NOR gates naturally make XNOR rather than XOR: N1 = NOR(A, B), N2 = NOR(A, N1) and N3 = NOR(B, N1), and NOR(N2, N3) is A XNOR B. Expanding N2 shows the bonus: NOT (A OR NOT (A OR B)) = NOT A AND (A OR B) = NOT A AND B, exactly the borrow, so the borrow costs no extra gate. The fifth NOR, with both inputs tied together, inverts the XNOR into the difference. Compare the half subtractor from NAND gates, also five gates, where the fifth one is needed to invert the borrow instead, and the half adder from NOR gates.
Open this circuit in the lab →
What you need
- 4× NOR: A XNOR B: N1 = NOR(A, B), N2 = NOR(A, N1), N3 = NOR(B, N1), XNOR = NOR(N2, N3); N2 is also Bout
- 1× NOR: D = NOR(XNOR, XNOR) = A XOR B
Step by step
- Place inputs
AandB. - N1 = NOR(A, B), then N2 = NOR(A, N1) and N3 = NOR(B, N1).
- Probe N2 as
Bout: it is NOT A AND B. - NOR N2 with N3 to get A XNOR B, then NOR that with itself to get
D= A XOR B. - Try all four rows: only A = 0, B = 1 borrows.
Half subtractor truth table
| A | B | D | Bout |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
N2 is the borrow on its own: it is 1 only in the row A = 0, B = 1. All four rows are checked on the live circuit before the page is built.
You can also read the full theory in the lesson on the half subtractor. 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.
Build more parts from gates
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 half subtractor from NOR gates in the lab →Frequently asked
How many NOR gates are needed for a half subtractor?
Five. Four NORs make A XNOR B and the fifth inverts it into the difference; the borrow comes for free from the second NOR.
Why do NOR gates make XNOR more easily than XOR?
The four-gate NOR network is the dual of the four-gate NAND XOR, and the dual of XOR is XNOR. So with NOR gates you get XNOR in four gates and need a fifth to turn it into XOR.
Can a full subtractor be built from NOR gates?
Yes. NOR is a universal gate, so any circuit can be built from it. A full subtractor is two half subtractors plus an OR for the borrows, and each of those can be made from NOR gates.