RTL Studio Open IDE

LFSR, PRBS & CRC

32-Bit Fibonacci LFSR (Right-Shift + Enable) — L2 Upgrade

A 32-bit Fibonacci Linear Feedback Shift Register with right-shift architecture, enable control, and golden-value lock detection.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

32-Bit Fibonacci LFSR (Right-Shift + Enable) — L2 Upgrade is a Verilog reference block in the LFSR, PRBS & CRC catalog. LFSR, PRBS, CRC, and pseudo-random sequence generators. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP implements a 32-bit Fibonacci Linear Feedback Shift Register (LFSR). It uses a right-shift architecture with enable control and lock detection. The design targets Level 2 complexity for educational and verification purposes.

This IP provides a robust 32-bit LFSR with lock detection capabilities.

It is suitable for test pattern generation and state machine sequencing.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 32-Bit Fibonacci LFSR (Right-Shift + Enable) — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: A 32-bit Fibonacci Linear Feedback Shift Register with right-shift architecture, enable control, and golden-value lock detection.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. 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

  • 32-bit Fibonacci LFSR: Generates pseudo-random sequences using a standard primitive polynomial.
  • Right-Shift Architecture: Feedback is injected into the MSB after shifting right.
  • Enable Control: Synchronous state updates gated by an en signal.
  • Lock Detection: Compares the current state against a golden seed value and asserts a flag on match.
  • Synchronous Reset: Active-low reset initializes the LFSR to a specific seed.

Architecture

The LFSR uses taps at positions 0, 10, 30, and 31 (0-indexed). Feedback is computed using XOR operations on these tap bits. The shift direction is right, with feedback injected into the MSB (bit 31).

Lock detection compares the current output register lfsr_out with the golden input. The lock_flag asserts high when they match.

Interface

Signal NameDirectionWidthDescription
clkInput1Clock signal
rst_nInput1Active-low synchronous reset
enInput1Enable signal for shifting
goldenInput32Reference value for lock detection
lfsr_outOutput32Current LFSR state
lock_flagOutput1Asserted when lfsr_out equals golden

Verification

The testbench verifies reset behavior, shifting, and lock detection. It confirms the initial seed value upon reset. It checks the first shift cycle for correct feedback calculation. It validates that the lock flag asserts when the golden value matches. It ensures the lock flag clears when the golden value changes. It verifies that the state holds when the enable signal is deasserted.

Test CaseDescriptionResult
TC1Reset value and lock flag initializationPASS
TC2First shift cycle and feedback logicPASS
TC3Lock detection assertion on matchPASS
TC4Lock detection clearance on mismatchPASS
TC5State hold on disablePASS

More in LFSR, PRBS & CRC

All LFSR, PRBS & CRC blocks