Digital Logic · AI215

Latches and Flip-Flops: SR, D, JK and T Explained

Digital Logic Study guides

Latches and flip-flops are one-bit memory elements. Their output depends on current inputs and the stored state, which is what makes a circuit sequential.

Note for AI215 students: this topic is beyond this year's syllabus (coverage ends at lecture 3). It stays here for reference. An SR latch has Set and Reset inputs: S = 1 sets Q to 1, R = 1 resets Q to 0, S = R = 0 holds the state, and S = R = 1 is forbidden (invalid) in the NOR version because both outputs go low and the next state is unpredictable. A gated D latch is level-sensitive: while the enable (gate) is high, Q follows D; when it is low, Q holds. This avoids the forbidden state because D and its inverse drive S and R.

A flip-flop changes state only on a clock edge (edge-triggered), unlike a latch that is transparent for a whole level. The D flip-flop copies D to Q on the active edge. The JK flip-flop works like SR but J = K = 1 toggles the output instead of being forbidden. The T flip-flop toggles when T = 1 and holds when T = 0; it divides the clock frequency by two.

Asynchronous inputs, usually called preset and clear, act immediately and override the clock: they force Q to 1 or 0 regardless of the clock. Synchronous inputs (D, J, K, T) only matter at the clock edge. Flip-flops are the building blocks of registers and counters.

Key points

  • SR latch: S sets, R resets, S = R = 1 is invalid.
  • Gated D latch: Q follows D while enabled.
  • Flip-flops are edge-triggered; latches are level-sensitive.
  • JK: J = K = 1 toggles. T: toggles when T = 1.
  • Preset and clear are asynchronous inputs.

Worked example

A T flip-flop with T = 1 and a 1 kHz clock toggles on every clock edge, so Q is a 500 Hz square wave.

Common questions

What is an asynchronous input on a flip-flop?

An input such as preset or clear that acts immediately without waiting for the clock.

What does a JK flip-flop do when J = K = 1?

It toggles its output on each clock edge.