We might face the situation where we need to spawn different threads on different sequencers or components and wait for all threads to finish. Immediate idea comes to mind is fork-join but look at the scenario here:-
for(int index=0;index<14;index++)begin automatic int idx=index; fork begin `uvm_do_on(sequence_inst,p_sequencer.my_sqr[idx]); end join_none; end
And it works fine, except that I'd like to use "join" (all) instead of "join_none" since I have to wait for all the sequences to be completed before continuing the test case.
if we use "join", it looks like the sequences are not forked, but launched one after the other...
if we use "join", it looks like the sequences are not forked, but launched one after the other...
What we need to do is to add a wait fork statement after the for loop. This block the current thread until all child threads have completed. You have to be careful if there are any other earlier fork_join_none statements that you do not want to wait for them to finish. If there are, the you need to create an isolating thread.
fork begin : isolating_thread for(int index=0;index<14;index++)begin : for_loop fork automatic int idx=index; begin `uvm_do_on(sequence_inst,p_sequencer.my_sqr[idx]); end join_none; end : for_loop wait fork; end : isolating_thread join
No comments:
Post a Comment