In reply to Anamika Sharma:
We don’t recommend using main_phase at all, but especially not for drivers. The reason is that your driver should be written to use run_phase so that it can always respond (even with just an idle cycle) to traffic on the interface to which is is connected. Similarly for monitors.
The additional run-time phases were best suited to controlling stimulus, and it’s really just easier to use virtual sequences. Rather than delaying the operation of driver1, what you really want to do is delay the start of sequence1, which sends transactions to driver1.
Now, first i want to implement like main_phase of driver_2 should not wait for completion of main_phase of driver_1.
You need to ask yourself what you need to do in pre_shutdown_phase. Remember, eventually you’ll need both agents to complete main and shutdown so you can exit run_phase and move to extract_phase. Try something like this in your virtual sequence:
fork
begin
main_seq2.start(sequencer2); // sequencer2 is a pointer to env.agent2.sequencer
shutdown_seq2.start(sequencer2);
end
begin
main_seq1.start(sequencer1);
shutdown_seq1.start(sequencer1);
end
join
Notice how each branch of the fork/join allows two sets of stimulus to execute in parallel. In each branch, the main_seq will complete followed by the shutdown_seq, independent of the other branch. Once both branches have completed, you can drop the objection and proceed to extract_phase.
Then , when I add domain synchronisation, then only main_phase of driver_2 should wait for completion of main_phase of driver_1.
fork
begin
sync_event.wait_trigger();
main_seq2.start(sequencer2); // sequencer2 is a pointer to env.agent2.sequencer
shutdown_seq2.start(sequencer2);
end
begin
main_seq1.start(sequencer1);
sync_event.trigger();
shutdown_seq1.start(sequencer1);
end
join
Using a combination of fork/join, begin/end, events and objections, you should be able to get whatever synchronization you require.