Flip-Flops

Sequential logic circuits that store binary information: SR, JK, D, and T flip-flops.

The Building Block of Digital Memory

A flip-flop is a fundamental digital circuit capable of storing a single bit (a 0 or a 1) of information. Unlike simple logic gates whose output is a direct function of their current inputs, a flip-flop's output depends on both the current inputs and its previous state. This ability to "remember" its past state makes it the basic building block of memory and a cornerstone of sequential logic.

Sequential vs. Combinational Logic

To understand flip-flops, it's crucial to distinguish between two types of digital circuits:

  • : These circuits perform operations that are purely a function of the present inputs. They have no memory.
  • : These circuits have memory. Their output depends not only on the current inputs but also on the circuit's previous state. Flip-flops are the primary elements used to create sequential logic.

The Basic Building Block: The SR Latch

The simplest form of a flip-flop is the SR Latch (Set-Reset Latch), constructed from two cross-coupled NOR gates or NAND gates. It has two inputs, S (Set) and R (Reset), and two outputs, Q and its complement Qˉ\bar{Q}.

Schematics of an SR Latch made from NOR gates and NAND gates.

Operation of an SR Latch (NOR version)

  • Set (S=1,R=0S=1, R=0): The Q output is forced to '1', and Qˉ\bar{Q} becomes '0'. The latch "remembers" the Set state.
  • Reset (S=0,R=1S=0, R=1): The Q output is forced to '0', and Qˉ\bar{Q} becomes '1'. The latch "remembers" the Reset state.
  • Hold/Memory (S=0,R=0S=0, R=0): The outputs Q and Qˉ\bar{Q} retain their last state. This is the memory-holding state.
  • Forbidden State (S=1,R=1S=1, R=1): This input combination forces both Q and Qˉ\bar{Q} to '0', which violates the rule that they must be complements. If the inputs then change back to S=0, R=0 simultaneously, the final state is unpredictable. This instability makes this input combination forbidden.

Synchronization: The D Flip-Flop

To make latches more practical and predictable, we add a control input called a . The D (Data or Delay) flip-flop is the most common type used in modern electronics because it completely solves the "forbidden state" problem of the SR latch.

Schematic of an edge-triggered D flip-flop, built from an SR latch with additional gates.

The D flip-flop has only one data input, D. Internally, an inverter ensures that the Set and Reset inputs of the underlying latch always receive opposite values, eliminating the forbidden S=R=1 condition.

How It Works

An D flip-flop samples the value at its D input at the precise moment of a clock edge (e.g., the rising edge). The value it sees is then stored and appears at the Q output, where it remains until the next clock edge. Its behavior is simple: Qnext=DQ_{\text{next}} = D.

Versatile Flip-Flops: JK and T

Logic symbols for JK and T flip-flops, along with the JK truth table.

The JK Flip-Flop

The JK flip-flop is a more versatile version of the SR flip-flop. It has inputs J (analogous to Set) and K (analogous to Reset). It behaves like an SR flip-flop, but it intelligently handles the J=1, K=1 condition by turning it into a useful "Toggle" state.

  • J=0,K=0J=0, K=0: Hold state (no change).
  • J=1,K=0J=1, K=0: Set state (Q=1Q=1).
  • J=0,K=1J=0, K=1: Reset state (Q=0Q=0).
  • J=1,K=1J=1, K=1: Toggle state (the output QQ flips to its opposite value).

The T Flip-Flop

Logic symbols for T flip-flop.

The T (Toggle) flip-flop is a simplified version of the JK flip-flop where the J and K inputs are tied together. It has only one input, T. If T=1T=1, the output toggles on each clock pulse. If T=0T=0, the output holds its state. Its primary application is in building binary counters and frequency dividers, as each T flip-flop in a chain divides the clock frequency by two.

Applications of Flip-Flops

Flip-flops are fundamental to nearly all digital systems. Their ability to store state enables a vast range of applications:

  • Registers: Groups of D flip-flops are used to create registers, which can store multi-bit data words (e.g., an 8-bit register stores a byte). Registers are at the heart of CPU operations.
  • Static RAM (SRAM): The fast memory used for CPU caches is built from arrays of flip-flops. Each flip-flop holds one bit of the cache's data.
  • Counters: Chains of T or JK flip-flops are used to build digital counters that can count events or clock pulses.
  • Frequency Dividers: A T flip-flop naturally divides the frequency of its input clock signal by two, a crucial function in timing circuits.
    Flip-Flops | Teleinf Edu