← ProblemsCircuits / Sequential Logic / Shift Registers

5-bit LFSR

15%shift-registers

A 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) gets q[0] shifted in
  • q[3] gets q[4]
  • q[2] (below tap position 3) gets q[3] ^ q[0]
  • q[1] gets q[2]
  • q[0] gets q[1]

reset is synchronous, active-high, and sets the register to 5'h1.