← ProblemsCircuits / Sequential Logic / Shift Registers
5-bit LFSR
15%shift-registersA linear-feedback shift register (LFSR) is a shift register whose input bit is a function (usually XOR) of its own state — it steps through a pseudo-random sequence of states.
Build a 5-bit Galois LFSR with taps at bit positions 5 and 3. In a Galois LFSR the register shifts right, and the bit shifted out (q[0]) is XORed into the bit entering each tap position:
q[4](position 5, a tap) getsq[0]shifted inq[3]getsq[4]q[2](below tap position 3) getsq[3] ^ q[0]q[1]getsq[2]q[0]getsq[1]
reset is synchronous, active-high, and sets the register to 5'h1.