D Flip-Flop Built from NAND Gates (Positive Edge, Master-Slave)
A positive-edge D flip-flop made of NAND gates: a master latch and a slave latch. Click D and CLK and watch Q copy D only when the clock goes from 0 to 1.
D Flip-Flop Explained: Truth Table, Circuit and Timing
Want to build your own circuit? Start a new circuit in the circuit simulator
Teaching with circuits?
Create a classroom, give your students a circuit to build, and review what they submit. Try it free with one classroom and up to 5 students.
Try the free classroom demoHow it works
Click the D and CLK inputs to switch them between 0 and 1. Q changes only when CLK goes from 0 to 1, and then it copies D. While CLK stays at 0 or at 1, changing D does not change Q.
The circuit is two gated D latches built from NAND gates. The master latch follows D while CLK is 0; the Master Q output shows it. When CLK rises, the master holds its value and the slave latch passes it to Q. Two NAND gates with their inputs joined work as inverters for the clock, and two buffers delay the master output and Q by one gate so the circuit starts in a steady state.
What's inside
- 17× Logic Gate