Skip to content

Instantly share code, notes, and snippets.

@mahiuchun
Created April 22, 2013 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahiuchun/5436996 to your computer and use it in GitHub Desktop.
Save mahiuchun/5436996 to your computer and use it in GitHub Desktop.
Simulation code for IERG3010 lecture notes, Figure 7.3
stages = [0, 0, 0]
input_seq = [1, 1, 0, 1, 0, 1, 1, 0, 0]
output_seq = []
for b in input_seq:
stages = [b] + stages[:2]
output_seq.append( (stages[0] + stages[2]) % 2 )
output_seq.append( (stages[0] + stages[1] + stages[2]) % 2 )
print(output_seq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment