Binary LFSR Maximum Length Sequences Explained
A maximum-length sequence, commonly referred to as an m-sequence, is the longest periodic binary sequence that an \(n\)-bit Linear Feedback Shift Register (LFSR) can generate before repeating its state. In a binary LFSR, the sequence achieves an optimal period of \(2^n - 1\) bits, cycling through every possible non-zero state. These deterministic, noise-like bitstreams exhibit ideal statistical properties, making them indispensable in telecommunications, cryptography, radar systems, and digital circuit testing.
How a Binary LFSR Generates an M-Sequence
A binary LFSR consists of \(n\) interconnected shift register stages (flip-flops), each holding a single binary digit (0 or 1). On each clock cycle, the following operations occur simultaneously:
- Shift: The bit in each register moves to the next adjacent stage to the right.
- Output: The bit in the final register (\(n\)) is shifted out as the sequence output.
- Feedback Calculation: Specific register outputs, known as “taps,” are combined using modulo-2 addition (XOR logic).
- Input: The resulting XOR bit is fed back into the first register stage.
An \(n\)-stage register can theoretically represent \(2^n\) unique states. However, if the register enters the all-zeros state (\(00\dots0\)), modulo-2 addition will continuously yield zero, causing the LFSR to become permanently stuck. Consequently, the all-zero state is omitted, resulting in a maximum achievable period of \(L = 2^n - 1\).
The Role of Primitive Polynomials
An LFSR will only produce a full-period m-sequence if its feedback configuration corresponds to a primitive polynomial of degree \(n\) over the Galois Field \(\text{GF}(2)\).
A polynomial is primitive if: * It is irreducible (it cannot be factored into smaller polynomials over \(\text{GF}(2)\)). * It defines a Galois field where the variable \(x\) acts as a primitive element (a generator).
For example, for a 3-bit register (\(n=3\)), the maximum length is \(2^3 - 1 = 7\). The polynomial \(P(x) = x^3 + x + 1\) is primitive. Implementing XOR feedback from the first and third stages will step the LFSR through all 7 non-zero states in a pseudo-random order before repeating.
Core Properties of M-Sequences
M-sequences are widely used because they closely approximate the statistical properties of true random binary noise while remaining fully deterministic:
- Balance Property: Across one full period, the number of ones exceeds the number of zeros by exactly one. An m-sequence contains \(2^{n-1}\) ones and \(2^{n-1} - 1\) zeros.
- Run Property: A “run” is a continuous string of identical bits. Half the runs in an m-sequence have a length of 1, one-quarter have a length of 2, one-eighth have a length of 3, and so on.
- Autocorrelation Property: The periodic autocorrelation function of an m-sequence is two-valued. When aligned with itself (zero shift), the correlation is at its maximum peak (\(1.0\)). For any non-zero shift, the correlation drops to a constant low value of \(-1 / (2^n - 1)\), making it virtually uncorrelated with time-shifted versions of itself.
Applications
Because of their pseudo-randomness and sharp autocorrelation peaks, binary m-sequences are heavily utilized in: * Spread Spectrum Systems: Direct-Sequence Spread Spectrum (DSSS) and Code Division Multiple Access (CDMA) communications. * Navigation: Global Positioning System (GPS) ranging signals (such as Gold codes derived from pairs of m-sequences). * Hardware Testing: Built-In Self-Test (BIST) designs to generate pseudo-random test patterns for integrated circuits. * Acoustics and Radar: Measuring impulse responses and time-of-flight distances.