% % (C) 2006 Muthiah Annamalai <muthuspost@gmail.com> % % Implement book keeping for a Pseudo-Random Binary Sequence ( PRBS ) % also called as a Linear Feedback Shift Register. % % For the given PRBS in a intial state, compute the PRBS sequence length. % Length is period of output when the PRBS state is same as % the start state of PRBS. % % Example: If you had a PRBS shift register like the diagram % below with 4 registers we use representation by polynomial % of [ 1 2 3 4], and feedback connections between [ 1 3 4 ]. % The output PRBS sequence is taken from the position 4. % % +---+ +----+ +---+ +---+ % | D |----| D |---| D |---| D | % +---+ +----+ +---+ +---+ % | | | % \ / / % [+]---------------+------+ % 1 + 0.D + 1.D^2 + 1.D^3 % % The code to implement this PRBS will be % prbs=prbs_generator([1 3 4],{[1 3 4]},[1 0 1 1]); % x = prbs_sequence(prbs) %gives 15 %