In reply to Satputesb:
A couple of things you do not mention. What happens after A3 goes high? Does you care? Do you expect A1-A3 to go low in any order? Do you need to repeat the check once the sequence is detected? I’m going to assume you don’t care what happens after A3 goes high. I prefer to use wait statements rather than events.
bit A1,A2,A3;
bit OK;
initial begin
OK = 0;
fork
begin
wait (A1) assert (!A2 && !A3);
wait (!A1) assert (OK);
end
begin
wait (A2) assert (A1 && !A3);
wait (!A2) assert (OK);
end
begin
wait (A3) assert (A1 && A2);
OK = 1;
wait (!A3);
end
join
end
If you need to repeat this sequence check then this code will have to be modified depending on your answers.