Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

Flip-flop conversion: a D flip-flop from a JK, live

To convert one flip-flop type into another, you drive the inputs of the flip-flop you have with logic computed from the inputs you want, and sometimes from Q. The simplest case runs live here: a D flip-flop from a JK flip-flop needs only J = D and K = NOT D.

The method is always the same. Write the characteristic table of the flip-flop you want (what Q should become for each input), use the excitation table of the flip-flop you have (which inputs produce each change of Q) to find what its inputs must be, and simplify with a K-map. For JK to D: when D = 1, Q must become 1, which J = 1, K = 0 does; when D = 0, Q must become 0, which J = 0, K = 1 does. So J = D and K = NOT D, with no dependence on Q. The JK flip-flop here is the master-slave JK from NAND gates, saved as a part, so Q changes on the falling clock edge. The table below lists the other common conversions; two of them are live builds too, the T flip-flop from a D flip-flop and the JK flip-flop from a D flip-flop.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

What you need

Step by step

  1. Write the D flip-flop's characteristic table: Q next = D.
  2. From the JK excitation table, Q going to 1 needs J = 1 (K = 0 or don't-care) and Q going to 0 needs K = 1 (J = 0 or don't-care).
  3. Choose J = D and K = NOT D, which satisfies both rows whatever Q is.
  4. Wire D to J and, through a NOT gate, to K. Turn CLR off and change D: Q copies it on the next falling clock edge.

Common flip-flop conversions

WantHaveConnect
DJKJ = D, K = NOT D
TJKJ = K = T
SRJKJ = S, K = R (S = R = 1 not allowed)
JKDD = J Q' + K' Q
TDD = T XOR Q
SRDD = S + R' Q
DTT = D XOR Q
JKTT = J Q' + K Q
JKSRS = J Q', R = K Q
DSRS = D, R = NOT D
TSRS = T Q', R = T Q

Each row comes from the same method: the wanted flip-flop's characteristic table and the existing flip-flop's excitation table. The live circuit, the first row, is checked over 10 clocks before the page is built.

You can also read the full theory in the lesson on flip-flop types and excitation tables. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

Build more parts from gates

half adderfull adderhalf subtractorfull subtractor2:1 multiplexer4:1 multiplexerXOR gate from NAND gates2-to-4 decoderSR latchD flip-flopJK flip-flopT flip-flop4-bit shift register4-bit ripple carry adderD latch1-to-4 demultiplexer4-bit magnitude comparator4-bit ring counter4-bit Johnson counter4-to-2 priority encoder4-bit synchronous counter3-to-8 decoder8-to-1 multiplexer4-bit carry lookahead adderhalf adder from NAND gates2-bit comparatorBCD to 7-segment decoder4-bit up/down counterdecade counter2-bit multiplier4-bit ALU4-bit array multiplierNOT, AND, OR and NOR from NANDNOT, OR, AND and XOR from NORfull adder from NAND gatesSR latch from NAND gatesparity generator and checker4-bit adder/subtractorBCD adder4-bit universal shift registermod-6 counter4-bit ripple counterbinary to Gray code converterhalf adder from NOR gatesfull adder from NOR gates4-bit register with parallel load1011 sequence detectorbinary to BCD converterD flip-flop from NAND gates1-bit ALUCMOS inverterCMOS NAND gateCMOS NOR gatePISO shift registerSR flip-flop from NAND gatesBCD to excess-3 code converterHamming (7,4) code encoder and correctortraffic light controller4-bit barrel shifterCMOS AND gateCMOS OR gateCMOS XOR gate1-bit magnitude comparatorhalf subtractor from NAND gatesfull subtractor from NAND gates8-to-3 encoderGray to binary converter4-to-16 decoderfull adder using 4:1 multiplexersedge detectorserial adder4-bit carry-select adderMealy machine (1011 detector)master-slave JK flip-flop (NAND)half subtractor from NOR gates1-to-8 demultiplexerexcess-3 to BCD code convertervending machine FSM4-bit carry-save adder3-bit synchronous counter (JK)CMOS transmission gatetri-state buffer (CMOS)2-to-1 mux from transmission gatesmod-5 counter8-bit ALUdecimal to BCD encoderBCD to decimal decoder4-to-1 mux from 2-to-1 muxesXOR gate from NOR gates

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the flip-flop conversion (JK to D) in the lab →

Frequently asked

How do you convert a JK flip-flop to a D flip-flop?

Connect J = D and K = NOT D. Then D = 1 sets the flip-flop and D = 0 resets it on the clock edge, which is exactly what a D flip-flop does.

How do you convert a D flip-flop to a T flip-flop?

Feed D = T XOR Q. With T = 0, D = Q and the flip-flop holds; with T = 1, D = NOT Q and it toggles.

How do you convert an SR flip-flop to a JK flip-flop?

Use S = J AND NOT Q and R = K AND Q. Gating with Q means S and R are never both 1, and J = K = 1 makes the flip-flop toggle instead of hitting the forbidden state.

What is an excitation table?

A table that lists, for each change of Q you want (0 to 0, 0 to 1, 1 to 0, 1 to 1), the flip-flop inputs that cause it. It is the characteristic table read backwards, and it is what you design with.