Flip-Flops and Their Types
By Amiro
What a flip-flop is (a one-bit memory built from a feedback loop) and how the four types, SR, JK, D and T, decide what the stored bit becomes at each clock edge.
A lesson of Digital Electronics
Transcript
- 0:00 Flip-flops: how a digital circuit remembers a single bit.
- 0:04 Start with an inverter, also called a NOT gate. Feed it a one, and out comes a zero. Feed it a zero, and out comes a one.
- 0:13 Now join two inverters in a loop, so that each one feeds the other.
- 0:18 Say Q, on the right, is one. The bottom inverter turns it into a zero. That zero, called Q bar, goes into the top inverter, which turns it back into a one. The loop holds itself.
- 0:31 Q equal to zero is just as stable. Two stable states mean the loop can store one bit.
- 0:38 A flip-flop wraps this loop in a box. Inputs come in on the left, and the outputs, Q and its opposite, Q bar, leave on the right.
- 0:47 A flip-flop also has a clock input: a signal that ticks between zero and one. The flip-flop only updates at a rising edge, the instant the clock goes from zero to one.
- 0:58 The first type is the S R flip-flop. S stands for set, and R for reset. The table shows what Q becomes after the next clock edge.
- 1:09 With both inputs at zero, Q holds its value. R equal to one resets Q to zero. S equal to one sets Q to one. In one line: Q next equals S, or R bar and Q.
- 1:23 But S and R both at one would ask for Q to be one and zero at the same time. That input is forbidden.
- 1:31 The J K flip-flop fixes this. It works just like S R, but when J and K are both one, Q toggles: it flips to its opposite.
- 1:41 The D flip-flop, D for data, has just one input. At each rising edge of the clock, Q simply copies D.
- 1:50 Here is a timing diagram. At every rising edge, the flip-flop reads D, marked by the dots, and Q takes that value. In between edges, Q holds.
- 2:01 Notice this short blip on D. It starts and ends between two edges, so Q never sees it.
- 2:08 The T flip-flop, T for toggle, also has one input. T equal to zero holds Q. T equal to one flips Q at every edge.
- 2:19 Here T stays at one, so Q flips on every rising edge of the clock.
- 2:24 Q now repeats every two clock cycles: half the clock's frequency. Chain T flip-flops together, and you get a binary counter.
- 2:33 So, the four types. S R sets and resets. J K does the same, and can also toggle. D copies its input, which makes it the building block of registers and memory. And T toggles, for counters and frequency dividers.
- 2:50 Every flip-flop stores one bit. Its inputs decide what that bit becomes at the next clock edge.
More explanations on Sifr