Created
October 8, 2020 19:11
-
-
Save hube12/d0dbc2383648cba6cb8487c1e5c4c379 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from pylfsr import LFSR | |
| L = LFSR() | |
| state = [1,1,1,1,1,0,0,0,0,0] | |
| fpoly = [10,8,5,4] | |
| L = LFSR(fpoly=fpoly,initstate =state, verbose=False) | |
| L.info() | |
| period=1023 | |
| for i in range(1,1024): | |
| L.next() | |
| if np.array_equal(L.state,state): | |
| print("found at:",i) | |
| period=min(period,i) | |
| if i<=20: | |
| print("State",i,L.state) | |
| print("total period",period) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment