Communication Technology





LFSR (Linear Feedback Shift Register)


LFSR is a shift register circuit in which two or more outputs from intermediate steps get linearly combined and feedback to input value. That's why it is called Linear Feedback Shift Register as illustrated below.


This circuit has following properties :

  • If the initial states is same, you will always get the same output sequence (meaning Output sequence is deterministic)
  • Output sequence tend to be like random sequence (Pseudo random)
  • After a certain number of iteration, you will get the states values which is same as the initial states. (The maximum interval can be calculated by (2^n - 1), where n is the number of shift register.)

Due to the properties listed above, LFSR is mainly used to generate PN sequence (Pseudo Noise sequence).



States transition of each iterations for the circuit in this example is shown below. From this table, you may notice all the properties listed above.




In many publication, you would see this circuit is represented as a polynomial. But you may find it difficult to correlate between the real circuit and the generator polynomial. Following illustration would help you understand the meaning of the generator polynomial.



< LFSR with Matlab Communication Toolbox >


You can implement LFSR with Matlab Communication Toolbox as shown below. This example is for the circuit described above.


    g = [1 0 0 1 1];

    init = [1 1 1 1];

    curr = [1 1 1 1];

    mask = [0 0 0 1];

    NoOfOutBits = 15;


    h ='GenPoly',       g, ...

                  'InitialStates', init,   ...

                  'CurrentStates', curr,   ...

                  'Mask',          mask,   ...

                  'NumBitsOut',    NoOfOutBits)

If you genearte the output sequence using following function,


you will get the following output.

    1     1     1     1     0     0     0     1     0     0     1     1     0     1     0


Compare this result with x(i-4) column in the table shown above.