RTL Design #8 · 2026-10-01 · LFSRs · Easy · about 10 min
An LFSR that repeats too soon
lfsr8 is an 8-bit Fibonacci LFSR for the polynomial x⁸ + x⁶ + x⁵ + x⁴ + 1. Reset (synchronous, active low) loads 8'h01. On each rising edge with en high it shifts left, q <= {q[6:0], fb}, where fb is the XOR of the tap bits. With en low it holds.
This polynomial is maximal length: starting from 01, q should step through all 255 nonzero values before it comes back to 01. The first steps are 01 02 04 08 11 23 47 8e.
Run shows that this one comes back too soon. Fix lfsr.sv.
Write and run your answer in the browser. The hidden tests check it, and it’s free.