Master–slave JK flip-flop and flip-flop conversion
Master–slave JK flip-flops implement edge-triggered JK behaviour using two level-sensitive latches; you also convert between JK, D, T and SR flip-flops using excitation tables and simple Boolean equations.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Master–slave JK flip-flops provide an edge-triggered storage element used in counters, shift registers and synchronous sequential circuits where controlled toggling, set and reset are needed. Conversion between flip-flop types (JK, D, T, SR) is a common design step when a chosen IC is available as one type but the design needs another; using excitation tables and Boolean mapping saves time and reduces hardware.
Key ideas
Latch: a level-sensitive storage element whose output can change while an enable signal (often labelled EN or clock level) is active. A latch is different from an edge-triggered flip-flop.
Master–slave flip-flop: built from two cascaded latches (master and slave). One latch (the master) is enabled when clock is at one level; the other (the slave) is enabled when clock is at the opposite level. Because master captures inputs while slave is disabled, and slave updates output only after master is disabled, the combined pair produces an edge-triggered response (change occurs only when clock makes the enabling → disabling transition). Draw: two rectangles labelled MASTER and SLAVE in series; input lines J,K into master; outputs from master feed slave inputs; clock line goes to master enable and inverted clock to slave enable; final Q emerges from slave.
JK flip-flop: a flip-flop with inputs J and K and outputs Q, Q'. Characteristic equation (exact): Q_next = J·(not Q) + (not K)·Q. Define: toggle is when Q_next = not Q; this occurs for J = K = 1 in the JK flip-flop.
Characteristic equation: an expression giving Q_next in terms of current inputs and Q. For a JK flip-flop the characteristic equation shown above is the exact behaviour law used in derivations.
Excitation table: for each flip-flop type, this table lists required inputs to cause a given transition Q → Q_next. It is used to convert one flip-flop type into another by expressing required inputs (e.g., J, K) as Boolean functions of the source flip-flop inputs and Q.
Setup time and hold time: the minimum intervals before and after the active clock edge during which inputs must be stable for correct operation (definitions only here; numerical values are device-specific). Also, propagation delay (t_pd): the time from the active clock edge to the corresponding change at Q (for latches, from the enabling/input change to the output change); device-specific. Finally, metastability: a temporary indeterminate output state that can occur if setup/hold are violated; only mitigated probabilistically (characterized by resolution time constants/MTBF), not eliminated.
Construction and edge behaviour (what to draw): to illustrate a master–slave JK flip-flop, draw a gated JK latch as the master and a gated SR latch as the slave (equivalently, two gated SR latches with J/K feedback gating). Label: master latch inputs J, K, master output M and its complement; slave SR latch inputs S and R fed from M and M' respectively (no direct J/K connections on the slave), slave output Q. Draw clock line; show that master is enabled for clock = 1 (label ENABLE = CLK) and slave enabled for clock = 0 (label ENABLE = not CLK). Mark the edge where the output Q updates (the falling edge, i.e., 1→0) and state that this arrangement produces a negative-edge triggered flip-flop. This master–slave arrangement eliminates the race-around problem present in a level-sensitive JK latch when J=K=1 and the clock HIGH is long, because the slave is disabled while the master is sampling and only updates when the master is closed. If you want positive-edge triggering, invert the clock connections so master is enabled on CLK = 0 and slave on CLK = 1 (explain as remark).
Conversion principle: use the excitation table of the target flip-flop to express the target flip-flop inputs (as Boolean functions) in terms of the current Q and the desired next-state expression from the source flip-flop. Always show the excitation table and simplify expressions with Boolean algebra.
Formulas
Q_next = J·(not Q) + (not K)·Q — Q_next is next-state of the JK flip-flop; J and K are input logic levels (0 or 1); Q is present state. Unitless. Applies for the characteristic behaviour of an ideal JK flip-flop.
Excitation (JK): if Q=0 and Q_next=0 => J=0, K=X if Q=0 and Q_next=1 => J=1, K=X if Q=1 and Q_next=0 => J=X, K=1 if Q=1 and Q_next=1 => J=X, K=0 — Defines required J,K values for each present→next transition. X = don't care. Unitless. Used to derive mapping equations.
D = Q_next — For a D flip-flop, input D must equal the desired next-state. Unitless. Used when converting other flip-flops to D or implementing other behaviour using a D flip-flop.
T = Q XOR Q_next — For a T flip-flop, T must be 1 exactly when a toggle is required, i.e., when Q and Q_next differ. Unitless.
D = J·(not Q) + (not K)·Q — Use this when implementing a JK flip-flop using a D flip-flop. Unitless. (This is the JK characteristic written as D = Q_next.)
J = D·(not Q) and K = (not D)·Q — One convenient mapping to convert a D flip-flop into a JK flip-flop by feeding J and K computed from D and Q. Unitless.
T = J·(not Q) + K·Q — Mapping for converting JK inputs to an equivalent T input so a T flip-flop reproduces JK behaviour. Unitless.
S = J·(not Q) and R = K·Q — Mapping to implement a JK flip-flop using an SR latch without producing illegal S=R=1 condition. Unitless.
(Definitions: not means logical NOT, · means logical AND, + means logical OR, XOR is exclusive OR. All signals are digital logic levels, unitless.)
Worked examples
Example 1 — Convert a D input to JK inputs (design exercise): Problem: You have a D flip-flop available but the design requires a JK input that implements the same next-state as D. Find J and K in minimal form. Solution (step-by-step):
- Desired behaviour: Q_next = D. Use the JK excitation table.
- From excitation requirements, J must be 1 when Q=0 and Q_next=1; that condition is Q=0 and D=1 => J = D·(not Q).
- K must be 1 when Q=1 and Q_next=0; that condition is Q=1 and D=0 => K = (not D)·Q.
- For all other rows we can set don't-cares consistently by the formulas above.
- Final mapping: J = D·(not Q), K = (not D)·Q. This mapping guarantees the JK flip-flop will produce Q_next = D.
Example 2 — Implement JK using a D flip-flop (algebraic derivation): Problem: Given a JK flip-flop behaviour, produce a Boolean expression for the D input so a D flip-flop replicates JK behaviour. Solution:
- Start with JK characteristic: Q_next = J·(not Q) + (not K)·Q.
- For a D flip-flop we set D = Q_next. Therefore D = J·(not Q) + (not K)·Q.
- This is already minimal; you can implement it using two AND gates, one inverter for K, one OR gate. If Q' is not available from the flip-flop, add an inverter for Q; if a complement output Q' is provided, you can use it directly.
- Final: D = J·(not Q) + (not K)·Q (show wiring: J and not-Q into one AND; not-K and Q into another AND; OR outputs into D).
Example 3 — Convert JK inputs to a single T input (small truth-table check): Problem: For given J,K and present Q, compute T using T = J·(not Q) + K·Q and show that a T flip-flop will match JK behaviour. Solution (table):
- Let Q=0, J=1, K=0: T = 1·1 + 0·0 = 1; T=1 toggles Q to 1 (matches JK set).
- Let Q=1, J=0, K=1: T = 0·0 + 1·1 = 1; toggles Q to 0 (matches JK reset).
- Let Q=1, J=K=1: T = 1·0 + 1·1 = 1; toggles Q to 0 (but note JK with J=K=1 toggles; exact behaviour matches for this Q state). For all Q the mapping gives toggle when JK require it. Conclusion: T = J·(not Q) + K·Q correctly produces required toggling conditions.
Common mistakes
- Forgetting that JK has the toggle action at J=K=1 and treating it as an illegal S=R=1 state (confusing JK with SR latch behaviour).
- Using excitation table rows incorrectly: forgetting don't-care (X) entries and over-constraining J or K leading to wrong equations.
- Not simplifying mapping equations using current Q where appropriate (leaving redundant terms).
- Omitting propagation, setup or hold time mentions when asked about timing; or mixing level-sensitive latch timing with edge-triggered flip-flop timing.
For your exam
Typical question types:
- Definition/short note: define master–slave flip-flop, explain edge triggering, and draw the master–slave block diagram. Full marks: clear definitions, drawing of master and slave latches with clock and inverted clock lines, label of where Q changes (which edge) and brief explanation.
- Derivation: obtain the characteristic equation of JK and show how to implement JK using a D flip-flop. Full marks: write Q_next = J·not Q + not K·Q, then show algebraic substitution and final D = expression, with gate-level description.
- Conversion problem: given one flip-flop type (e.g., D or T) convert to JK or vice versa. Full marks: put the excitation table, derive equations step-by-step, simplify Boolean expression, optionally draw logic gate network.
- Timing question: specify setup/hold/propagation delays for a master–slave JK and explain metastability risk. Full marks: definition of each term, explanation of where hold time matters (around active edge), and mention metastability qualitatively.
Quick check
- Write the characteristic equation of a JK flip-flop.
- Using excitation table logic, what are J and K to implement D (i.e., make Q_next = D)?
- Give the Boolean expression to implement a JK flip-flop using a D flip-flop (D in terms of J, K and Q).
Answers: 1) Q_next = J·(not Q) + (not K)·Q. 2) J = D·(not Q), K = (not D)·Q. 3) D = J·(not Q) + (not K)·Q.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?