Imagine the complex scenario whereby you start the *same* sequence on multiple sub-drivers. Naturally each started sequence has its own execution thread, so how do you refer to all the started sequences, and/or know when they have finished?
Consider the following steps, followed by a code example that references the AXI UVC.
Step 1 - Add "has_started" and "has_ended" flags to "any_sequence", check why aren’t they there already?
Step 2 - Gen the child sequence, add it to a list of running seq’s, start the child sequence.
Step 3 - Wait to see a child sequence started using the "has_started" flag,
Step 4 - Wait for all child sequences to end
And now, the corresponding code example:
extend any_sequence
{
!has_started : bool;
on_started() is also { has_started = TRUE; };
!has_ended : bool;
on_ended() is also { has_ended = TRUE; };
};
extend MAIN virtual_seq {
!running_seqs : list of any_seq;
!child_seq : my_seq vr_axi_master_seq;
drivers : list of vr_axi_master_driver;
keep drivers == get_sub_drivers().all(it is a
vr_axi_master_driver);
body()@driver.clock is only {
driver.raise_objection(TEST_DONE);
foreach in drivers {
gen child_seq keeping
{.driver == it;};
running_seqs.add(child_seq);
child_seq.start_sequence()
};
-- wait for a child sequence to start
wait true(not running_seqs.is_empty() and
running_seqs.has(it.has_started));
-- allow the traffic to complete before dropping
the TEST_DONE objection
wait true(not running_seqs.has(it.has_ended ==
FALSE));
driver.drop_objection(TEST_DONE);
};
};
Make sense? Don't be shy about commenting / improving upon this example ...
Happy Sequencing!
Team Specman