Start with two NOR gates. Recall NOR: output is 1 only when both inputs are 0.
NOR(a,b)=a+b
Cross-couple them: feed each gate's output into the other's input. This is the SR latch.
Inputs: S (Set), R (Reset).
Outputs: Q and Qˉ.
Q=R+Qˉ,Qˉ=S+Q
Why does this remember? Suppose S=0,R=0. Plug into the equations: Q depends on Qˉ, and Qˉ depends on Q. If Q=1 then Qˉ=0+1=0, and Q=0+0=1 ✓ — consistent. If Q=0 then Qˉ=1 and Q=0+1=0 ✓ — also consistent. Both are stable, so the circuit holds whatever it had. That holding is the memory.
We engineer this by gating S and R with the current state:
S=JQˉ,R=KQ
Why?J can only set when Q is already 0 (Qˉ=1); K can only reset when Q is already 1. So S and R are never both 1 — the forbidden state is structurally impossible.
J
K
Qnext
meaning
0
0
Q
hold
0
1
0
reset
1
0
1
set
1
1
Qˉ
toggle
Recall Feynman: explain to a 12-year-old
Imagine a light switch that's a bit special: it has two "push spots", SET and RESET. Push SET and the light stays ON even after you let go. Push RESET and it stays OFF. That "staying" is memory — the switch remembers the last push. The clever part is two gates whispering each other's answer in a loop, so they keep repeating the value forever. A D version has just one button: whatever you hold (0 or 1) when the bell (clock) rings, it remembers. A JK version adds a magic combo: press both buttons and the light flips to the opposite of whatever it was. Stack 8 of these and you can remember a whole number — that's how a computer remembers things!
Dekho, ek normal logic gate ki problem ye hai ki wo "bhulakkad" hota hai — input badla, output turant badal gaya, purani value gayab. Lekin computer ko cheezein yaad rakhni padti hain (RAM, registers, counters). Iske liye chahiye flip-flop — sabse chhota circuit jo ek bit (0 ya 1) ko store kar sakta hai. Iska jaadu ek hi cheez se aata hai: feedback. Gate ka output wapas usi ke input mein daal do, aur circuit khud ko ek state mein "latch" kar leta hai, hamesha ke liye hold karta hai.
SR latch do NOR gates ko cross-couple karke banta hai. S=1 karo to Q ban jata hai 1 (Set), R=1 karo to 0 (Reset), aur S=R=0 par wo apni purani value yaad rakhta hai — yahi memory hai. Par S=R=1forbidden hai, kyunki ye Q aur Qˉ dono ko 0 bana deta hai, jabki dono ek dusre ke opposite hone chahiye.
D flip-flop is forbidden problem ko fix karta hai — sirf ek data wire D do, aur jo D hoga wahi store ho jayega (Qnext=D). Clock ke edge par hi value capture hoti hai. 8 D flip-flops side-by-side = 8-bit register, yaani CPU ka ek register! JK flip-flop smart hai — wo J=K=1 wale case ko useful bana deta hai: toggle (bit ulta ho jata hai). Iski equation Qnext=JQˉ+KˉQ hai, aur ye internally S=JQˉ, R=KQ use karke forbidden state ko hi mita deta hai. Yaad rakhna: memory ka asli raaz "kuch nahi badal raha" nahi, balki feedback loop hai jo value ko khud regenerate karta rehta hai.