Skip to content

Replicate Computerphile example #9

Closed Answered by Nikeshbajaj
isidroas asked this question in Q&A
Discussion options

You must be logged in to vote

As video says, it is a 4-bit LFSR with tabs (or feedback polynomial ) as [4,3] (feeback from 4th and 3rd bit) with initial state as 1001, here is a code that generate exactly the same output as in video:

import pylfsr
from pylfsr import LFSR

state = [1,0,0,1]
fpoly = [4,3]
L = LFSR(initstate=state,fpoly=fpoly,counter_start_zero=False)
print('count \t state \t\t\toutbit \t seq')
print('-'*50)
for _ in range(16):
    print(L.count,L.state,'',L.outbit,L.seq,sep='\t')
    L.next()
print('-'*50)
print('Output: ',L.seq)

You could also visualise the same LFSR as

L.Viz()

Note that feeback-bit 1 in above figure is Not the feedback computed from current state shown in figure (1100) but from th…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Nikeshbajaj
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants