Sequential Logic Circuits: Flip-Flops, Registers, Counters, and Finite State Machines

Combinational vs. Sequential Circuits: Principles and Structural Models

Digital logic circuits are divided into two fundamental classifications: combinational circuits and sequential circuits. Their operational distinction lies in the presence or absence of memory elements and internal feedback.

A combinational circuit produces outputs that are solely a function of its current inputs at any given instant. It possesses no memory of past inputs or historical events. For any specified set of input variables, there is an immediate and unique output pattern, subject only to the physical propagation delays of the internal logic gates. Representative examples of combinational circuits include logic gates, adders, subtractors, multiplexers, demultiplexers, encoders, and decoders.

A sequential circuit produces outputs that depend not only on the present input values but also on the present state of the circuit. The present state is a stored representation of the history of past inputs, retained within internal memory elements. Consequently, applying an identical set of inputs to a sequential circuit at different times can yield entirely different outputs depending on the stored state.

Block diagram of a sequential circuit showing combinational logic and feedback memory

As shown in the block diagram, a sequential circuit consists of combinational logic coupled with a memory section constructed from flip-flops or latches. The combinational logic receives external inputs as well as present-state signals fed back from the flip-flops. It generates the circuit's external outputs and computes the next-state signals required to update the memory elements. A periodic clock signal (CLKCLK) synchronizes the updating of these memory elements across the system.

Sequential circuits serve as the foundation of digital computation, enabling counting, timing generation, temporary and bulk data storage, and the execution of finite-state decision logic.

The Set-Reset (SR) Latch and Flip-Flop

Memory cells that store a single binary bit (11 or 00) are categorized into latches and flip-flops. A latch is a level-sensitive device whose output changes immediately in response to input changes while enabled. A flip-flop is a synchronous, clock-controlled device whose state transitions occur exclusively at specific transitions (rising or falling edges) or active phases of a clock signal.

SR Latch Using Cross-Coupled NOR Gates

The fundamental 1-bit memory cell can be constructed using two cross-coupled NOR gates, designated as NOR 1 and NOR 2. The output of NOR 1 represents the true state (QQ), which is fed back into one of the inputs of NOR 2. The output of NOR 2 represents the complementary state (Q′Q'), which is fed back into one of the inputs of NOR 1.

SR Latch using cross-coupled NOR gates

The external inputs are Set (SS) and Reset (RR). The circuit exhibits active-high operation:

SS

RR

Q(next)Q(\text{next})

Operating State

00

00

QQ (hold)

No change (Memory)

00

11

00

Reset

11

00

11

Set

11

11

0/00 / 0

Invalid / Forbidden

When S=0S = 0 and R=0R = 0, the cross-coupling latches the present state, and the outputs remain fixed. Setting S=1S = 1 and R=0R = 0 forces the output QQ to 11 (Set). Setting S=0S = 0 and R=1R = 1 forces QQ to 00 (Reset). If both inputs are simultaneously asserted (S=1,R=1S = 1, R = 1), both NOR outputs are forced to logic 00, violating the complementary relationship Q≠Q′Q \neq Q'. Furthermore, if both inputs transition simultaneously from 11 to 00, the final state becomes indeterminate and unpredictable due to unequal propagation delays through the two gates.

SR Latch Using Cross-Coupled NAND Gates

An alternative implementation utilizes two cross-coupled NAND gates. In this configuration, the control inputs are active-low, commonly denoted as S′S' (or S‾\overline{S}) and R′R' (or R‾\overline{R}).

SR Flip-Flop using cross-coupled NAND gates

The behavior of the cross-coupled NAND latch is summarized below:

S′S'

R′R'

Q(next)Q(\text{next})

Operating State

00

00

1/11 / 1

Invalid / Forbidden

00

11

11

Set

11

00

00

Reset

11

11

QQ (hold)

No change (Memory)

Because the inputs are active-low, asserting S′=0S' = 0 (with R′=1R' = 1) sets the latch to Q=1Q = 1. Asserting R′=0R' = 0 (with S′=1S' = 1) resets the latch to Q=0Q = 0. When S′=1S' = 1 and R′=1R' = 1, the latch retains its previous state. The forbidden condition occurs when S′=R′=0S' = R' = 0, which forces both QQ and Q′Q' to logic 11.

Clocked SR Flip-Flop

To synchronize state updates with a system clock, steering logic is added to the basic latch. In the clocked SR flip-flop, two AND gates precede an internal NOR-based SR latch, with one input of each AND gate tied to a common clock line (CLKCLK).

Clocked SR Flip-Flop using AND gates and NOR latch

When CLK=0CLK = 0, both AND gates output logic 00, isolating the inputs SS and RR from the latch and maintaining the hold condition (Q(next)=QQ(\text{next}) = Q). When CLK=1CLK = 1, the AND gates permit the values of SS and RR to pass into the latch.

CLKCLK

SS

RR

Q(next)Q(\text{next})

State

00

XX

XX

QQ (hold)

No change (disabled)

11

00

00

QQ (hold)

No change

11

00

11

00

Reset

11

11

00

11

Set

11

11

11

Invalid

Forbidden (S⋅R≠0S \cdot R \neq 0)

Characteristic Equation, Characteristic Table, and Excitation Table

The algebraic relationship describing the next-state behavior of an SR flip-flop is given by its characteristic equation:

Q(next)=S+R′⋅QQ(\text{next}) = S + R' \cdot Q

This equation is valid strictly under the operational constraint:

S⋅R=0S \cdot R = 0

The characteristic table lists the next state (Qn+1Q_{n+1}) for every combination of inputs SS, RR, and present state (QnQ_n):

SS

RR

QnQ_n

Qn+1Q_{n+1}

00

00

00

00

00

00

11

11

00

11

00

00

00

11

11

00

11

00

00

11

11

00

11

11

11

11

00

−- (unspecified)

11

11

11

−- (unspecified)

The excitation table specifies the required input combination (SS and RR) to achieve a desired transition from a known present state (QnQ_n) to a designated next state (Qn+1Q_{n+1}):

QnQ_n

Qn+1Q_{n+1}

SS

RR

00

00

00

XX

00

11

11

00

11

00

00

11

11

11

XX

00

Here, XX denotes a don't-care condition. For example, to maintain a present state of 00 (Qn=0→Qn+1=0Q_n = 0 \rightarrow Q_{n+1} = 0), SS must be 00, while RR can be either 00 (hold) or 11 (reset).

Worked Example: State Progression

Consider an SR flip-flop initially at state Qn=0Q_n = 0.

  1. A clock pulse is applied with inputs S=1S = 1 and R=0R = 0:

Q(next)=S+R′⋅Q=1+(1⋅0)=1+0=1Q(\text{next}) = S + R' \cdot Q = 1 + (1 \cdot 0) = 1 + 0 = 1

The flip-flop sets to Q=1Q = 1.

  1. On the subsequent clock pulse, the inputs change to S=0S = 0 and R=1R = 1:

Q(next)=S+R′⋅Q=0+(0⋅1)=0+0=0Q(\text{next}) = S + R' \cdot Q = 0 + (0 \cdot 1) = 0 + 0 = 0

The flip-flop resets back to Q=0Q = 0.

Practical Applications and System Limitations

The SR flip-flop is utilized in specific digital sub-circuits:

  • Switch Debouncing: Interfacing mechanical switches or pushbuttons produces transient voltage spikes due to contact bounce. An SR latch eliminates these erratic oscillations, yielding clean, single-transition digital pulses.

  • Control Flags: It serves as a simple latching flag to capture asynchronous status events, remaining set until explicitly cleared by control logic.

  • Basic Storage Registers: It functions as an elemental 1-bit memory cell.

  • Foundational Building Block: It constitutes the internal core around which more sophisticated flip-flops are constructed.

The primary limitation of the SR flip-flop is the invalid output state produced when S=R=1S = R = 1. Circuit designers must introduce external gating or select alternative flip-flop architectures to prevent this condition.

The Universal JK Flip-Flop, Race-Around Condition, and Master-Slave Architecture

The JK flip-flop eliminates the undefined state of the SR flip-flop while retaining its Set, Reset, and Hold functions. It is designated as a universal flip-flop because suitable external connections enable it to emulate SR, D, or T flip-flops.

Logic Implementation and Functional Behavior

The JK flip-flop is constructed by adding feedback from the outputs of an SR latch to its input gating logic. Specifically, the complementary output Q′Q' is routed back into the AND gate associated with input JJ, and the true output QQ is routed back into the AND gate associated with input KK.

JK Flip-Flop logic diagram with feedback connections

This cross-coupled feedback ensures that when J=1J = 1 and K=1K = 1, only the gate opposite the current state is enabled. Consequently, instead of entering a forbidden state, the flip-flop toggles, inverting its output on every active clock pulse.

CLKCLK

JJ

KK

Q(next)Q(\text{next})

State

00

XX

XX

QQ (hold)

Disabled (No change)

11

00

00

QQ (hold)

No change

11

00

11

00

Reset

11

11

00

11

Set

11

11

11

Q′Q' (toggle)

Toggle

Characteristic and Excitation Analysis

The algebraic characteristic equation of the JK flip-flop is derived using Karnaugh mapping:

Q(next)=J⋅Q′+K′⋅QQ(\text{next}) = J \cdot Q' + K' \cdot Q

The characteristic table defines the full next-state mapping across all input combinations:

JJ

KK

QnQ_n

Qn+1Q_{n+1}

00

00

00

00

00

00

11

11

00

11

00

00

00

11

11

00

11

00

00

11

11

00

11

11

11

11

00

11

11

11

11

00

The excitation table defines the inputs JJ and KK required to induce a specified state transition:

QnQ_n

Qn+1Q_{n+1}

JJ

KK

00

00

00

XX

00

11

11

XX

11

00

XX

11

11

11

XX

00

The Race-Around Condition

In a level-triggered JK flip-flop, a timing pathology known as the race-around condition occurs when J=1J = 1, K=1K = 1, and the clock pulse duration (twt_w) exceeds the internal gate propagation delay (tpt_p) of the flip-flop.

Race-around condition showing repeated toggling when clock pulse width exceeds propagation delay

Under these conditions, if the flip-flop starts at Q=0Q = 0, asserting J=K=1J = K = 1 causes the output to switch to Q=1Q = 1 after delay tpt_p. However, because the clock remains high (CLK=1CLK = 1), this new output Q=1Q = 1 feeds back into the KK gate, causing the circuit to toggle again to Q=0Q = 0 after another interval tpt_p. The output continues oscillating between 00 and 11 at intervals of tpt_p for the entire duration that CLK=1CLK = 1:

Q(t0)=0⟶Q(t0+tp)=1⟶Q(t0+2tp)=0⟶Q(t0+3tp)=1⟶Q(t0+4tp)=0…Q(t_0) = 0 \longrightarrow Q(t_0 + t_p) = 1 \longrightarrow Q(t_0 + 2t_p) = 0 \longrightarrow Q(t_0 + 3t_p) = 1 \longrightarrow Q(t_0 + 4t_p) = 0 \dots

When the clock signal falls back to 00, the final state of QQ is indeterminate, depending entirely on the exact ratio of the pulse width to the internal propagation delay.

To prevent the race-around condition:

  1. The clock pulse width must be strictly smaller than the propagation delay (tw<tpt_w < t_p), which is difficult to guarantee across manufacturing and temperature variations.

  2. Edge-triggered flip-flops can be employed, sampling inputs only during the narrow transition threshold of the clock.

  3. A Master-Slave JK architecture can be implemented.

Master-Slave JK Flip-Flop Architecture

A Master-Slave JK flip-flop connects two separate flip-flops in series with complementary clocking:

  1. Master Flip-Flop: A positive-level-triggered JK stage receiving external inputs JJ and KK, clocked directly by CLKCLK.

  2. Slave Flip-Flop: A negative-level-triggered (or inverted) JK stage whose inputs are driven by the outputs (Qm,Qm′Q_m, Q_m') of the master, clocked by CLK′CLK' (via an inverter).

Master-Slave JK Flip-Flop circuit architecture

During circuit operation:

  • While CLK=1CLK = 1, the master is active and responds to inputs JJ and KK, updating intermediate nodes QmQ_m and Qm′Q_m'. Concurrently, CLK′=0CLK' = 0, keeping the slave disabled and isolated, which holds the primary outputs QQ and Q′Q' stable.

  • While CLK=0CLK = 0, the master is disabled and isolated from any further input fluctuations. Concurrently, CLK′=1CLK' = 1, enabling the slave to copy the states QmQ_m and Qm′Q_m' to the external outputs QQ and Q′Q'.

Because the master and slave are never active simultaneously, the complete circuit responds to inputs during the clock high period but updates its external outputs only when the clock transitions low. This two-phase transfer prevents continuous feedback oscillations and eliminates the race-around condition.

Step-by-Step State Execution Trace

Consider a JK flip-flop starting from an initial state Q=0Q = 0 subjected to four successive clock pulses:

Clock Pulse

JJ

KK

QQ (before)

Executed Operation

QQ (after)

1

11

00

00

Set

11

2

11

11

11

Toggle

00

3

00

11

00

Reset (no change)

00

4

11

11

00

Toggle

11

For Clock Pulse 2 (J=1,K=1,Q=1J = 1, K = 1, Q = 1), applying the characteristic equation yields:

Q(next)=J⋅Q′+K′⋅Q=(1⋅0)+(0⋅1)=0+0=0Q(\text{next}) = J \cdot Q' + K' \cdot Q = (1 \cdot 0) + (0 \cdot 1) = 0 + 0 = 0

The state flips from 11 to 00. After four clock pulses, the final state is Q=1Q = 1.

Data (D) and Toggle (T) Flip-Flops

The D and T flip-flops are single-input variations derived by simplifying the SR and JK architectures to serve specific functional roles in digital systems.

D Flip-Flop (Data / Delay Flip-Flop)

The D flip-flop captures and stores the logic level present on its single data input line (DD). It is constructed by taking a clocked SR flip-flop and placing an inverter between the Set and Reset terminals, enforcing S=DS = D and R=D′R = D'.

D Flip-Flop constructed from clocked SR flip-flop with inverter

Because the inputs to the internal SR stage are always complementary, the condition S=R=1S = R = 1 is structurally impossible, eliminating the invalid state by design.

CLKCLK

DD

Q(next)Q(\text{next})

State

Rising edge

00

00

Reset

Rising edge

11

11

Set

00 or 11 (no edge)

XX

QQ (no change)

Hold

The characteristic equation is:

Q(next)=DQ(\text{next}) = D

The characteristic table and excitation table are structured as follows:

Characteristic Table: DD

QnQ_n

Qn+1Q_{n+1}

Excitation Table: QnQ_n

Qn+1Q_{n+1}

DD

00

00

00

00

00

00

00

11

00

00

11

11

11

00

11

11

00

00

11

11

11

11

11

11

The excitation requirement for a D flip-flop is straightforward: the input DD must match the desired next state Qn+1Q_{n+1}, independent of the present state QnQ_n. Due to its reliable data capture, the D flip-flop is the primary element used in registers, memory arrays, shift registers, and bus synchronizers.

T Flip-Flop (Toggle Flip-Flop)

The T flip-flop has a single input (TT). It is constructed by tying together the JJ and KK inputs of a JK flip-flop (J=K=TJ = K = T).

T Flip-Flop constructed from JK flip-flop with tied inputs

Tying the inputs together eliminates the independent Set and Reset states, leaving only Hold and Toggle:

CLKCLK

TT

Q(next)Q(\text{next})

State

Rising edge

00

QQ (hold)

No change

Rising edge

11

Q′Q' (toggle)

Toggle

00 or 11 (no edge)

XX

QQ (no change)

Hold

The characteristic equation is expressed using the exclusive-OR (⊕\oplus) operation:

Q(next)=T⊕Q=T⋅Q′+T′⋅QQ(\text{next}) = T \oplus Q = T \cdot Q' + T' \cdot Q

The characteristic and excitation tables are:

Characteristic Table: TT

QnQ_n

Qn+1Q_{n+1}

Excitation Table: QnQ_n

Qn+1Q_{n+1}

TT

00

00

00

00

00

00

00

11

11

00

11

11

11

00

11

11

00

11

11

11

00

11

11

00

The excitation table is symmetric: T=0T = 0 whenever the state is to be preserved (Qn=Qn+1Q_n = Q_{n+1}), and T=1T = 1 whenever the state is to be inverted. This toggle capability makes the T flip-flop standard in binary counters and frequency division circuits.

Comparative Evaluation of Flip-Flop Architectures

Overview of SR, JK, D, and T flip-flop inputs and clock connections

Feature

SR Flip-Flop

D Flip-Flop

JK Flip-Flop

T Flip-Flop

Data Inputs

S,RS, R

DD

J,KJ, K

TT

Invalid State Present?

Yes (S=R=1S=R=1)

No

No

No

Toggle Capability?

No

No

Yes (J=K=1J=K=1)

Yes (T=1T=1)

Characteristic Eq.

Qn+1=S+R′QQ_{n+1} = S + R'Q

Qn+1=DQ_{n+1} = D

Qn+1=JQ′+K′QQ_{n+1} = JQ' + K'Q

Qn+1=T⊕QQ_{n+1} = T \oplus Q

Typical Use Cases

Latches, debouncers, status flags

Storage registers, memory, FIFO buffers

General counters, versatile registers

Binary counters, frequency dividers

Comparative Worked Example: D vs. T Flip-Flop State Traces

Starting from an initial state Q=0Q = 0, both flip-flops are evaluated across four clock cycles with specific input sequences:

For the D Flip-Flop (Qn+1=DQ_{n+1} = D):

  • Pulse 1: D=1  ⟹  Q=1D = 1 \implies Q = 1

  • Pulse 2: D=1  ⟹  Q=1D = 1 \implies Q = 1

  • Pulse 3: D=0  ⟹  Q=0D = 0 \implies Q = 0

  • Pulse 4: D=1  ⟹  Q=1D = 1 \implies Q = 1

For the T Flip-Flop (Qn+1=T⊕QQ_{n+1} = T \oplus Q):

  • Pulse 1: T=1,Qn=0  ⟹  Qn+1=1⊕0=1T = 1, Q_n = 0 \implies Q_{n+1} = 1 \oplus 0 = 1

  • Pulse 2: T=0,Qn=1  ⟹  Qn+1=0⊕1=1T = 0, Q_n = 1 \implies Q_{n+1} = 0 \oplus 1 = 1

  • Pulse 3: T=1,Qn=1  ⟹  Qn+1=1⊕1=0T = 1, Q_n = 1 \implies Q_{n+1} = 1 \oplus 1 = 0

  • Pulse 4: T=1,Qn=0  ⟹  Qn+1=1⊕0=1T = 1, Q_n = 0 \implies Q_{n+1} = 1 \oplus 0 = 1

Both flip-flops finish with a final state of Q=1Q = 1.

Registers and Data Storage Systems

A register is a group of flip-flops sharing a common clock that stores an nn-bit binary word as a unified entity. An nn-bit register uses nn flip-flops, typically D flip-flops, and provides basic working storage within central processing units, peripheral controllers, and system buses.

Registers fall into two main classes: buffer (storage) registers, which load and hold words in parallel without lateral movement, and shift registers, which move their bits positionally on clock pulses.

4-Bit Parallel-In Parallel-Out (PIPO) Buffer Register

A basic buffer register stores multi-bit data temporarily so it can be sampled or routed asynchronously later. A 4-bit buffer register uses four D flip-flops (FF0 to FF3) sharing a single clock line.

4-bit buffer register with parallel load

External data lines (D0,D1,D2,D3D_0, D_1, D_2, D_3) connect directly to the respective flip-flop inputs. When an active rising clock edge occurs, each input bit DiD_i transfers simultaneously into its corresponding flip-flop stage, updating outputs Q0,Q1,Q2,Q3Q_0, Q_1, Q_2, Q_3 in parallel during a single clock cycle.

CLKCLK

D3D2D1D0D_3 D_2 D_1 D_0

Q3Q2Q1Q0Q_3 Q_2 Q_1 Q_0 (after clock edge)

Rising edge

1  0  1  11 \; 0 \; 1 \; 1

1  0  1  11 \; 0 \; 1 \; 1

00 (no active edge)

Any arbitrary word

Unchanged (Retained state)

Because all bits transfer in parallel, a buffer register executes no internal bit shifting. It isolates internal bus segments, synchronizes data transfers between subsystems operating at different clock rates, and implements processor register files (such as accumulators and general-purpose registers).

Shift Registers: Operational Topologies, Shifting Sequences, and Counters

A shift register is an array of cascaded flip-flops whose outputs feed directly into the inputs of adjacent stages. When clocked, the entire stored binary word moves incrementally by one bit position to the left or right.

Shift registers are categorized by how data enters and exits the array: Serial-In Serial-Out (SISO), Serial-In Parallel-Out (SIPO), Parallel-In Serial-Out (PISO), and Parallel-In Parallel-Out (PIPO).

Serial-In Serial-Out (SISO) Shift Register

In a 4-bit SISO register, four D flip-flops (FF0, FF1, FF2, FF3) are connected in series. The output QQ of each flip-flop drives the data input DD of the next stage. A single input line feeds FF0, and output data is taken solely from FF3.

4-bit SISO shift register logic diagram

Data enters sequentially, one bit per clock cycle, and propagates through the cascade. Loading an nn-bit word requires nn clock cycles, and reading it out serially requires another nn clock cycles. Consequently, a SISO register acts as an nn-cycle digital delay line.

Shifting Sequence for Word 10111011

Loading the word 10111011 into the register (least significant bit first: 11, then 11, then 00, then 11) proceeds as follows:

Clock Pulse

Serial In

FF0 (Q0Q_0)

FF1 (Q1Q_1)

FF2 (Q2Q_2)

FF3 (Q3Q_3, Serial Out)

00 (Initial)

−-

−-

−-

−-

−-

1

11

11

−-

−-

−-

2

11

11

11

−-

−-

3

00

00

11

11

−-

4

11

11

00

11

11

After 4 clock pulses, the complete 4-bit word resides within the register (Q0=1,Q1=0,Q2=1,Q3=1Q_0=1, Q_1=0, Q_2=1, Q_3=1).

Serial-In Parallel-Out (SIPO) Shift Register

A SIPO register receives data serially via a single line but provides parallel access to every flip-flop output (Q0,Q1,Q2,Q3Q_0, Q_1, Q_2, Q_3). It converts serial data into parallel words, making it standard in communication receivers (e.g., UART and SPI) to convert bit-serial transmission lines into parallel bus words for processors.

Data shifts into the register over nn clock pulses. Once loaded, all nn bits are read simultaneously from the parallel outputs in a single clock cycle (00 delay cycles for reading).

Parallel-In Serial-Out (PISO) Shift Register

A PISO register accepts a complete parallel data word along lines B0,B1,B2,B3B_0, B_1, B_2, B_3 and outputs it serially over a single line. Multiplexers precede each flip-flop input, controlled by a shared SHIFT/LOAD‾SHIFT / \overline{LOAD} signal.

4-bit PISO shift register with multiplexed inputs
  • When SHIFT/LOAD‾=0SHIFT / \overline{LOAD} = 0 (LOAD‾\overline{LOAD} active), the multiplexers select parallel inputs B0−B3B_0 - B_3. On the next clock edge, the entire word loads into the flip-flops simultaneously (1 clock pulse).

  • When SHIFT/LOAD‾=1SHIFT / \overline{LOAD} = 1, the multiplexers switch to select the output of the preceding flip-flop (Qi−1Q_{i-1}). Subsequent clock pulses shift the word rightward by one bit per cycle, emerging serially from FF3.

Worked Trace: PISO Serialization

Consider a PISO register loaded with the parallel word Q3Q2Q1Q0=1101Q_3 Q_2 Q_1 Q_0 = 1 1 0 1:

Step

Register Contents: Q3Q2Q1Q0Q_3 Q_2 Q_1 Q_0

Serial Output (Q0Q_0)

Parallel Load

1  1  0  11 \; 1 \; 0 \; 1

−-

Pulse 1

0  1  1  00 \; 1 \; 1 \; 0

11

Pulse 2

0  0  1  10 \; 0 \; 1 \; 1

00

Pulse 3

0  0  0  10 \; 0 \; 0 \; 1

11

Pulse 4

0  0  0  00 \; 0 \; 0 \; 0

11

Each pulse shifts the contents rightward (Q0←Q1,Q1←Q2,Q2←Q3Q_0 \leftarrow Q_1, Q_1 \leftarrow Q_2, Q_2 \leftarrow Q_3), filling the most significant bit (Q3Q_3) with 00. After 4 clock cycles, the serial output line has produced the bits 1,0,1,11, 0, 1, 1, and the register is cleared to 00000000.

Bidirectional and Universal Shift Registers

A bidirectional shift register can shift stored bits either right or left based on a mode control signal. Gating logic at each flip-flop input selects between the left neighbor's output (Qi−1Q_{i-1}) to shift right and the right neighbor's output (Qi+1Q_{i+1}) to shift left. In arithmetic units, shifting left by one bit multiplies an unsigned binary integer by 22, while shifting right divides it by 22.

A Universal Shift Register integrates multiple functional modes into a single circuit, typically using 4x1 multiplexers to drive each flip-flop input.

4-bit universal shift register using 4x1 multiplexers

Mode selection is governed by two control lines, S1S_1 and S0S_0:

Control Line S1S_1

Control Line S0S_0

Operating Mode

Multiplexer Selection

00

00

Hold

Selects flip-flop's own output (QiQ_i), preventing state changes

00

11

Shift Right

Selects output of the preceding stage (Qi−1Q_{i-1})

11

00

Shift Left

Selects output of the subsequent stage (Qi+1Q_{i+1})

11

11

Parallel Load

Selects external parallel input lines (IiI_i)

Standard integrated circuits such as the commercial IC 74194 implement this universal shift register architecture.

Shift Register Counters: Ring Counter and Johnson Counter

Connecting the output of the final stage of a shift register back into the input of the first stage forms a circulating shift register counter.

Ring Counter

A ring counter recirculates the true output of the final flip-flop back into the data input of the initial flip-flop (Qn−1→D0Q_{n-1} \rightarrow D_0).

4-bit ring counter feedback diagram

The register is initialized with a single logic 11 (e.g., 10001000 for a 4-bit counter). Clock pulses circulate this isolated 11 around the loop:

Pulse

Q0Q_0

Q1Q_1

Q2Q_2

Q3Q_3

00 (Init)

11

00

00

00

1

00

11

00

00

2

00

00

11

00

3

00

00

00

11

An nn-stage ring counter provides nn unique states. Because exactly one flip-flop output is active at any point, the state is self-decoding, eliminating the need for an external decoding network to drive sequential timing lines.

Johnson (Twisted-Ring) Counter

A Johnson counter connects the complemented output of the final stage back to the input of the first stage (Qn−1′→D0Q'_{n-1} \rightarrow D_0). Starting from an initialized state of 00000000, inverted bits fill and subsequently clear the register:

Pulse

Q0Q_0

Q1Q_1

Q2Q_2

Q3Q_3

00 (Init)

00

00

00

00

1

11

00

00

00

2

11

11

00

00

3

11

11

11

00

4

11

11

11

11

5

00

11

11

11

6

00

00

11

11

7

00

00

00

11

An nn-stage Johnson counter cycles through 2n2n unique states using nn flip-flops, doubling the state count of a standard ring counter while requiring simpler decoding logic than binary counters.

Shift Register Performance and Topological Summary

Feature

SISO

SIPO

PISO

PIPO

Data In Method

Serial

Serial

Parallel

Parallel

Data Out Method

Serial

Parallel

Serial

Parallel

Clock Cycles to Load nn Bits

nn

nn

11

11

Clock Cycles to Read nn Bits

nn

00 (instantaneous)

nn

00 (instantaneous)

Primary Function

Signal delay, data buffer

Serial-to-parallel conversion

Parallel-to-serial conversion

High-speed data storage

Asynchronous (Ripple) Counters

A counter is a sequential circuit that cycles through a predetermined sequence of states upon the arrival of clock pulses. Counters are classified by their clock distribution into asynchronous (ripple) counters and synchronous counters.

In an asynchronous counter, flip-flops do not share a common clock line. Only the first stage (FF0, Least Significant Bit) receives the external system clock. Each subsequent stage is clocked by the output (QQ or Q′Q') of the preceding flip-flop, causing state changes to ripple sequentially down the chain.

2-Bit Asynchronous UP Counter

A 2-bit ripple UP counter uses two T flip-flops with their TT inputs tied to logic 11 (T0=T1=1T_0 = T_1 = 1), operating in toggle mode.

2-bit asynchronous up counter using T flip-flops

The external clock drives FF0, causing output Q0Q_0 to toggle on each active clock edge. Output Q0Q_0 is routed to the clock input of FF1, which triggers on the falling edge (1→01 \rightarrow 0) of Q0Q_0. As a result, FF1 toggles at half the frequency of FF0.

Clock Pulse

Q1Q_1 (MSB)

Q0Q_0 (LSB)

Decimal Equivalent

00 (Initial)

00

00

0

1

00

11

1

2

11

00

2

3

11

11

3

4

00

00

0 (Rollover)

The counter cycles through 22=42^2 = 4 binary states (00→01→10→11→0000 \rightarrow 01 \rightarrow 10 \rightarrow 11 \rightarrow 00).

4-Bit Asynchronous UP and DOWN Counters

A 4-bit ripple UP counter cascades four T flip-flops (FF0 to FF3), tracking counts from 00 to 1515 (24=162^4 = 16 states).

4-bit ripple up counter using cascaded T flip-flops

Only FF0 receives the external system clock; each subsequent stage is clocked by the true output (Qi−1Q_{i-1}) of the preceding stage. Assuming negative edge-triggered flip-flops, when Qi−1Q_{i-1} falls from 11 to 00, stage ii toggles, producing an upward binary count sequence:

0000⟶0001⟶0010⟶0011⟶⋯⟶1111⟶00000000 \longrightarrow 0001 \longrightarrow 0010 \longrightarrow 0011 \longrightarrow \dots \longrightarrow 1111 \longrightarrow 0000

To construct an asynchronous DOWN counter using negative edge-triggered flip-flops, the clock input of each subsequent stage is driven by the complemented output (Qi−1′Q'_{i-1}) rather than the true output.

4-bit ripple down counter clocked by complemented outputs

This complementary clock connection reverses the sequence, decrementing the output on each clock pulse:

Count

Q3Q_3

Q2Q_2

Q1Q_1

Q0Q_0

15

11

11

11

11

14

11

11

11

00

13

11

11

00

11

12

11

11

00

00

11

11

00

11

11

10

11

00

11

00

The count continues downward (9→09 \rightarrow 0) before rolling over to 1515.

Mod-N Asynchronous Counter (Reset Logic Truncation)

A binary counter with kk flip-flops naturally cycles through 2k2^k states, operating as a Modulo-2k2^k counter. To design a counter with a non-power-of-two modulus (MOD-N\text{MOD-}N where N<2kN < 2^k), reset logic detects state NN and clears the counter back to zero.

In a MOD-6 counter, 33 flip-flops are required because 22=4<6≤23=82^2 = 4 < 6 \le 2^3 = 8. The counter must cycle through six states: 000,001,010,011,100,101000, 001, 010, 011, 100, 101 (decimal 00 to 55). Decimal state 66 (1102110_2) is the first invalid state.

Mod-6 asynchronous counter with NAND reset feedback

A NAND gate monitors outputs Q2Q_2 and Q1Q_1. The instant the counter reaches state 66 (Q2=1,Q1=1,Q0=0Q_2 = 1, Q_1 = 1, Q_0 = 0), the NAND gate outputs logic 00. This active-low signal feeds into the asynchronous CLEAR inputs of all three flip-flops, immediately resetting the counter to 000000.

Sequence Step

Q2Q_2

Q1Q_1

Q0Q_0

Decimal Equivalent

Status

0

00

00

00

0

Stable state

1

00

00

11

1

Stable state

2

00

11

00

2

Stable state

3

00

11

11

3

Stable state

4

11

00

00

4

Stable state

5

11

00

11

5

Stable state

6 (Transient)

11

11

00

6

Momentary state (triggers NAND to reset counter to 000000)

State 66 is a transient state lasting only a few nanoseconds, determined by the propagation delays of the NAND gate and flip-flop clear paths.

Timing Limitations of Asynchronous Counters

While asynchronous counters require minimal gating logic, their cascaded clocking introduces cumulative propagation delay. For an nn-stage ripple counter where each flip-flop has propagation delay tpdt_{pd}, the total settling time is:

ttotal=n×tpdt_{\text{total}} = n \times t_{pd}

If the clock period (TCLKT_{CLK}) is shorter than n×tpdn \times t_{pd}, higher-order stages cannot settle before the next clock pulse arrives, causing counting errors. Furthermore, because transitions occur at slightly different times across stages, temporary intermediate states appear on the output bus during state changes, producing glitches in connected decoding logic.

Synchronous Counters

A synchronous counter connects the clock inputs of all flip-flops to a single, common clock line, causing all stages to update simultaneously on each active clock edge.

Because all flip-flops toggle at the same instant, next-state transitions cannot rely on clock ripple. Instead, combinational logic evaluates the present state of the counter to pre-compute whether each flip-flop should hold or toggle on the upcoming clock edge.

2-Bit Synchronous UP Counter

A 2-bit synchronous up counter uses two T flip-flops driven by a shared clock.

2-bit synchronous up counter using T flip-flops
  • Stage 0 toggles on every active clock pulse (T0=1T_0 = 1).

  • Stage 1 should toggle only when the lower-order bit is high (Q0=1Q_0 = 1), so its input is driven directly by that output: T1=Q0T_1 = Q_0.

Clock Pulse

Q1Q_1

Q0Q_0

Decimal Equivalent

00 (Initial)

00

00

0

1

00

11

1

2

11

00

2

3

11

11

3

4

00

00

0 (Rollover)

Because both flip-flops are triggered together by CLKCLK, the entire output word transitions simultaneously within a single flip-flop propagation delay (tpdt_{pd}).

4-Bit Synchronous UP Counter Design

A 4-bit synchronous up counter extends this look-ahead gating using JK or T flip-flops.

4-bit synchronous up counter with AND gating

A binary counter bit must toggle if and only if all preceding lower-order bits are logic 11. Connecting each stage to an AND gate evaluating all previous stage outputs replicates the binary carry look-ahead condition:

  • Stage 0: J0=K0=1J_0 = K_0 = 1

  • Stage 1: J1=K1=Q0J_1 = K_1 = Q_0

  • Stage 2: J2=K2=Q0⋅Q1J_2 = K_2 = Q_0 \cdot Q_1

  • Stage 3: J3=K3=Q0⋅Q1⋅Q2J_3 = K_3 = Q_0 \cdot Q_1 \cdot Q_2

Because the control inputs are established before the clock edge arrives, all four flip-flops switch concurrently, maintaining a constant propagation delay of a single flip-flop regardless of bit width.

Synchronous Up/Down Counter

A synchronous counter can be configured for bidirectional counting by adding a mode control line (UP/DOWN‾UP / \overline{DOWN}) and steering logic (multiplexers or AND-OR configurations) to the flip-flop inputs:

  • When UP/DOWN‾=1UP / \overline{DOWN} = 1, the steering logic selects the true outputs (QiQ_i), causing the counter to increment (0000→0001→0010…0000 \rightarrow 0001 \rightarrow 0010 \dots).

  • When UP/DOWN‾=0UP / \overline{DOWN} = 0, the steering logic selects the complemented outputs (Qi′Q'_i), causing the counter to decrement (1111→1110→1101…1111 \rightarrow 1110 \rightarrow 1101 \dots).

MOD-6 Synchronous Counter Design Example

A synchronous MOD-6 counter cycles through states 000000 through 101101 and resets upon reaching state 66 (1102110_2).

MOD-6 synchronous counter design with feedback clear logic

Three flip-flops provide 88 natural states (000000 to 111111). An AND gate monitors outputs Q2Q_2 and Q1Q_1. When the counter enters state 66 (Q2=1,Q1=1Q_2 = 1, Q_1 = 1), the gate asserts the synchronous or asynchronous CLEAR line (CLRCLR), resetting all flip-flops to 000000.

Pulse

Q2Q_2

Q1Q_1

Q0Q_0

State Description

00 (Init)

00

00

00

Count 0

1

00

00

11

Count 1

2

00

11

00

Count 2

3

00

11

11

Count 3

4

11

00

00

Count 4

5

11

00

11

Count 5

6 (Detected)

11

11

00

Detected by AND gate (Q2⋅Q1Q_2 \cdot Q_1); resets counter to 000000

This detect-and-reset methodology generalises to any arbitrary count modulus NN.

Comparative Evaluation: Asynchronous vs. Synchronous Counters

Operational Parameter

Asynchronous (Ripple) Counter

Synchronous Counter

Clock Distribution

Each stage is clocked by the preceding flip-flop's output

All flip-flops share a single common clock line

Switching Speed

Slower; cumulative delay increases with bit width (n×tpdn \times t_{pd})

Faster; fixed single-stage propagation delay (tpdt_{pd})

Circuit Complexity

Minimal; requires few or no external logic gates

Higher; requires look-ahead AND/OR gating

Output Glitches

Prone to decoding glitches during rippling transitions

Clean, simultaneous output transitions

Representative Standard ICs

IC 7493 (4-bit binary ripple counter)

IC 74163, IC 74169 (4-bit synchronous counters)

Practical Engineering Applications and Finite State Machines (FSMs)

Sequential circuits serve four primary functions across digital systems: counting/timing, data storage/movement, finite-state control, and memory addressing.

Counters: Digital Clocks, Timers, and Frequency Dividers

A binary counter stage toggles at half the frequency of its input clock, functioning as a divide-by-2 frequency divider. Cascading kk flip-flops divides the input clock frequency by 2k2^k:

fout=fCLK2kf_{\text{out}} = \frac{f_{\text{CLK}}}{2^k}

Digital clocks leverage this property using cascaded MOD-N counters.

Cascaded MOD-N counters forming a digital clock system

A quartz crystal oscillator generates a stable reference frequency of 32.768 kHz32.768\,\text{kHz} (32,768 Hz32{,}768\,\text{Hz}). Because 32,768=21532{,}768 = 2^{15}, passing this signal through a 15-stage binary counter (÷32768\div 32768 divider) yields an exact 1 Hz1\,\text{Hz} (1 pulse per second) timing tick. This 1 Hz1\,\text{Hz} signal drives:

  1. A MOD-60 Counter to track seconds (00 to 5959).

  2. A second MOD-60 Counter, pulsed by the rollover of the seconds stage, to track minutes (00 to 5959).

  3. A MOD-24 Counter, pulsed by the rollover of the minutes stage, to track hours (00 to 2323).

The counter outputs drive 7-segment display decoders to render human-readable time.

Shift Registers: Serial Communication (UART) and Buffering

Shift registers form the hardware interface between serial communication channels and parallel computing buses. In a Universal Asynchronous Receiver-Transmitter (UART):

UART communication link using PISO and SIPO shift registers
  • The Transmitter (TX) uses a PISO shift register to parallel-load a byte from the system bus and shift it out bit-by-bit over a single physical line.

  • The Receiver (RX) uses a SIPO shift register to reconstruct the incoming serial bitstream into an 8-bit parallel byte before transferring it to the processor.

Shift registers also implement First-In, First-Out (FIFO) buffers to reconcile throughput disparities between decoupled subsystems, such as keyboard input buffers, print spoolers, and network packet queues.

Finite State Machines (FSMs)

A Finite State Machine is a sequential circuit that transitions through a finite set of operational states based on clock pulses and external inputs. FSMs are divided into Moore machines (where outputs depend solely on the present state) and Mealy machines (where outputs depend on both the present state and current inputs).

Moore FSM Example: Traffic Light Controller

A traffic light controller uses an internal timer to sequence through three fixed states.

Moore state machine diagram for traffic light controller

Because outputs depend only on the current state, this is a classic Moore machine:

State

Active Signal Output

Duration (tt)

Next State

S0

Red

30 s30\,\text{s}

S1

S1

Green

25 s25\,\text{s}

S2

S2

Yellow

5 s5\,\text{s}

S0

An auxiliary timer counts down the duration for each state, asserting a trigger signal upon expiration to advance the state machine to the next phase in a closed cycle (S0→S1→S2→S0\text{S0} \rightarrow \text{S1} \rightarrow \text{S2} \rightarrow \text{S0}).

Mealy FSM Example: Sequence Detector for Pattern "101"

A sequence detector evaluates an incoming serial bitstream and asserts an output flag whenever a target pattern is identified. In an overlapping "101" Mealy sequence detector, the state definitions are:

  • S0: Reset state (no bits of the pattern observed).

  • S1: The most recent bit observed was a logic 11.

  • S2: The two most recent bits observed were 1010.

Mealy state machine sequence detector for 101 pattern

Transitions and outputs are formatted as Input/Output\text{Input} / \text{Output}:

  • From S0: Input 0  ⟹  transition to S0, Output=00 \implies \text{transition to S0, Output} = 0; Input 1  ⟹  transition to S1, Output=01 \implies \text{transition to S1, Output} = 0.

  • From S1: Input 0  ⟹  transition to S2, Output=00 \implies \text{transition to S2, Output} = 0; Input 1  ⟹  remain in S1, Output=01 \implies \text{remain in S1, Output} = 0.

  • From S2: Input 0  ⟹  transition to S0, Output=00 \implies \text{transition to S0, Output} = 0; Input 1  ⟹  transition to S1, Output=11 \implies \text{transition to S1, Output} = 1 (pattern "101" recognized).

Transitioning from S2 back to S1 on input 11 allows the trailing 11 to serve as the leading bit of a subsequent overlapping "101" sequence, which is essential for packet framing and protocol parsing.

Vending Machine Controller FSM

A vending machine dispensing a ₹15\text{₹}15 item accepts ₹5\text{₹}5 and ₹10\text{₹}10 coins:

State (Total Accumulated)

Inserted Coin

Next State

Action Taken

S0 (₹0\text{₹}0)

₹5\text{₹}5

S5

None

S5 (₹5\text{₹}5)

₹5\text{₹}5

S10

None

S5 (₹5\text{₹}5)

₹10\text{₹}10

S15

None

S15 (≥₹15\ge \text{₹}15)

−-

S0

Dispense item and return excess change

CPU Control Units and Memory Addressing

A central processing unit's Program Counter (PC) is a specialized synchronous counter that increments sequentially on each instruction cycle to fetch code across memory addresses.

Address sequencing in Direct Memory Access (DMA) controllers and cache-line fill controllers similarly uses hardware counters to stream blocks of data without software intervention.

Block diagram of a microprogrammed control unit

The processor control unit itself is implemented as a sequential state machine:

  • Hardwired Control Unit: Implemented as a combinational gate array and state flip-flops, providing high-speed execution at the cost of rigid architectural complexity.

  • Microprogrammed Control Unit: Stores control words in a dedicated Control Memory (Microcode ROM). A Micro-Program Counter (μPC\mu PC) addresses this ROM, which emits horizontal or vertical control signals to the datapath and Arithmetic Logic Unit (ALU). A next-address field within the microinstruction feeds back to update the μPC\mu PC, creating a programmable sequential state machine.

Numerical Methods and Circuit Design Practice

Designing synchronous and asynchronous sequential circuits requires determining the necessary number of flip-flops, deriving excitation requirements, and calculating frequency division.

Sizing Rule for Modulo-N Counters

To construct a counter with nn distinct states, the minimum number of flip-flops (kk) required is governed by the inequality:

2k≥n2^k \ge n

Taking the base-2 logarithm:

k=⌈log⁡2(n)⌉k = \lceil \log_2(n) \rceil

Flowchart derivation for MOD-6 flip-flop count

For a MOD-6 counter (n=6n = 6, states 00 to 55):

  • Evaluate k=2  ⟹  22=4<6k = 2 \implies 2^2 = 4 < 6 (Insufficient capacity).

  • Evaluate k=3  ⟹  23=8≥6k = 3 \implies 2^3 = 8 \ge 6 (Sufficient capacity).

Thus, k=3k = 3 flip-flops are required. A 3-bit counter possesses 23=82^3 = 8 possible states, leaving 8−6=28 - 6 = 2 unused states (1102110_2 and 1112111_2). The design must ensure that the counter never enters or hangs in these unused states.

Deriving Flip-Flop Inputs Using Excitation Tables

When designing sequential state machines, required flip-flop input values are determined from the excitation tables based on desired state transitions (Qn→Qn+1Q_n \rightarrow Q_{n+1}):

  • To force a state transition from Qn=0Q_n = 0 to Qn+1=1Q_{n+1} = 1:

    • Using an SR Flip-Flop: Set S=1,R=0S = 1, R = 0.

    • Using a JK Flip-Flop: Set J=1,K=XJ = 1, K = X (don't care).

    • Using a D Flip-Flop: Set D=1D = 1.

    • Using a T Flip-Flop: Set T=1T = 1.

  • To hold a state at Qn=1Q_n = 1 (Qn=1→Qn+1=1Q_n = 1 \rightarrow Q_{n+1} = 1):

    • Using an SR Flip-Flop: Set S=X,R=0S = X, R = 0.

    • Using a JK Flip-Flop: Set J=X,K=0J = X, K = 0.

    • Using a D Flip-Flop: Set D=1D = 1.

    • Using a T Flip-Flop: Set T=0T = 0.

Frequency Division Calculations

A 4-bit ripple counter driven by an input clock frequency fCLKf_{\text{CLK}} divides the frequency across its stages:

  • Output of Stage 0 (Q0Q_0): f0=fCLK21=fCLK2f_0 = \frac{f_{\text{CLK}}}{2^1} = \frac{f_{\text{CLK}}}{2}

  • Output of Stage 1 (Q1Q_1): f1=fCLK22=fCLK4f_1 = \frac{f_{\text{CLK}}}{2^2} = \frac{f_{\text{CLK}}}{4}

  • Output of Stage 2 (Q2Q_2): f2=fCLK23=fCLK8f_2 = \frac{f_{\text{CLK}}}{2^3} = \frac{f_{\text{CLK}}}{8}

  • Output of Stage 3 (Q3Q_3, MSB): f3=fCLK24=fCLK16f_3 = \frac{f_{\text{CLK}}}{2^4} = \frac{f_{\text{CLK}}}{16}

If the input clock is 16 MHz16\,\text{MHz}, the MSB toggles at:

f3=16 MHz16=1 MHzf_3 = \frac{16\,\text{MHz}}{16} = 1\,\text{MHz}

Similarly, dividing a 32.768 kHz32.768\,\text{kHz} crystal oscillator down to 1 Hz1\,\text{Hz} requires k=15k = 15 flip-flop stages, since 215=32,7682^{15} = 32{,}768, satisfying:

fout=32,768 Hz215=32,768 Hz32,768=1 Hzf_{\text{out}} = \frac{32{,}768\,\text{Hz}}{2^{15}} = \frac{32{,}768\,\text{Hz}}{32{,}768} = 1\,\text{Hz}