Practice

Flip flop and latch problems

Every sequential circuit is made of these. The problems start at the SR latch built from two NAND or NOR gates, add an enable, and work up to edge triggered flip flops built as master slave pairs.

196 problems14 free to solve57 easy, 86 medium, 53 hard

Then they turn one flip flop into another, trace the race around condition in a pulse triggered JK, and put a data change inside the setup and hold window to see what the output does.

What these problems cover

  • SR latches from NAND and NOR gates, and the forbidden state
  • Gated latches and the transparency window
  • Master slave and edge triggered D flip flops
  • JK and T flip flops, and the race around condition
  • Flip flop conversion: JK to D, D to T, T to JK and the rest
  • Asynchronous preset and clear, enables, clock to Q delay

Free to start

Solve these with a free account. Every other statement on this page is free to read.

Problems by track

Latches and Flip-Flops126

114 more in the Latches and Flip-Flops track

Gate-Level Logic2

Counters6

Shift Registers5

Clocking and Synchronization13

1 more in the Clocking and Synchronization track

Fault Testing and Verification2

Interface and Communication Circuits7

Interview Circuit2

Sequential RTL7

Synthesis Intuition2

Clock Domain Crossing and Synchronization2

More problems22

How your answer is checked

Circuit problems run on the circuit simulator against the problem's test vectors, clocked cycle by cycle when they are sequential. Verilog problems are compiled with Icarus Verilog and run against a testbench, with the waveform and the Yosys schematic beside the result. Analysis questions are checked against their answer key.

Questions

Can the simulator show a latch oscillating?
Yes. Feedback loops are simulated, so an SR latch built from gates holds its state, and a loop that never settles is reported as an oscillation instead of being hidden.
What is the difference between a latch and a flip flop here?
The same as on silicon. A latch follows its input while enabled; a flip flop takes it only on a clock edge. Several problems put both on one waveform so the difference is visible.