[sdiy] LFSR using lookup tables

John Ames commodorejohn at gmail.com
Wed Feb 19 16:53:47 CET 2020


On 2/19/20, mskala at ansuz.sooke.bc.ca <mskala at ansuz.sooke.bc.ca> wrote:
> It may save a conditional jump, which is important because those often
> result in pipeline flushes that cost much more than ordinary instructions
That's true - though it's usually not too difficult to re-jigger the
code to avoid a branch entirely in this particular case, even on
architectures without conditional execution. Consider the algorithm:

Temp = LFSR
Arithmetic-right-shift temp by word size
AND temp with XOR mask
XOR LFSR with temp
Shift LFSR left by 1

This is five instructions compared to two or three, but runs
straight-through and can be done entirely in register on a lot of
architectures.



More information about the Synth-diy mailing list