ethernet/scripts
Sean Anderson c5df9ff5d5 Add script to calculate LFSR values
Add a script to calculate the initial value to load into an LFSR based
on how many cycles it should run for. The calculation is based on [1].
It takes advantage of the commutative and properties of exclusive or to
recursively break down the number of steps. This lets us achieve an
O(log(n)) runtime by caching our results. There's an alternative version
of this algoritm which stores bits by value (0x100) instead of position
(8). It's probably easier to do things that way in C or verilog, but
this was more elegant in python. When calculating the number of cycles,
we subtract one to get the number of cycles instead of the number of
steps.

[1] https://www.eevblog.com/forum/projects/algorithm-for-calculating-previous-states-of-lfsr-counters/msg2524395/#msg2524395

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-03-14 01:29:04 -04:00
..
__init__.py Add script to calculate LFSR values 2023-03-14 01:29:04 -04:00
lfsr.py Add script to calculate LFSR values 2023-03-14 01:29:04 -04:00