I am executing a piece of code written by someone else, and it works, but I don't understand what is going on!
initial begin: running_test
fork
task1();
task2();
join
task3();
end: running_test
When, I follow by the debugger in the simulation, I see that when task1() hits a clock statement, then the debugger jumps to task2(), and once task2() similarly hits a clock statement, then the debugger jumps to task3() !!!!!
And this is where I get confused, because task2() is a long task, so why does it moves (joins) to task3() before finishing it.
And when I keep running the debugger, I constantly see that the debugger keeps jumping between task1(), task2() and task3()!!!!
This completely goes against my understanding of Fork/Join. I was expecting to see that the debugger will not move to task3(), unless it is done with task1() and task2(), but apparently every time it hits a clock statement (inside either one of the tasks), it goes to a different task!!!
Can someone explain what is going on?