Digital Circuits Cheatsheet

Logic Gates

Use this Digital Circuits reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

Overview

Logic gates are the physical building blocks of digital circuits. Each gate implements a Boolean function, which is why the topic matters when you move from learning Python, JavaScript, Java, or C++ into computer architecture and systems courses. Gates are built from transistors (MOSFETs in modern CMOS technology) and are combined to realize any logic function.

Basic Gate Truth Tables

NOT (Inverter)

AA′
01
10

AND

ABA · B
000
010
100
111

OR

ABA + B
000
011
101
111

NAND

AB(A · B)′
001
011
101
110

NOR

AB(A + B)′
001
010
100
110

XOR (Exclusive OR)

ABA ⊕ B
000
011
101
110

XNOR (Exclusive NOR)

AB(A ⊕ B)′
001
010
100
111

Gate Summary Table

GateSymbolOutputCMOS transistors (2-input)
NOT○—HIGH when input LOW1p + 1n
ANDD shapeHIGH only if all HIGH4 (NAND + NOT)
ORCurvedHIGH if any HIGH4 (NOR + NOT)
NANDD + bubbleLOW only if all HIGH2p + 2n
NORCurved + bubbleHIGH only if all LOW2p + 2n
XORCurved + extra arcHIGH if odd number HIGH~8–12
XNORXOR + bubbleHIGH if even number HIGH~8–12

NAND and NOR are universal gates — any Boolean function can be built using only NANDs or only NORs.

Universal Gate Implementations

NOT from NAND

A ──┬── NAND ──── A′
    └──

Connect both NAND inputs together: (A · A)′ = A′

AND from NAND

A ──┐
    NAND ──── NAND ──── A · B
B ──┘    (self)

OR from NAND (De Morgan)

A ──── NAND ──┐
              NAND ──── A + B
B ──── NAND ──┘

OR from NOR (similar pattern)

A ──┐
    NOR ──── NOR ──── A + B
B ──┘    (self)

Multi-Input Gates

AND and OR gates extend naturally. XOR on >2 inputs uses cascade:

3-input XOR: (A ⊕ B) ⊕ C

Parity: n-input XOR outputs 1 when an odd number of inputs are 1.

Gate Timing Characteristics

ParameterMeaning
Propagation delay (tₚ)Time from input change to output reaching 50% of final value
tₚHLHigh-to-Low output transition delay
tₚLHLow-to-High output transition delay
tₚ (average)(tₚHL + tₚLH) / 2
Rise/fall timeTime for output to move 10%→90% or 90%→10%
Critical pathLongest delay path through a circuit; limits clock speed

Fan-In and Fan-Out

TermDefinition
Fan-inNumber of inputs a gate can accept
Fan-outNumber of gate inputs a single output can drive without degradation
Typical CMOS fan-out10–20 standard loads

Exceeding fan-out increases delay and may cause logic errors.

Logic Families (Historical + Modern)

FamilyFull nameV_CCSpeedPower
TTLTransistor–Transistor Logic5 VModerateModerate
CMOSComplementary MOS1.8–5 VFastVery low (static)
ECLEmitter-Coupled Logic−5.2 VVery fastHigh
BiCMOSBipolar + CMOS3.3–5 VFastLow–moderate

Modern digital design uses CMOS almost exclusively; logic levels: - LOW: 0 – 0.8 V (TTL), 0 – 0.3×V_DD (CMOS) - HIGH: 2.0 – 5 V (TTL), 0.7×V_DD – V_DD (CMOS)

Wired Logic

In open-collector/open-drain outputs, connecting outputs together creates wired AND (pull-up resistor to V_CC):

Out_A ──┐
         ├──── Wired-AND output
Out_B ──┘

Used in I²C bus and interrupt lines.

Bubble Pushing (Gate Conversion)

Move bubbles (inversions) through a gate, swapping AND↔OR, to simplify schematics or match available parts:

OriginalEquivalent (bubbles pushed)
NAND(A, B)OR(A′, B′)
NOR(A, B)AND(A′, B′)
AND(A, B)NAND(A, B) + bubble on output

Rule: Adding/removing two bubbles on the same line cancels out (double negation).