New: AI Part GeneratorFree to get started

Logic gates, flip-flops & registers

Lesson 21 of 411 min read

A logic gate is a small transistor circuit that combines binary inputs into an output by a fixed rule. AND outputs 1 only when all inputs are 1. OR outputs 1 when any input is. NOT inverts, and XOR flags a difference. Each gate is fully described by its truth table. Chain gates so outputs feed the next stage’s inputs and you have combinational logic, where the output depends only on the current inputs.

Computation also needs memory, which is the flip-flop’s job. It’s a gate circuit wired in a loop so it holds one bit, changing only at the edge of a clock pulse. Line up eight flip-flops on a shared clock and you have a register storing a byte. This is sequential logic: the output depends on stored history, not just the present inputs.

From here it’s a matter of scale. Gates form adders, registers hold the operands, and a controller sequences the steps. That really is what a CPU is, repeated billions of times over. Nobody draws individual gates for a processor anymore, but every digital chip still reduces to gates plus flip-flops.

Key points

  • Gates (AND, OR, NOT, XOR) map input combinations to outputs by fixed truth tables.
  • Combinational logic depends only on current inputs. Sequential logic adds stored state.
  • A flip-flop stores one bit and updates on a clock edge. Registers are rows of flip-flops.
  • Adders, memory, and full CPUs are the same two elements repeated at enormous scale.

Practice

0 of 2 answered · Not started

Wrong answers just let you try again, and hints are there if you want them. Answering every question first time, without hints, is what earns mastery.

  1. 1

    What does a flip-flop add that a combinational gate does not have?

  2. 2

    Why is NAND described as a universal gate?