Você está na página 1de 14

Linear feedback shift register

In computing, a linear-feedback shift register (LFSR) is


a shift register whose input bit is a linear function of its
previous state.

The most commonly used linear function of single bits


is exclusive-or (XOR). Thus, an LFSR is most often a
shift register whose input bit is driven by the XOR of
some bits of the overall shift register value.

Linear Feedback Shift Registers


(LFSR)

Basic 4-bit LFSR


XOR-Based

These circuits can also be built equivalently with XNOR states, with the dead state
being all 1s instead of all 0s.

Four State Shift Register

The initial value of the LFSR is called the seed


The stream of values produced by the register is
completely determined by its current (or previous) state
the register has a finite number of possible states, it
must eventually enter a repeating cycle

LFSR with a well-chosen feedback function can


produce a sequence of bits which appears random and
which has a very long cycle

Effects of Errors
If using a sequence of 2n-1 then there is a potential
lockup state
For XOR LFSRs, lock up state = all 0s.
For XNOR LFSRs, lock up state = all 1s.

Probability of lockup is relatively low for large n, as a


result of SEU
# of lockup states = 1
total # of states = 2n

The bit positions that affect the next state are called the taps.

The rightmost bit of the LFSR is called the output bit


The sequence of bits in the rightmost position is
called the output stream

Different tap sets


Different maximum length sequences

Reversed set of taps


a [ n ] = a [ n 3] a [ n 4]

( a [ n ] a [ n 4])

a [ n 4] = a [ n 3] a [ n ]
a [ n ] = a [ n + N 3] a [ n + N ]
Shift register runs backward in time
Equivalent to a shift register using taps 1 and 4 instead of taps 3 and 4

LFSR
So, how do we find the maximal length tap positions?
We look at the number of bits, .
Define = 2

+ 1, and try to factor this polynomial.

If factors = () exist, pick exponents of the factors with degree equal to .


Example, = 3.
= 7 + 1 = (x + 1)(x 3 + x 2 + 1)(x 3 + x + 1)
We have two sets of maximal length tap positions: [1,3] and [2,3].

LFSR
Take = 3, start state [1,0,1] with different tap positions. Left is [2,3] ( 3 + 2 + 1), right is
[1,3] ( 3 + + 1).

1 0 1

1 0 1

1 1 0

0 1 0

1 1 1

0 0 1

0 1 1

1 0 0

0 0 1

1 1 0

1 0 0

1 1 1

0 1 0

0 1 1

List of maximal-length polynomials

Taps for Maximum Length LFSR


Counters