← ProblemsCircuits / Sequential Logic / Shift Registers

32-bit LFSR

15%shift-registersvectors

Build a 32-bit Galois LFSR with taps at bit positions 32, 22, 2, and 1. As in the 5-bit version, the register shifts right and the output bit q[0] is XORed into the bit entering each tap position:

  • q[31] gets q[0] (the shift-in at the top tap)
  • q[21] gets q[22] ^ q[0]
  • q[1] gets q[2] ^ q[0]
  • q[0] gets q[1] ^ q[0]
  • every other bit q[i] gets q[i+1]

reset is synchronous, active-high, and sets the register to 32'h1. (At 32 bits you'll want vector part-selects, not 32 separate assignments.)