module FSM04
Title '110 recognizer'

Declarations

  Clock		PIN;
  Reset		PIN;
  SerIn		PIN;
  SerOut	PIN istype 'com';
  Q1, Q0	PIN istype 'reg';

state_diagram [Q1, Q0]

state [0, 0]:	IF !SerIn THEN [0, 0] WITH SerOut = 0
		          ELSE [0, 1] WITH SerOut = 0 
		          
state [0, 1]:	IF !SerIn THEN [0, 0] WITH SerOut = 0
		          ELSE [1, 0] WITH SerOut = 0

state [1, 0]:	IF !SerIn THEN [0, 0] WITH SerOut = 1
		          ELSE [1, 0] WITH SerOut = 0

Equations
  Q1.CLK = Clock ;
  Q0.CLK = Clock ;
  Q1.AR  = Reset ;
  Q0.AR  = Reset ;  

end FSM04
