JK and T Flip-Flops, Characteristic and Excitation Tables
Describe D, T and JK flip-flops by equations, build T and JK from a D flip-flop, and run the tables backwards.
You Will Be Able To
- Write the characteristic equations of D, T and JK flip-flops.
- Build a T or JK flip-flop from a D flip-flop and a few gates.
- Derive an excitation table with its don't-cares.
- Explain the ones-catching problem of the master-slave JK flip-flop.
- Lesson
- G5.7
- Time
- 25 min
- Runs on
- Your browser
- Check
- 5 questions
Old counter designs are drawn with JK and T flip-flops, while a modern cell library offers D flip-flops. Each type is a D flip-flop with its own next-state logic in front. Its characteristic equation says what that logic is.
- Cycle 1
jk = 10: the edge sets
q. - Cycle 3
jk = 01: the next edge resets it.
- Cycle 5
jk = 11: the edge inverts
qto 1. - Cycle 7
Still 11: it inverts again, to 0.
- Cycle 9
jk = 00: hold.
Measured on the jk-ff circuit model below.
Characteristic Tables and Equations
A characteristic table gives the next state Q+ from the inputs and the present state Q. Written as Boolean algebra, it is the characteristic equation.
| Flip-flop | Inputs → Q+ | Characteristic equation |
|---|---|---|
| D | D = 0 → 0, D = 1 → 1 | Q+ = D |
| T | T = 0 → Q (hold), T = 1 → Q' (toggle) | Q+ = T ⊕ Q |
| JK | 00 hold, 01 reset, 10 set, 11 toggle | Q+ = JQ' + K'Q |
| SR | 00 hold, 01 reset, 10 set, 11 not allowed | Q+ = S + R'Q |
The JK flip-flop is an SR flip-flop whose forbidden input was turned into "toggle".
Building T and JK from a D Flip-Flop
Since a D flip-flop stores D, feed it the equation you want. That is how every flip-flop type is built on a library of D flip-flops.
- I/O
- Control / FSM
- Storage
- Control
- T
An XOR: T = 0 passes Q (hold), T = 1 inverts it (toggle).
- JK
JQ' + K'Q is a mux on Q: when Q = 0 it picks J, when Q = 1 it picks K'.
Read the diagram as text
- Inputs: T, or J and K
- Next-state logic: T ⊕ Q or JQ' + K'Q
- D flip-flop: stores D at the edge
- Q: output
- Inputs → Next-state logic
- Next-state logic → D flip-flop: D
- D flip-flop → Q
- D flip-flop → Next-state logic: Q fed back
Synthesized on this site, the lab's T and JK pair is 5 cells: two flip-flops, an XOR, a NOT and a mux.
Excitation Tables: The Tables Run Backwards
To design a counter, you know each change of state you want, Q to Q+. You need the inputs that cause it. That is the excitation table. Where either value of an input works, it is a don't-care, X.
| Q → Q+ | D | T | J K | S R |
|---|---|---|---|---|
| 0 → 0 | 0 | 0 | 0 X | 0 X |
| 0 → 1 | 1 | 1 | 1 X | 1 0 |
| 1 → 0 | 0 | 1 | X 1 | 0 1 |
| 1 → 1 | 1 | 0 | X 0 | X 0 |
Read each row from the characteristic equations. With Q = 0, JK gives Q+ = J, so K is free; with Q = 1, Q+ = K', so J is free.
The JK table has the most don't-cares. In G7.3 they shrink the next-state logic of a counter.
The Ones-Catching Problem
Older JK flip-flops were pulse-triggered. In this master-slave pair, the master listens to J and K for the whole high phase. Once the master has set, it cannot clear again in the same pulse.
The edge-triggered JK of the lab does not catch ones: its D input is sampled at the edge only. That is one reason designs now use D flip-flops with logic in front.
Asked in interviews
How do you make a T flip-flop from a D flip-flop?
Feed D = T xor Q. With T = 0 the flop reloads Q; with T = 1 it loads Q', so it toggles.
Convert a D flip-flop into a JK flip-flop.
Put D = JQ' + K'Q in front of it. When Q = 0 the next state is J; when Q = 1 it is K'. With J = K = 1 it toggles.
What is an excitation table used for?
For designing sequential circuits with a given flip-flop type. For each wanted change of state it lists the inputs that cause it. Don't-cares, where either value works, simplify the input logic.
Try It
After the reset edge both flip-flops are 0. With t = 1 the T flop toggles; with jk = 10 the JK flop sets.
jk = 11 toggles the JK flop on both edges: 1, then 0. The T flop with t = 1 toggles too, so the two outputs match on those edges.
Press Synthesize: 5 cells. Then replace t ^ qt with t and run again: the T flop no longer toggles.
Synthesize the design to measure its cells and inspect the mapped gates.
t=1 j=1 k=0 toggle / set qt=1 qjk=1 t=0 j=0 k=0 hold / hold qt=1 qjk=1 t=1 j=0 k=1 toggle / reset qt=0 qjk=0 t=1 j=1 k=1 toggle / toggle qt=1 qjk=1 t=1 j=1 k=1 toggle / toggle qt=0 qjk=0 t=0 j=0 k=0 hold / hold qt=0 qjk=0Original design · 5 cells · 2 flip-flops · 0 latches · 2 logic levels. Synthesis uses Yosys; counts depend on the toolchain.
Read included file: tb.sv
// tb.sv: one rising edge per line; the same t, j, k drive both flip-flops (read-only).
`timescale 1ns/1ns
module tb;
logic clk = 0, rst = 1, t = 0, j = 0, k = 0;
logic qt, qjk;
tjk dut (.clk(clk), .rst(rst), .t(t), .j(j), .k(k), .qt(qt), .qjk(qjk));
task automatic edge_with(input logic t_in, j_in, k_in, input string what);
t = t_in; j = j_in; k = k_in;
#5 clk = 1; #5 clk = 0;
$display("t=%b j=%b k=%b %-14s qt=%b qjk=%b", t, j, k, what, qt, qjk);
endtask
initial begin
#5 clk = 1; #5 clk = 0; rst = 0; // reset edge: both 0
edge_with(1, 1, 0, "toggle / set");
edge_with(0, 0, 0, "hold / hold");
edge_with(1, 0, 1, "toggle / reset");
edge_with(1, 1, 1, "toggle / toggle");
edge_with(1, 1, 1, "toggle / toggle");
edge_with(0, 0, 0, "hold / hold");
end
endmodule
Check Yourself
Common Mistakes
Wrong Read the characteristic table when designing a counter.
It answers "what will Q become?" The design question is the reverse: "which inputs give this change?"
Fix Use the excitation table, with its don't-cares, to fill the next-state map.
Wrong Build a T flip-flop by feeding t straight into D.
That is a D flip-flop on t: it copies t, it never toggles.
Fix Feed D = T xor Q, so t = 1 inverts the stored bit.
Wrong Expect JK = 11 to act like SR = 11.
For a JK flip-flop 11 is legal and toggles. In the lab it alternated 1, 0 on two edges.
Fix Q+ = JQ' + K'Q: with both at 1, Q+ = Q'.
Wrong Assume a pulse-triggered master-slave JK flip-flop only looks at J and K at the edge.
Its master is open for the whole high phase. A short 1 on J during that phase was caught and stored.
Fix Keep J and K stable while the clock is high, or use an edge-triggered D flip-flop with logic in front.
Remember
- Q+ = D, Q+ = T ⊕ Q and Q+ = JQ' + K'Q describe the D, T and JK flip-flops.
- A D flip-flop with its characteristic equation in front of D becomes any other type.
- An excitation table lists, for each change of state, the inputs that cause it, with don't-cares.
- A pulse-triggered master-slave JK catches a 1 on J or K during the high phase; edge-triggered designs do not.