1. The Philosophy of Digital Logic
In an analog world of infinite gradients, digital logic imposes a strict binary order. A logic gate is both an idealized mathematical model and a physical semiconductor device. Conceptually, gates are the axioms of Boolean algebra. Physically, they are MOSFET transistors acting as voltage-controlled switches.
The key insight that powers all of computing is abstraction. An engineer designing an ALU doesn't need to know the exact drain current equations of each transistor — they rely on deterministic gate behavior to compose complex hierarchies from simple primitives.
2. The Triumvirate: AND, OR, NOT
Any Boolean expression — however complex — can be decomposed into combinations of AND, OR, and NOT. These three are called the functionally complete set.
Truth Tables for AND, OR, NOT
| A | B | AND (A·B) | OR (A+B) | NOT A (A') |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 |
3. Derived Gates: XOR & XNOR
XOR (Exclusive-OR) and XNOR are derived from the basic triumvirate and perform operations critical to arithmetic and comparison circuits.
| A | B | XOR (A⊕B) | XNOR (A⊙B) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
4. Universal Gate Theory
A gate is universal (or functionally complete) if any Boolean function can be implemented using only that gate type. This matters enormously for chip manufacturing — one optimized cell type can be used everywhere.
Proof of universality requires showing that AND, OR, and NOT can each be derived from a single gate type. Both NAND and NOR satisfy this requirement. XOR alone does NOT — it cannot produce a NOT gate independently.
5. The NAND Gate — Complete Implementation
NAND is the complement of AND — its output is LOW only when ALL inputs are HIGH. Using De Morgan's theorem: (A·B)' = A' + B'. Deriving all basic gates from NAND:
NOT from NAND
Tie both inputs together.
Y = (A·A)' = A'AND from NAND
NAND → NAND inverter.
Y = ((A·B)')' = A·BOR from NAND
Invert both inputs, then NAND.
Y = (A'·B')' = A+BNOR from NAND
OR-from-NAND, then invert output.
Y = (A+B)' using 5 NANDXOR from NAND
Classic 4-NAND implementation.
Y = A⊕B (4 gates)| A | B | NAND (Y) |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
6. The NOR Gate — Complete Implementation
NOR is the dual of NAND. Its output is HIGH only when ALL inputs are LOW. While also universal, NOR gates in CMOS require larger PMOS transistors (lower hole mobility), making NOR-based designs slower and larger than equivalent NAND designs.
NOT from NOR
Tie both inputs together.
Y = (A+A)' = A'OR from NOR
NOR → NOR inverter.
Y = ((A+B)')' = A+BAND from NOR
Invert both inputs, then NOR.
Y = (A'+B')' = A·B7. CMOS vs TTL Logic Families
TTL (Transistor-Transistor Logic)
TTL uses Bipolar Junction Transistors (BJTs). Current flows through the base-emitter junction to switch between states. Standardized at 5V supply voltage. Advantages: fast switching, high drive strength, good noise immunity. Disadvantages: significant static power consumption even when idle, limited supply voltage range.
CMOS (Complementary Metal-Oxide-Semiconductor)
CMOS uses complementary pairs of PMOS and NMOS transistors. When PMOS is ON, NMOS is OFF, and vice versa — creating a low-resistance path to either VDD or GND, with ideally no DC path between them. This means near-zero static power. Power is only consumed during transitions (charging/discharging parasitic capacitances).
| Parameter | TTL (74LS) | CMOS (74HC) | CMOS (3.3V) |
|---|---|---|---|
| Supply Voltage | 5V | 2–6V | 3.3V |
| Static Power | ~1 mW/gate | <0.1 µW/gate | <0.01 µW/gate |
| Propagation Delay | ~10 ns | ~7 ns | ~4 ns |
| Noise Margin | 0.4V | 1.0V | 0.9V |
| Fan-Out | 10 TTL loads | 50+ CMOS | 50+ CMOS |
8. Engineering Performance Metrics
- Propagation Delay (tpd): Time from input change to output settling. Defined at the 50% crossing. CMOS: 1–10 ns typical. Critical path delay limits max clock frequency.
- Fan-Out: Max number of gate inputs one output can drive without violating VOL/VOH spec. Exceeding fan-out degrades noise margin and increases propagation delay.
- Power-Delay Product (PDP): Energy per switching event = P × tpd. Lower is better. The figure of merit for comparing logic families.
- Noise Margin: VNMH = VOH,min − VIH,min and VNML = VIL,max − VOL,max. The guaranteed voltage margin before a logic level is misinterpreted.
- Rise/Fall Time (tr/tf): Time for output to transition from 10% to 90% (or 90% to 10%) of supply voltage. Faster transitions reduce short-circuit power.
9. Positive vs. Negative Logic
The mapping of voltages to logic values is a design convention, not a physical fact. Under positive logic: HIGH voltage = 1, LOW = 0. Under negative logic: HIGH = 0, LOW = 1.
Under negative logic, an AND gate physically behaves as an OR gate (provable by De Morgan's theorem). This duality is exploited in active-low signals — common in control buses where asserting a signal means pulling it LOW. The CS# (chip select) and WE# (write enable) signals in DRAM are active-low, meaning the hardware performs a NOR-like check: "if CS# is low AND WE# is low, write."
10. Building Combinational Circuits
Logic gates combine into combinational circuits where outputs depend only on current inputs (no memory). The design process:
- Specify: Define inputs, outputs, and the functional requirement in words.
- Truth Table: Enumerate all 2n input combinations and desired outputs.
- Simplify: Use K-Maps or Boolean algebra to minimize the expression.
- Realize: Map the simplified expression to gates — typically NAND-NAND or NOR-NOR for standard cells.
11. Logic Gates in Modern VLSI
Modern chips don't place individual transistors; engineers work with standard cell libraries — pre-characterized gate cells (AND2, NAND3, OAI21, etc.) with known timing, power, and area specs. Synthesis tools map RTL (Verilog/VHDL) → gate netlist → layout automatically.
- Complex gates (AOI/OAI): AND-OR-INVERT and OR-AND-INVERT gates implement 2-level logic in fewer transistors than cascaded simple gates.
- Multi-drive cells: The same logic function in X1, X2, X4, X8 drive strengths — synthesis picks the right size based on fan-out and timing needs.
- LUTs in FPGAs: FPGA "gates" are 4–6 input Look-Up Tables (LUTs) — small RAMs storing any truth table. One LUT can implement any 4-input Boolean function.
- Transmission gates: A PMOS + NMOS pair passing signal bidirectionally, used in multiplexers, flip-flops, and XOR implementations for lower gate count.
12. Deep Engineering FAQ
Why are NAND gates preferred over NOR in CMOS VLSI?
In a CMOS NAND gate, the NMOS transistors (pull-down) are in series. NMOS has high electron mobility — series NMOS is fast. In a NOR gate, the PMOS transistors (pull-up) are in series. PMOS has lower hole mobility (~half of NMOS), requiring physically larger transistors to match speed, consuming more area and power.
What is a Schmitt Trigger input?
A Schmitt Trigger uses hysteresis — two different threshold voltages for rising and falling edges (VT+ and VT−). Noisy slow signals that hover near a threshold cause multiple toggles on standard inputs. The Schmitt Trigger fires once cleanly. Used in touch sensors, button debouncing, and communication receivers.
What is an Open-Drain output?
The gate can only pull output LOW (drive to GND), never HIGH. An external pull-up resistor supplies the HIGH state. Multiple open-drain outputs on the same wire perform a "Wired-AND" — if any gate drives LOW, the bus is LOW. This is the basis of I²C and one-wire protocols.
Explain the race condition in gate logic.
When input signals travel through paths of different lengths (gate counts), they arrive at a final gate at different times. The transient incorrect output during this propagation window is called a glitch. In clocked synchronous design, glitches are tolerated because the output is only sampled after all transients settle. In asynchronous logic, glitches can cause incorrect latching.
What is the Power-Delay Product and why does it matter?
PDP = Power × Propagation Delay = energy consumed per switching event. It's the fundamental trade-off metric: faster gates dissipate more power, power-efficient gates are slower. Sub-threshold CMOS operates below Vth for ultra-low power at the cost of 1000× slower speed.
Can XOR gates alone implement any Boolean function?
No. XOR gates are not functionally complete. The XOR function is self-dual and cannot produce a constant output independent of inputs — meaning NOT cannot be reliably implemented from XOR alone. You need at least one gate capable of producing a constant (NAND, NOR, or AND+NOT) to achieve functional completeness.
Logic Gate Simulator — 3 Tools
Gate Truth Table · Universal NAND Builder · Expression Evaluator
Select which gate to build from NAND gates only. Toggle inputs A and B to verify the output matches the target gate.
Toggle A and B to evaluate all expressions simultaneously.