S R → Q1 0 → 1 set0 1 → 0 reset0 0 → Q hold1 1 → ✗ invalid010101010101RSS̄R̄QQ̄NORNANDNORNAND
Lit wire with moving dashes: it carries a 1Lamps: a glowing lamp shows 1, a dark one 0Gate block: its symbol is on top, its name on the frontBit token: a new output value travelling round the feedback loopTwo NOR gates wired in a loop: Q feeds gate 2 and Q̄ feeds gate 1, so each output holds the other steady. S = 1 sets Q to 1, R = 1 resets it to 0, and with both at 0 the loop keeps the last value; a bit token rides the feedback wire each time an output changes. A circuit whose output depends only on its inputs right now is called combinational (gates, adders, the ALU). Feedback makes a circuit sequential: its output also depends on what happened before (Harris and Harris, Digital Design and Computer Architecture, section 3.2). The NAND form has active-low inputs S̄ and R̄ (rest at 1, act at 0). Texas Instruments puts four in one chip: the SN74LS279A, "quadruple S̄-R̄ latches" (two of the four have two S̄ inputs).

Two gates, one loop

  1. Start with two NOR gates. A NOR gate outputs 1 only when both of its inputs are 0; any 1 going in makes its output 0. Gate 1 will make an output called Q, gate 2 one called Q̄ (say Q-bar).

Set, hold, reset

Rules and variants

Gate by gate

;; step 1/9 · two-nor
;; about: Gate 1, Gate 2
NOR = NOT OR

A B → out
0 0 → 1
0 1 → 0
1 0 → 0
1 1 → 0

Only 0 and 0 give a 1.

In the figure the gates change one after another so you can follow the loop. In a real chip each gate takes a tiny delay (nanoseconds or less), so the whole loop settles almost at once. In Python, | on the numbers 0 and 1 is OR, so NOR of two bits is 1 - (a | b). The loop runs a few times so the two gates can settle.