XNOR gate (exclusive NOR)

The XNOR gate is the inverse of XOR: it outputs 1 when its inputs are equal and 0 when they differ; with more inputs it outputs 1 for an even number of 1s. It computes A ⊙ B and is the natural equality-comparison and even-parity element.

Basic

Two-input XNOR

Wire inputs A and B and read Y. The output is 1 in the rows where the inputs match, and 0 where they differ — the exact complement of XOR. XNOR is the 'equality detector'.

ABY
001
010
100
111
Intermediate

One-bit equality check

Feed two bits A and B into an XNOR gate. The output is 1 exactly when the two bits are equal, giving a direct one-bit equality test. This is the per-bit primitive used inside magnitude and equality comparators.

One-bit equality check
Advanced

Two-bit equality comparator

Compare two 2-bit words by XNOR-ing each bit pair and ANDing the results. Each XNOR asserts 1 when its bit pair matches; the AND asserts 1 only when every pair matches, so the final output signals full-word equality (A = B). Widening the AND to N inputs scales the comparator to N bits.

Two-bit equality comparator

Citations

  • Karnaugh, M. (1953). The map method for synthesis of combinational logic circuits. Reference 1
  • Mano, M. M., & Ciletti, M. D. (2018). Digital design: With an introduction to the Verilog HDL, VHDL, and SystemVerilog (6th ed.). Reference 2