LFSR, PRBS & CRC
64-Bit LFSR (2 Tap-Set Parameter Select)
64-bit LFSR with parameter TAP_SEL choosing between two fixed tap sets, plus load and enable.
About this block
Simulate it in the Verilog IDE
64-Bit LFSR (2 Tap-Set Parameter Select) is a Verilog reference block in the LFSR, PRBS & CRC catalog. LFSR, PRBS, CRC, and pseudo-random sequence generators. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.
This IP implements a 64-bit Linear Feedback Shift Register (LFSR) with maximal-length sequence generation. It supports two configurable primitive polynomials via a parameter select signal. The design includes parallel load, synchronous reset, and enable gating capabilities.
This IP provides a robust 64-bit LFSR with flexible tap configuration. It is suitable for applications requiring pseudo-random number generation or testing. The design is fully verified for reset, load, and enable functionalities. Simulation results confirm correct operation for both tap sets.
- Choose Open in IDE. RTL Studio loads the packaged workspace for 64-Bit LFSR (2 Tap-Set Parameter Select).
- Read the Verilog module in the editor. The catalog line for this block: 64-bit LFSR with parameter TAP_SEL choosing between two fixed tap sets, plus load and enable.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.
RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.
Features
- 64-bit state width for long pseudo-random sequences.
- Configurable tap sets via the
TAP_SELparameter. - Synchronous reset to zero state.
- Parallel load capability for seeding the LFSR.
- Enable gating to hold state during idle periods.
- Maximal-length sequence generation (excluding all-zero state).
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
| clk | Input | 1 | Clock input for synchronous operations. |
| rst_n | Input | 1 | Active-low synchronous reset signal. |
| en | Input | 1 | Enable signal to advance the LFSR state. |
| seed | Input | 64 | Parallel load data for the LFSR state. |
| load | Input | 1 | Active-high signal to load seed into the LFSR. |
| q | Output | 64 | Current state of the LFSR. |
Architecture
The core state register lfsr_reg updates on the positive edge of clk. Reset forces the register to zero when rst_n is low. Load overrides the shift operation when load is high, capturing seed. Enable gating prevents state updates when en is low. Feedback logic computes the XOR of specific taps based on TAP_SEL. Tap Set 0 uses taps at indices 0, 1, 2, and 3. Tap Set 1 uses taps at indices 0, 1, 5, and 6. The feedback bit is inserted at the MSB (bit 63) during right shifts.
Verification
The testbench verifies reset, load, enable gating, and sequence logic.
| Test Case | Description | Expected Result |
|---|---|---|
| TC1 | Reset Test | Output q becomes 64'h0 when rst_n is low. |
| TC2 | Load Seed Test | Output q matches seed when load is high. |
| TC3 | Enable Gating Test | Output q remains constant when en is low. |
| TC4 | Sequence Logic Test | Output q changes every cycle and never hits 0 for 100 cycles. |
| TC5 | Different Seed Load Test | Output q matches 64'hFFFFFFFFFFFFFFFF when loaded. |
All tests passed successfully in the simulation log. The simulation confirms correct maximal-length sequence behavior for the selected taps.
More in LFSR, PRBS & CRC
- 16-Bit Fibonacci LFSR (Left-Shift, Fixed Taps) — L1 Upgrade — L2 Upgrade
- 32-Bit Fibonacci LFSR (Right-Shift + Enable) — L2 Upgrade
- 8-Bit Fibonacci LFSR (Right-Shift + Mask XOR) — L1 Upgrade
- 8-Bit Galois LFSR (x⁸+x⁶+x⁵+x⁴+1)
- 8-Bit Parallel Scrambler — L2 Upgrade
- Additive Lagged Fibonacci 16
- CRC-16-CCITT Serial
- CRC-32 Generator (lfsr_crc)
- PRBS-32 Sequence Checker with Error Counter
- PRBS-32 Sequence Generator
- Trivium-Lite Keystream 8-bit
- Xorshift32 PRNG — L2 Upgrade
- Xorshift64* PRNG