Skip to main content

Positive/negative logic; XNOR using NAND

Short answer

Positive logic: HIGH=1, LOW=0; negative logic: HIGH=0, LOW=1. An XNOR gate is built with five NAND gates: four gates form XOR (G4 = A⊕B), and a fifth NAND with both inputs tied to G4 inverts it, yielding Y = ¬(A⊕B) = A⊙B.

Define positive and negative logic. Realize X-NOR gate using NAND gates only.

Positive and negative logic

  • Positive logic: HIGH voltage = logic 1, LOW voltage = logic 0 (e.g. TTL: +5 V = 1, 0 V = 0).
  • Negative logic: HIGH voltage = logic 0, LOW voltage = logic 1 (e.g. +5 V = 0, 0 V = 1).

The same physical gate performs a different logic function in the two systems, because changing the convention complements every input and output. Example: a gate whose output is HIGH only when both inputs are HIGH is an AND gate in positive logic but an OR gate in negative logic.

XNOR using NAND gates only

Y=A⊙B=A⊕B‾Y = A \odot B = \overline{A \oplus B}. First build XOR with 4 NAND gates, then invert it with a fifth NAND gate whose two inputs are tied together (X⋅X‾=Xˉ\overline{X \cdot X} = \bar X). Minimum: 5 NAND gates.

G1=AB‾G2=AG1‾G3=BG1‾G4=G2G3‾=A⊕BY=G4⋅G4‾=A⊕B‾=AB+AˉBˉ\begin{aligned} G_1 &= \overline{AB} \\ G_2 &= \overline{A G_1} \\ G_3 &= \overline{B G_1} \\ G_4 &= \overline{G_2 G_3} = A \oplus B \\ Y &= \overline{G_4 \cdot G_4} = \overline{A \oplus B} = AB + \bar A \bar B \end{aligned}
 A --+-----------[NAND G2]--+
     |              |       |
     +--[NAND G1]---+       +--[NAND G4]--+--[NAND G5]-- Y
     |              |       |             +--|
 B --+-----------[NAND G3]--+       (inputs tied: NOT)
ABG1G_1G2G_2G3G_3G4G_4Y
0011101
0111010
1010110
1101101

Y is 1 when both inputs are equal, which is XNOR.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 2 questions →