2'b00:
begin
AO<=0;
BO<=0;
if(a2==0&a1==1&b1==b2==0) //a==b==0,but posedge of A comes first,A lead
begin
dependa<=1;
AO<=~AO;
state<=edgecount; //goto count the edge of A,AO and BO change according their counters
end
else
begin
if(b2==0&b1==1&a1==a2==0) //a==b==0,but posedge of B comes first,B lead
begin
dependb<=1;
BO<=~BO;
state<=edgecount; //goto count the edge of A,AO and BO change according their counters
end
else state<=idle;
end
end