The invalid state of the SR flip-flop is a drawback. The J-K flip-flop overcomes it by giving a useful action to the combination in which both inputs are 1. The T flip-flop is a simplified form used for counting.

J-K Flip-Flop

The J-K flip-flop has inputs J (set) and K (reset). J = 0, K = 0 leaves the state unchanged, J = 0, K = 1 resets Q to 0, and J = 1, K = 0 sets Q to 1. When J = K = 1 the output toggles, which means it changes to the opposite of its present value. Its characteristic equation is Q(t+1) = J·Q' + K'·Q.

Definition: J-K flip-flop. A flip-flop with inputs J and K that behaves like an SR flip-flop for all input pairs, and toggles its output when both inputs are 1.

Table 2.11: Truth table of the J-K flip-flop

J K Next state Q(t+1) Action
0 0 Q(t) No change
0 1 0 Reset
1 0 1 Set
1 1 Q'(t) Toggle

T Flip-Flop

The T flip-flop has a single input T. When T = 0 the state is unchanged, and when T = 1 the output toggles. Its characteristic equation is Q(t+1) = T ⊕ Q. It is obtained from a J-K flip-flop by connecting J and K together

Race-Around and Excitation

In a level-triggered J-K flip-flop with J = K = 1, the output can toggle several times during one clock pulse. This is called the race-around condition. It is avoided by using edge-triggered or master-slave flip-flops. An excitation table lists the inputs needed to cause a given change of state, as in Table 2.12.

Table 2.12: Excitation table of the flip-flops

Q(t) Q(t+1) S R D J K T
0 0 0 X 0 0 X 0
0 1 1 0 1 1 X 1
1 0 0 1 0 X 1 1
1 1 X 0 1 X 0 0

Example 2.6: Finding the output of a J-K flip-flop

Problem: A J-K flip-flop has Q = 0. Find Q after each clock edge for the inputs (J, K) = (1, 0), (1, 1), (1, 1), (0, 1).

Solution:

  1. (1, 0) sets the flip-flop, so Q = 1.
  2. (1, 1) toggles it, so Q = 0.
  3. (1, 1) toggles it again, so Q = 1.
  4. (0, 1) resets it, so Q = 0.

Result: The output sequence is 1, 0, 1, 0.

q = 0
for j, k in [(1, 0), (1, 1), (1, 1), (0, 1)]:
    q = (j & (1 - q)) | ((1 - k) & q)
    print("J", j, "K", k, "Q", q)

Output

J 1 K 0 Q 1
J 1 K 1 Q 0
J 1 K 1 Q 1
J 0 K 1 Q 0

Common mistakes

  • Treating J = K = 1 as an invalid state. It is the toggle state.
  • Confusing a T flip-flop with a D flip-flop. T toggles, D copies.
  • Ignoring the race-around condition in level-triggered J-K flip-flops.

Key takeaways

  • J-K: Q+ = JQ' + K'Q; J = K = 1 toggles the output.
  • T: Q+ = T xor Q; T = 1 toggles the output.
  • Joining J and K gives a T flip-flop.
  • Edge triggering avoids the race-around condition.

Practice questions

  1. What happens in a J-K flip-flop when J = K = 1?
  2. How is a T flip-flop obtained from a J-K flip-flop?
  3. What is the race-around condition?

Answers to the practice questions

  1. The output toggles to the opposite of its present value.
  2. By connecting J and K together to form the input T.
  3. Repeated toggling of a level-triggered J-K flip-flop during one clock pulse when J = K = 1.

Sources

  • Official BCA syllabus Computer Architecture, course code 25BCA401DS02, Unit II