[sdiy] LFSR using lookup tables

John Ames commodorejohn at gmail.com
Wed Feb 19 16:26:38 CET 2020


I'm genuinely curious - I suspect it may simply be down to compilers
not necessarily being smart about things, but changing:

if (lfsr < 0) lfsr ^= mask;
lfsr <<= 1;

or suchlike to:

lfsr = table[lfsr];

doesn't seem like it should save more than two or three instructions,
depending on the architecture. Plus, the larger your shift-register
size, the more cache you're going to chew up on CPUs that have it.

On 2/19/20, John Speth via Synth-diy <synth-diy at synth-diy.org> wrote:
> LUTs instead of "code" (hard logic or procedural) illustrates the
> classic speed vs memory tradeoff. If you have more of one than the
> other, you can craft your algorithm towards one method or the other. I'm
> skeptical that there is a need for LUTs in the very simple design domain
> of shift then xor. My gut tells me that shift then xor is always more
> efficient than using LUTs, both in terms of memory and speed resource
> usage. I'm eager to be shown the opposite.
>
> JJS
>
>
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
>



More information about the Synth-diy mailing list