Realize XNOR Logic Function Using NAND Gates Only
The XNOR gate implements the Boolean function:
Equivalently using XOR and NOT:
where .
To “realize using NAND only,” we use the NAND gate as the only primitive. The key identities are:
- Inverter via NAND:
- NAND is functionally complete: any AND/OR/NOT expression can be rewritten using only NAND with De Morgan’s laws.
We will construct XNOR structurally from NANDs by (1) building XOR using NANDs, then (2) inverting it to get XNOR using one more NAND.
XNOR and XOR using NAND (Logic gate realization)
Core NAND-only rewrite rules
Using De Morgan’s laws:
-
De Morgan’s law:
-
Thus AND from NAND: Implementing with NAND and then inverting using a NAND-as-inverter.
-
OR from NAND:
And , so:
Again: generate complements with NAND-inverters, then use NAND(s) to form the complemented AND, then invert.
In practice, to build a gate-level circuit, we minimize inversions and reuse intermediate signals.
Step-by-step NAND-only realization of XNOR
- 1Step 1
Use , where XOR can be implemented from NANDs and then inverted using NAND.
- 2Step 2
Create and then compute using NAND with a final inversion if needed.
- 3Step 3
Create and compute using NAND-only structure.
- 4Step 4
Implement the OR of and using NAND-only OR construction via De Morgan.
- 5Step 5
Finally, compute using a single NAND configured as an inverter: .
A concrete NAND-only XNOR gate-level construction (reusable netlist)
Define:
XOR structure:
Implement AND from NAND:
- (OR from NAND):
because and NAND of complements gives .
XNOR:
This is guaranteed correct by the functional equivalences of NAND + De Morgan’s transformations.
Verification via truth table (XNOR)
XNOR outputs 1 when A and B are equal.
Common pitfalls and optimizations
Pro Tip
When converting to NAND-only, treat each AND/OR as “complemented form” first, then apply De Morgan. This prevents losing track of where inversions are actually created.
Warning
Be careful: NAND networks often produce complemented intermediate signals. If you accidentally invert one too many times, the final output becomes XOR instead of XNOR.
XNOR with NAND-only (Self-check)
Knowledge Check
Which identity is commonly used to realize XNOR with a NAND-only design?