In this lesson, you will learn how to build a "memory cell" using only standard logic gates that can hold onto a bit of information indefinitely.
The Problem with Combinational Logic
Everything we have built so far—adders, multiplexers, and decoders—is combinational. The output depends solely on the current inputs. If you remove the input, the output vanishes. To build a computer, we need sequential circuits: circuits that "remember" their previous state even after the inputs change.
The Feedback Loop
The secret to memory is feedback. Imagine taking two NOR gates and connecting the output of each to one of the inputs of the other. This is called a cross-coupled pair.
Let's look at the logic flow:
Q = NOT (R OR Q_bar)
Q_bar = NOT (S OR Q)
In this setup, the output Q is fed back into the input of the gate creating Q_bar, and vice-versa. Because these gates are "locked" together, the circuit enters a bistable state.
- Stability: If
Qis1, it forcesQ_barto be0(because of theNORgate logic). BecauseQ_baris0, the first gate sees0and0as inputs, which keepsQat1. It reinforces itself! - Persistence: Because the output is fed back to the input, the circuit doesn't need external help to stay in its current state. It is trapped in a stable loop of
1s and0s.
Why "Bistable"?
A bistable element has two stable equilibrium points: Q=1 (and Q_bar=0) or Q=0 (and Q_bar=1). We can "set" the circuit to 1 or "reset" it to 0 by briefly pulsing the external inputs. Once the pulse is removed, the cross-coupling ensures the circuit stays in that state. This is the fundamental building block of static memory—the "1-bit" of data that forms the heart of all registers and internal storage in your processor.
Key Takeaway: By creating a feedback loop between two logic gates, we create a bistable circuit that maintains its state indefinitely, effectively allowing hardware to "remember" binary information.