SR Latch Demonstration
Set-Reset latch with S and R inputs. Learn basic memory storage using cross-coupled gates and bistable operation.
배울 내용
- Identify the SR latch as the simplest memory element.
- Recognize the four input combinations: Set, Reset, Hold, Forbidden.
- Trace the cross-coupled feedback that creates bistable storage.
- Distinguish level-sensitive latches from edge-triggered flip-flops.
- Apply SR latches to debounce, arbitration, and SRAM cells.
작동 원리
An SR latch is the simplest memory element — two cross-coupled NOR (or NAND) gates that can hold one bit indefinitely. It has two inputs (S = Set, R = Reset) and two complementary outputs (Q, ¬Q). The cross-coupling creates a bistable feedback loop: when both inputs are quiet, whatever value is currently on Q stays there.
NOR-based active-high SR latch behaviour: - Set (S=1, R=0): Q goes to 1 (and stays there after S returns to 0). - Reset (S=0, R=1): Q goes to 0 (and stays there). - Hold (S=0, R=0): Q keeps its previous value — the latch "remembers." - Forbidden (S=1, R=1): Both inputs high force both outputs to 0 simultaneously, breaking the Q = ¬Q invariant. When inputs return to 00 the final state depends on which input releases last — non-deterministic.
The SR latch is the seed of all sequential logic. Every flip-flop, register, and SRAM cell starts with two cross-coupled inverters (effectively a SR latch with hidden control). Latches were used as registers throughout early CPUs before edge-triggered flip-flops became dominant.
Key insight: latches are level-sensitive (output reflects input continuously while enabled), unlike flip-flops which are edge-triggered (output samples only on a clock edge).
진리표
SR latch behaviour table. Q' is the previous Q value (memory). Forbidden state when S=R=1.
| 입력 | 출력 | |||
|---|---|---|---|---|
| S | R | Q | Behaviour | |
| 0 | 0 | 0 | Hold — Q stays at previous value | |
| 0 | 1 | 0 | Reset — Q forced to 0 | |
| 1 | 0 | 1 | Set — Q forced to 1 | |
| 1 | 1 | 0 | Forbidden — both outputs go to 0, invariant broken | |
불 대수식
Next-state equation: Q is set if S asserted, kept if Reset is low, cleared if Reset asserted.
Cross-coupled NOR implementation. The two outputs feed each other's NOR inputs.
단계별로 시도해 보세요
위 임베드에서 입력을 설정한 후, 예상 결과를 읽고 직접 확인하세요.
- 1S = 1 R = 0예상:
Q = 1관찰 포인트: Set the latch — Q goes high. Now release S back to 0 and Q stays high. The latch remembers. - 2S = 0 R = 0예상:
Q unchanged관찰 포인트: After setting, both inputs low → latch holds. Q stays at whatever it was. This is the memory function. - 3S = 0 R = 1예상:
Q = 0관찰 포인트: Reset — Q drops to 0. Release R and Q stays at 0. Latch now in the reset state, awaiting next Set. - 4S = 1 R = 1예상:
Both Q and ¬Q = 0 (forbidden)관찰 포인트: Forbidden state — the latch breaks its Q = ¬Q invariant. When inputs return to 00, the final state is unpredictable. Avoid in real designs.
사용된 구성 요소
실제 응용 사례
SRAM cell. A 6-transistor SRAM cell is two cross-coupled inverters with access transistors — functionally an SR latch with bit-line control. Every byte of cache memory in a modern CPU is millions of these.
Bus master arbitration. A two-master arbiter often uses an SR latch where Set comes from master A's request and Reset comes from master B's. The latch state determines who currently owns the bus.
Push-button debouncing. A bouncing physical switch generates multiple transitions; an SR latch with the bounce-up signal on Set and bounce-down on Reset filters noise into a single clean transition.
Manual reset circuits. Many embedded systems use SR latches to capture power-on reset until firmware acknowledges and clears it.
Race-condition detectors. Two parallel signals racing into Set and Reset; whichever wins determines the latch state. Used in metastability detectors and arbiter circuits.