Module 1: Foundations of Digital Logic · 1.3 Logic Gates & Truth Tables

The Seven Basic Logic Gates

Digital circuits implement logic functions using seven fundamental logic gates: NOT, AND, OR, NAND, NOR, XOR, and XNOR. This article defines the schematic symbol, truth table, Boolean equation, typical application, and CMOS transistor count for each gate.

1. NOT Gate (Inverter)

The NOT gate inverts the logic state of a single input signal.

NOT gate symbol
Figure 1: NOT gate schematic symbol with output inversion bubble

Input $A$ Output $Y$
0 1
1 0

Boolean equation:

$$Y = A’ = \overline{A}$$

  • Application: Polarity inversion for active-low control lines and complementary clock distribution.
  • Transistor Count: 2 transistors (1 PMOS pull-up, 1 NMOS pull-down).

2. AND Gate

The AND gate outputs logic 1 only when all inputs are 1.

AND gate symbol
Figure 2: Two-input AND gate schematic symbol

Input $A$ Input $B$ Output $Y$
0 0 0
0 1 0
1 0 0
1 1 1

Boolean equation:

$$Y = A \cdot B = AB$$

  • Application: Signal masking and clock enable gating (data_out = data_in AND enable).
  • Transistor Count: 6 transistors (a 4-transistor NAND gate followed by a 2-transistor inverter).

3. OR Gate

The OR gate outputs logic 1 when at least one input is 1.

OR gate symbol
Figure 3: Two-input OR gate schematic symbol

Input $A$ Input $B$ Output $Y$
0 0 0
0 1 1
1 0 1
1 1 1

Boolean equation:

$$Y = A + B$$

  • Application: Interrupt request aggregation and status flag generation.
  • Transistor Count: 6 transistors (a 4-transistor NOR gate followed by a 2-transistor inverter).

4. NAND Gate

The NAND gate outputs logic 0 only when all inputs are 1.

NAND gate symbol
Figure 4: Two-input NAND gate schematic symbol with output inversion bubble

Input $A$ Input $B$ Output $Y$
0 0 1
0 1 1
1 0 1
1 1 0

Boolean equation:

$$Y = (AB)’ = \overline{AB}$$

  • Application: Universal logic networks, bistable latches, and high-density combinational arrays.
  • Transistor Count: 4 transistors (2 series NMOS, 2 parallel PMOS). Because it requires only four transistors, CMOS libraries use NAND as the primary building block.

5. NOR Gate

The NOR gate outputs logic 1 only when all inputs are 0.

NOR gate symbol
Figure 5: Two-input NOR gate schematic symbol with output inversion bubble

Input $A$ Input $B$ Output $Y$
0 0 1
0 1 0
1 0 0
1 1 0

Boolean equation:

$$Y = (A + B)’ = \overline{A + B}$$

  • Application: Bus zero-detection logic in Arithmetic Logic Units.
  • Transistor Count: 4 transistors (2 parallel NMOS, 2 series PMOS). The series PMOS configuration increases pull-up resistance, making NOR gates slower than equivalent NAND gates.

6. XOR Gate (Exclusive-OR)

The XOR gate outputs logic 1 when the inputs have different logic states.

XOR gate symbol
Figure 6: Two-input XOR gate schematic symbol

Input $A$ Input $B$ Output $Y$
0 0 0
0 1 1
1 0 1
1 1 0

Boolean equation:

$$Y = A \oplus B = AB’ + A’B$$

  • Applications:
    • Programmable Inverter: In $Y = A \oplus \text{ctrl}$, if $\text{ctrl} = 0$, $Y = A$. If $\text{ctrl} = 1$, $Y = A’$.
    • Arithmetic Adders: Generates the sum bit ($S = A \oplus B \oplus C_{in}$).
    • Parity Generators: Evaluates whether an input bit array contains an odd number of 1s.

8-bit parity generator
Figure 7: An 8-bit parity generator tree built using seven XOR gates across three logic levels

  • Transistor Count: 8 to 12 transistors depending on transmission-gate optimization.

7. XNOR Gate (Exclusive-NOR)

The XNOR gate outputs logic 1 when both inputs have identical logic states.

XNOR gate symbol
Figure 8: Two-input XNOR gate schematic symbol with output inversion bubble

Input $A$ Input $B$ Output $Y$
0 0 1
0 1 0
1 0 0
1 1 1

Boolean equation:

$$Y = (A \oplus B)’ = AB + A’B’$$

  • Application: Digital equality comparators. An $n$-bit comparator evaluates bit-level equality using $n$ parallel XNOR gates connected to an $n$-input AND gate.
  • Transistor Count: 8 to 12 transistors.

Comprehensive Gate Comparison

Gate Type Boolean Expression Output (0,0) Output (0,1) Output (1,0) Output (1,1) Transistors (CMOS) Primary Application
NOT $A'$ 1 — 0 — 2 Signal inversion
AND $AB$ 0 0 0 1 6 Data gating
OR $A+B$ 0 1 1 1 6 Status aggregation
NAND $(AB)'$ 1 1 1 0 4 High-speed logic networks
NOR $(A+B)'$ 1 0 0 0 4 Zero detection
XOR $A \oplus B$ 0 1 1 0 8–12 Adder sum, parity
XNOR $(A \oplus B)'$ 1 0 0 1 8–12 Equality comparators

De Morgan Equivalent Gate Symbols

De Morgan’s laws establish equivalent schematic representations:

  • A NAND gate equals an OR gate with inverted inputs: $$\overline{A \cdot B} = \overline{A} + \overline{B}$$
  • A NOR gate equals an AND gate with inverted inputs: $$\overline{A + B} = \overline{A} \cdot \overline{B}$$

Designers use these alternate representations on schematics to indicate whether active-low or active-high signals drive the gate inputs.

Practice Exercises

Exercise 1: Construct truth tables for 2-input NAND and 2-input XNOR gates using truth-table inversion operations.

View Solution

Derive NAND by inverting the AND output:

$A$ $B$ AND ($AB$) NAND ($(AB)’$)
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0

Derive XNOR by inverting the XOR output:

$A$ $B$ XOR ($A \oplus B$) XNOR ($(A \oplus B)’$)
0 0 0 1
0 1 1 0
1 0 1 0
1 1 0 1

Exercise 2: Verify De Morgan identity $\overline{A \cdot B} = \overline{A} + \overline{B}$ using truth tables.

View Solution
$A$ $B$ $A'$ $B'$ $A \cdot B$ $\overline{A \cdot B}$ $A’ + B'$
0 0 1 1 0 1 1
0 1 1 0 0 1 1
1 0 0 1 0 1 1
1 1 0 0 1 0 0

Both outputs match across all input conditions.

Exercise 3: Design a logic circuit that detects when an 8-bit bus vector matches hexadecimal pattern 0xA5 (binary 10100101).

View Solution

Connect input bits to an 8-input AND gate:

  1. Connect bits with value 1 directly (bits 7, 5, 2, and 0).
  2. Pass bits with value 0 through inverters (bits 6, 4, 3, and 1).
  3. Connect all eight outputs to the 8-input AND gate.

The AND output evaluates to 1 only when input vector equals 10100101.

← Physical Characteristics of Digital Logic Gates Multi-Input Gates, Compound Cells, Tri-State, and Transmission Gates →