RTL Studio Open IDE

LFSR, PRBS & CRC

8-Bit Fibonacci LFSR (Right-Shift + Mask XOR) — L1 Upgrade

An 8-bit Fibonacci Linear Feedback Shift Register supporting right-shift, mask XOR feedback, load, and arithmetic increment modes.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

8-Bit Fibonacci LFSR (Right-Shift + Mask XOR) — L1 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 an 8-bit Fibonacci Linear Feedback Shift Register (LFSR) with right-shift behavior. It supports three operational modes:

  1. LFSR Mode: Generates pseudo-random sequences using taps at bits [7], [5], and [4].
  2. Load Mode: Loads data_in directly into the state register.
  3. Arithmetic Mode: Increments the current state by 1.

The design is targeted at beginner-level integration (Difficulty Level 1) and is fully verified with a testbench using Icarus Verilog.

The module generates pseudo-random sequences using a Fibonacci tap configuration.

  • Polynomial: $x^8 + x^6 + x^5 + x^4 + 1$
  • Taps: Bits [7], [5], and [4] are XORed to form the new MSB.
  • Operation: Right-shift operation moves data toward lower indices.
  • Reset Value: The state is initialized to 8'b1 on asynchronous reset.
  1. LFSR Mode: Standard feedback shift. The new MSB is calculated as state[7] ^ state[5] ^ state[4].
  2. Load Mode: Loads data_in into the state register. This mode has the highest priority.
  3. Arithmetic Mode: Increments the state by 1. This mode is active when arithmetic_mode is high and load is low.
  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit Fibonacci LFSR (Right-Shift + Mask XOR) — L1 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: An 8-bit Fibonacci Linear Feedback Shift Register supporting right-shift, mask XOR feedback, load, and arithmetic increment modes.
  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.

Architecture

The core state machine updates on the positive clock edge. Reset initializes the state to 8'b1. Three modes are controlled by valid, load, and arithmetic_mode signals.

Ports

Port NameDirectionWidthDescription
clkInput1Clock signal
rst_nInput1Active-low asynchronous reset
loadInput1Load data_in into state (Priority: High)
validInput1Enable state update
arithmetic_modeInput1Select increment mode over LFSR (Priority: Medium)
data_inInput8Input data for load or arithmetic
data_outOutput8Current state value
busyOutput1High when valid is asserted

Verification

The testbench validates reset, load, LFSR stepping, arithmetic mode, and busy signaling. Simulation uses Icarus Verilog and generates a VCD dump.

Test CaseDescriptionExpected ResultStatus
TC1Reset CheckState equals 8'b1PASS
TC2Load CheckState equals 8'b10101010PASS
TC3LFSR StepState equals 8'b01010101PASS
TC4Arithmetic StepState equals 8'b00000010PASS
TC5Busy SignalBusy equals 1'b1PASS
TC6Valid LowState remains unchangedPASS

More in LFSR, PRBS & CRC

All LFSR, PRBS & CRC blocks