Skip to content

Sequence Generators

A sequence generator is a clocked circuit whose outputs pass through a prescribed repeating sequence. It may use a feedback shift register, a counter plus decoder or memory, or general next-state logic.

For the shift convention used here,

(Q3,Q2,Q1,Q0)+=(Din,Q3,Q2,Q1).(Q_3,Q_2,Q_1,Q_0)^+=(D_{in},Q_3,Q_2,Q_1).

Writing the update equation avoids ambiguity about the words “left” and “right.”

A ring generator feeds the last-stage output back without inversion:

Din=Q0.D_{in}=Q_0.

With a one-hot initial state,

1000→0100→0010→0001→1000.1000\to0100\to0010\to0001\to1000.

An nn-stage ring has nn useful states. Its outputs directly provide nn one-hot phases, but the all-zero state is locked and initialization must load exactly one 1.

A Johnson or twisted-ring generator feeds back the complement:

Din=Q‾0.D_{in}=\overline Q_0.

Starting from zero,

0000→1000→1100→1110→1111→0111→0011→0001→0000.\begin{aligned} 0000 & \to1000\to1100\to1110\to1111 \\ & \to0111\to0011\to0001\to0000. \end{aligned}

An nn-stage Johnson generator has 2n2n valid states.

Feedback-register realizations of ring and Johnson sequence generators.

Feedback-register realizations of ring and Johnson sequence generators.

PropertyRingJohnson
FeedbackQlastQ_{last}Q‾last\overline Q_{last}
Useful states with nn FFsnn2n2n
PatternOne-hot bit circulates1s fill, then 0s fill
InitializationPreset one-hot wordClear to zero
DecodingDirect outputTwo-input phase decoding
RiskZero lock or multiple circulating 1sInvalid cycles
UseOne-hot timing and scanningMulti-phase timing and control

Ring and Johnson generators compared.

Only 2n2n of the 2n2^n possible Johnson states belong to the intended cycle. Reset or recovery logic is required when deterministic startup matters.

An LFSR forms the serial input by XORing selected stage outputs. If the feedback polynomial is primitive and the seed is nonzero, an nn-stage LFSR visits every nonzero state once:

Nmax=2n−1.\boxed{N_{max}=2^n-1}.

The all-zero state is locked because XOR of zeros remains zero.

For the primitive polynomial p(x)=x4+x+1p(x)=x^4+x+1, use

(Q3,Q2,Q1,Q0)+=(Q1⊕Q0,Q3,Q2,Q1).\boxed{(Q_3,Q_2,Q_1,Q_0)^+ =(Q_1\oplus Q_0,Q_3,Q_2,Q_1)}.

Four-bit maximal-length LFSR realization.

Four-bit maximal-length LFSR realization.

Starting from 0001, the state sequence is

0001→1000→0100→0010→1001→1100→0110→1011→0101→1010→1101→1110→1111→0111→0011→0001.\begin{split} 0001 & \to1000\to0100\to0010\to1001\to1100\to0110\to1011 \\ & \to0101\to1010\to1101\to1110\to1111\to0111\to0011\to0001. \end{split}

The period is 15. The sequence is deterministic and is not cryptographically secure by itself. LFSRs are used for test patterns, scrambling, CRC hardware, spread-spectrum sequences and built-in self-test.

A binary or mod-NN counter can serve as a sequence address. A decoder asserts one timing output per count, while a ROM or combinational block maps each count to an arbitrary output word:

Qcounter⟶decoder/ROM⟶Ysequence.\boxed{Q_{counter}\longrightarrow \text{decoder/ROM}\longrightarrow Y_{sequence}}.

For a sequence of MM stored words, the address counter needs at least ⌈log⁡2M⌉\lceil\log_2M\rceil bits. This method is direct and easy to modify, but it uses more decoding or storage hardware than a short feedback pattern.

For a repeating sequence of states:

  1. assign a binary code to every required state;

  2. write the present-state/next-state table, including unused-state policy;

  3. choose flip-flops and derive their excitation or D-input equations;

  4. simplify each equation and draw the common-clock circuit;

  5. trace one full cycle plus every unused starting state.

Generate

00→01→11→10→00.00\to01\to11\to10\to00.

With two D flip-flops, the next-state table gives

D1=Q0,D0=Q‾1.\boxed{D_1=Q_0},\qquad \boxed{D_0=\overline Q_1}.

Design of the repeating two-bit Gray sequence. The next-state logic changes exactly one state bit on each clock edge.

Design of the repeating two-bit Gray sequence. The next-state logic changes exactly one state bit on each clock edge.

Substitution verifies every transition. All four two-bit states are used, so there is no unused-state recovery case. If only an output waveform rather than the state word is required, decode the desired states after the register.

MethodStrengthLimitation
RingDirect one-hot phasesOnly nn states from nn flip-flops
Johnson2n2n easily decoded phasesInvalid states need attention
LFSRPeriod up to 2n−12^n-1 with few gatesFixed pseudorandom order; zero lock
Counter + decoder/ROMArbitrary output sequenceExtra decoder or memory
Custom state machineArbitrary conditional sequenceFull state design required

Choosing a sequence-generator method.