LFSR, PRBS & CRC
16-Bit Fibonacci LFSR (Left-Shift, Fixed Taps) — L1 Upgrade — L2 Upgrade
16-bit Fibonacci Linear Feedback Shift Register with left-shift architecture, fixed taps (x^16+x^15+x^13+x^4+1), and zero-state lock detection.
About this block
Simulate it in the Verilog IDE
16-Bit Fibonacci LFSR (Left-Shift, Fixed Taps) — L1 Upgrade — L2 Upgrade 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 core implements a 16-bit Fibonacci Linear Feedback Shift Register (LFSR) using a left-shift architecture with fixed taps.
It is designed for pseudo-random number generation (PRNG), built-in self-test (BIST), and scrambling applications.
The core generates a maximal-length sequence of $2^{16}-1$ states for any non-zero seed and includes a built-in zero-state detection mechanism (lock signal) to handle the illegal all-zero state.
- Choose Open in IDE. RTL Studio loads the packaged workspace for 16-Bit Fibonacci LFSR (Left-Shift, Fixed Taps) — L1 Upgrade — L2 Upgrade.
- Read the Verilog module in the editor. The catalog line for this block: 16-bit Fibonacci Linear Feedback Shift Register with left-shift architecture, fixed taps (x^16+x^15+x^13+x^4+1), and zero-state lock detection.
- 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
- Architecture: Left-shift Fibonacci LFSR.
- Polynomial: $x^{16} + x^{15} + x^{13} + x^4 + 1$ (Primitive).
- Taps: Bits 15, 13, and 4 (MSB to LSB indexing).
- Zero-State Detection: The
lockoutput asserts high when the LFSR state becomes all zeros. This serves as an error indicator or stall enable for external logic. - Maximal Length: Generates a sequence of length $2^{16}-1$ for any non-zero seed.
- Synchronous Control: Supports synchronous reset and load operations.
Architecture
The LFSR shifts data to the left on every rising clock edge. Feedback is calculated by XORing the output bits at the tap positions (15, 13, and 4). The resulting feedback bit is inserted into the least significant bit (LSB) position.
A dedicated detection mechanism monitors the internal state. If the state becomes all zeros (an illegal state for maximal-length LFSRs), the lock output asserts high. External logic can use this signal to halt further processing or reload a seed.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low synchronous reset |
load | Input | 1 | Load enable. When high, seed is loaded into q |
seed | Input | 16 | Seed value for initialization |
lock | Output | 1 | Asserted high when LFSR state is zero |
q | Output | 16 | Current LFSR state |
Verification
The IP includes a comprehensive testbench (tb_lfsr_16bit_fibonacci_lshift_fixed_taps_arithmetic_mode_seed_lock.v) that verifies:
- Reset Behavior: Ensures
qandlockare cleared on reset. - Load Functionality: Verifies that the seed is correctly loaded into
q. - Shift Logic: Confirms correct left-shift behavior with fixed taps.
- Lock Detection: Validates that
lockasserts when the state is zero. - Long-Run Stability: Runs 100+ cycles with non-zero seeds to ensure no false lock assertions.
All test cases pass successfully, confirming maximal-length sequence generation for non-zero seeds.
More in LFSR, PRBS & CRC
- 32-Bit Fibonacci LFSR (Right-Shift + Enable) — L2 Upgrade
- 64-Bit LFSR (2 Tap-Set Parameter Select)
- 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