EcrioniX Logic

The Mathematics of Pseudo-Randomness

A **Linear Feedback Shift Register (LFSR)** is a shift register whose input bit is a linear function of its previous state. The most common linear function used is the **Exclusive-OR (XOR)** operation. LFSRs are ubiquitous in digital systems due to their ability to generate pseudo-random sequences, high-speed counters, and error detection codes with minimal hardware.

1. Core Architecture

An LFSR consists of a chain of Flip-Flops (the register) and a feedback network.

  • Shift Register: Shifts bits from one stage to the next on every clock cycle.
  • Taps: Specific outputs from the register chain that are selected for feedback.
  • Feedback Function: The selected taps are XORed together to calculate the new input bit (MSB or LSB depending on architecture).

2. Fibonacci vs. Galois Implementation

Fibonacci (Many-to-One)

The standard form. The outputs of the tapped flip-flops are all XORed together in a single logic cloud, and the result is fed back to the input of the first flip-flop.

Downside: As the number of bits grows, the logic depth of the XOR chain increases, limiting the maximum clock frequency (propagation delay).

Galois (One-to-Many)

The output of the last flip-flop is fed back to the input of the first, but it is also XORed into specific intermediate stages along the chain.

Upside: The XOR gates are placed between flip-flops. This breaks the critical path, allowing each stage to resolve in parallel. It is preferred for high-speed hardware.

3. Maximal Length Sequences

An LFSR with $n$ bits has $2^n$ possible states. However, the state of all zeros is a "lock-up" state (0 XOR 0 = 0, so it never changes). Therefore, the maximum number of unique states an LFSR can cycle through is **$2^n - 1$**.

To achieve this maximum length, the feedback taps must correspond to a **Primitive Polynomial** over the Galois field GF(2). If the taps are chosen incorrectly, the sequence will repeat much sooner, creating a shorter cycle.

4. Applications in VLSI & Systems

  • BIST (Built-In Self-Test): Used to generate random test patterns to check internal logic gates for faults.
  • CRC (Cyclic Redundancy Check): Used in Ethernet, USB, and storage to detect data corruption during transmission.
  • Scrambling/Whitening: Used in PCIe and WiFi to randomize data patterns, reducing electromagnetic interference (EMI) and preventing resonant frequency spikes.
  • Cryptography: Stream ciphers (like A5/1 used in GSM) utilize LFSRs, though modern crypto requires non-linear elements for security.

Configuration

Register Width (N) 4 Bits
Architecture
Seed Value (Hex)

Sequence Analysis

Current Value 0x1
Period Counter 0
Max Period ($2^n-1$) 15
Circuit View (Click FFs to Toggle Taps)