
07-07-2009, 01:54 AM
|
|
|
Re: Generating Maximum Length Sequence using Galois LFSR
Steve Pope wrote:
> Nicholas Kinar <[email protected]> replies to my post,
>
>>> It's good to keep track of the algebra. For a generating
>>> polynomial G of degree m over GF(2), you are computing the remainder
>>>
>>> x^n mod G
>>>
>>> for a series of values n=0, n=1,....
>>>
>>> This remainder is a polynomial over GF(2) of (at most) degree m-1.
>>> How you represent it in a bit field is totally up to you,
>>> and your method is as correct as any.
>>>
>>> Steve
>
>> In my C++ implementation, I use an std::vector<bool>v to keep track of
>> the zeros and the ones, so I can simply generate an MLS without having
>> to worry about bit-shifting a uint32_t or uint16_t or similar variable.
>> To do the rotation, I simply pop a bit off the back of the vector, do
>> the XOR with the taps, and then insert the resulting bit at the front of
>> the vector. It works quite well, but for embedded hardware, it might be
>> a little bit too slow for a quick implementation.
>
> Methods on std::vector<bool> are notorious for being slow,
> since this object has packed the boolean bits into chars,
> to save memory space.
>
> Steve
If only 'C' bit fields had had *DEFINED* behavior....
*Sigh*.
--
Les Cargill
|