In reply to dave_59:
Thank you, Dave.
Yes, I missed the clock inside the inner while loop. We have @(negedge clk) before the count++.
Quote:
Most people will have join_any followed by disable fork. That means as soon as one of the processes you fork off terminates, then terminate all of the remaining processes.
In my case, I don't want the while(1) to terminate yet, so cannot use join_any and disable fork option for the original code.
Quote:
You need a way to exit the while(1) loop.
Thanks for this, as I wasn't sure if the test would hang because of this while(1) loop. I understand I have to find a way to exit this loop for test to finish gracefully.
Can I add a big delay in the second begin-end statement of fork and then have join_any and disable fork to exit the while :
fork
while(1) begin
count = 0;
@ (posedge valid);
total_checks++; // no of times valid is asserted
while(valid == 1 || count <6) begin // while loop needs to loop for cycle for some checking after valid is asserted
count++;
end
end // while(1)
begin
wait(signal_x);
#x; //x is big enough to finish all the transactions in while(1) loop
end
join_any
disable fork