A linear feedback shift register (LFSR) is a shift register whose input bit is a linear function of its previous state.
The only linear function of single bits is xor, thus it is a shift register whose input bit is driven by the exclusiveor (xor) of some bits of the overall shift register value.
The initial value of the LFSR is called the seed, and because the operation of the register is deterministic, the stream of values produced by the register is completely determined by its current (or previous) state. Likewise, because the register has a finite number of possible states, it must eventually enter a repeating cycle. However, an LFSR with a wellchosen feedback function can produce a sequence of bits which appears random and which has a very long cycle.
Applications of LFSRs include generating pseudorandom numbers, pseudonoise sequences, fast digital counters, and whitening sequences. Both hardware and software implementations of LFSRs are common.
Contents
Fibonacci LFSRs
The bit positions that affect the next state are called the taps. In the diagram the taps are [16,14,13,11]. The rightmost bit of the LFSR is called the output bit. The taps are XOR'd sequentially with the output bit and then fed back into the leftmost bit. The sequence of bits in the rightmost position is called the output stream.
 The bits in the LFSR state which influence the input are called taps (white in the diagram).
 A maximumlength LFSR produces an msequence (i.e. it cycles through all possible 2^{n} − 1 states within the shift register except the state where all bits are zero), unless it contains all zeros, in which case it will never change.
 As an alternative to the XOR based feedback in an LFSR, one can also use XNOR.^{[1]} This function is not linear, but it results in an equivalent polynomial counter whose state of this counter is the complement of the state of an LFSR. A state with all ones is illegal when using an XNOR feedback, in the same way as a state with all zeroes is illegal when using XOR. This state is considered illegal because the counter would remain "lockedup" in this state.
The sequence of numbers generated by an LFSR or its XNOR counterpart can be considered a binary numeral system just as valid as Gray code or the natural binary code.
Full article ▸
