Finite state Machine

1010100111                     wire "next" table into program     a[N+1..N+M]:=p[1..M]
  10100111
                                i:=0;
j | next[j]                     0:i:=i+1;
--+---------  		   	1:if a[i]<>'1' then goto 0; i:=i+1;<=comp a[i] with p[1]=1
1 |   0				2:if a[i]<>'0' then goto 1; i:=i+1;<=comp a[i] with p[2]=0
2 |   1				3:if a[i]<>'1' then goto 1; i:=i+1;<=comp a[i] with p[3]=1
3 |   1				4:if a[i]<>'0' then goto 2; i:=i+1;
4 |   2				5:if a[i]<>'0' then goto 3; i:=i+1;<=comp a[i] with p[5]=0
5 |   3				6:if a[i]<>'1' then goto 1;
6 |   1				7:if a[i]<>'1' then goto 2;
7 |   2				8:if a[i]<>'1' then goto 2;
8 |   2			  	  search:=i-8;
								      i	
      j = state - program				1 1 0 1 0 1 0 0 1 1 1 
                  counter 			 	  1 0 1 0 0 1 1 1 	
								      j