The forbidden stateS=R=1 makes Q and Q both equal — a contradiction — and the final state is a race condition.
The latch reacts to inputs immediately and at all times. In a real circuit signals arrive at slightly different moments ("glitches"), and the latch would flip randomly.
We solve #2 with a gate/enable, and #1 with the D trick.
What are the two states of a D latch and their names? → transparent (E=1, Q=D) and opaque/hold (E=0, Q=Qprev).
Write the characteristic equation. → Qnext=ED+EQ.
How does the D latch remove the forbidden state? → sets S=D,R=D, so S,R can't both be 1.
Latch vs flip-flop trigger? → level vs edge.
Recall Feynman: explain to a 12-year-old
Imagine a fridge with a magnetic note holder and a little lever. When you flip the lever on, whatever note you push against it sticks and shows up — and if you swap the note, the new one shows. When you flip the lever off, the last note stays frozen there, and even if you wave new notes in front, nothing changes. The lever is the enable, the note is the data D, and the note currently showing is Q. That's a D latch: it copies while the lever is on, and remembers while it's off.
Dekho, D latch samajhne se pehle SR latch ka problem samajh lo. SR latch me do inputs hote hain — Set aur Reset. Agar dono ek saath 1 ho jaayein to "forbidden state" ban jaati hai, output confuse ho jaata hai. Aur doosri problem — SR latch har waqt inputs sunta rehta hai, to circuit me chhote glitches se galat flip ho sakta hai. In dono problems ka solution hai gated latch aur D latch.
Gated latch me hum ek enable (E) wire add karte hain. Jab E=1 hai tabhi latch inputs ko sunta hai; jab E=0 hai to latch bas apni purani value hold karta hai — matlab yaad rakhta hai. Isse "kab sunna hai" ka control mil jaata hai. Phir D latch ek aur smart trick lagata hai: hum S=D aur R=D set kar dete hain. Ab S aur R hamesha ulte rahenge, dono kabhi 1 nahi ho sakte, to forbidden state gayab! Sirf ek clean data bit D store hota hai.
Iska magic formula yaad rakho: Qnext=ED+EQ. Iska matlab seedha hai — "agar enable on hai to D le lo, warna purana Q hold karo." Yeh bilkul ek 2:1 multiplexer jaisa hai jiska select line E hai. Jab E=1 latch transparent ho jaata hai (output = input directly), aur jab E=0 to opaque ho jaata hai (yaad rakhta hai).
Sabse important galti jo students karte hain: yeh sochna ki E=0 pe output 0 ho jaata hai — nahi bhai, E=0 pe output hold hota hai, purani value bachi rehti hai, wahi to memory ka point hai! Aur ek aur — D latch aur D flip-flop same nahi hain. Latch level-triggered hai (jab tak E=1 hai transparent rehta hai), flip-flop edge-triggered hai (sirf clock ke edge pe capture karta hai). Yeh difference exam me bahut poocha jaata hai.