Why Circuits Need Memory
Every gate-only circuit you've built so far forgets its inputs the instant they change. Here's the feedback trick that lets a circuit remember, and why it doesn't collapse into an infinite loop.
An adder gives the same answer every time you feed it the same inputs. That reliability is what makes it trustworthy. But the output depends only on what is present right now, which also makes it useless the moment you need it to hold on to something.
Combinational Logic: A Pure Function of Its Inputs
Half adders, multiplexers and majority voters all belong to one family: combinational logic. A combinational circuit computes output = f(inputs) with no dependence on time. Feed it the same inputs twice and it answers twice the same way, with nothing in between remembered or carried forward from the first time to the second. Most of digital logic works this way. Circuits whose output depends on a sequence of inputs rather than a single snapshot are called sequential.
But a computer needs more than math, and counting is the simplest place to see the gap. It has to hold a running total, remember which state a machine is in, and store a byte long after the signal that produced it has gone. None of that can be written as a pure function of the current inputs, because the whole point is that the answer depends on something no longer there: the history of the inputs.
The Trick: Route a Gate's Output Back Into Itself
Now wire a gate's output back into one of its own inputs, either directly or through a neighboring gate that loops back. Something changes. The output is no longer a pure function of the outside inputs, because that old output is now literally one of the signals feeding the gate.
Why This Doesn't Blow Up Into an Infinite Loop
A feedback loop in software that recomputes a value from itself is usually a bug. In a circuit it is not, and the reason is delay. Gates are not instant. Every gate takes a little time to pass a signal through, so a signal chasing itself around a loop does not recompute forever. It settles, because each pass around the loop changes the signal less than the last, until a pass finally changes nothing at all. After a handful of gate delays the loop reaches a value that agrees with itself, every gate's output matches what its inputs demand, and nothing moves after that. That settling is what makes the next three tutorials safe to build.
Where This Section Is Going
Three storage elements, built in order, each fixing a specific problem with the last.
SR latch -> two cross-coupled NOR gates, the smallest circuit that stores a bit
(has one input combination that is genuinely forbidden)
Gated D latch -> fixes the forbidden state by trading two inputs (S, R) for one (D)
(still reacts to a signal LEVEL, which causes race-through when chained)
D flip-flop -> fixes race-through by reacting to a clock EDGE instead of a level
(this is what real registers and counters are built from)By the end you will know what a register is made of, gate by gate. You will also know why every design decision along the way was forced by a specific limit of the one before it.