di2889l1.txt ;************************************************************************************************** ; ; LISTING 1 - ROUTINE FOR DETECTING SEQUENCES ; ; "Routine automates pattern/sequence detection," EDN, May 16, 2002, pg 108 ; ;******************************************************************************************** if (SEQ[m] == 1) { Next state transition on input 1 = Sm+1. Let p = m. //p is a variable. while (p! = 0) { Form a p-bit sequence comprising of the last p-1 bits received and 0. if(the p bit sequence obtained == the first p bits of the sequence) break; p--; } Next state transition on input 0 = Sp. } else if(SEQ[m] == 0) { Next state transition on input 0 = Sm+1. Let p = m. while (p! = 0) { Form a p-bit sequence comprising of the last p-1 bits received and 1. if(the p bit sequence obtained == the first p bits of the sequence) break; p--; } Next state transition on input 1 = Sp. }