Using VMM Consensus to end your test
Posted by JL Gray on August 23rd, 2010
Asif Jafri, Verification Consultant, Verilab
One topic that is often overlooked is how does one end a test. One common approach has been to use pound delays or count the number of transactions generated. While this worked well for directed test environments this approach is not well suited for use with constrained random testbenches. Usually there are several threads running in parallel and to be able to intelligently tell whether all test criterions are met, we need a more centralized approach to manage and decide test completion. vmm_group now has a mechanism to centrally manage test completion with the use of VMM Consensus.To better explain the usage let’s try to build an example:
1. Instantiate a vmm_voter class to indicate consensus or oppose end of test.
2. Identify the participants that will need to consent before the test ends. These participants can be in the form of transactors which will consent when idle, channels consent when empty, notifications and vmm_consensus. Add the voters in the vmm_group::build_ph()
3. Add vmm_consensus::wait_for _consensus() to vmm_group::wait_for_end() method. Once all participants consent, the test will complete.
class tb_top extends vmm_group;
function void build_ph();
end_voter = end_vote.register_channel(master_chan);
end_voter = end_vote.register_xactor(slave_xactor);
The code above shows how we can instantiate various voters that will participate in the test completion.
The figure below shows how a participant opposes test completion, while all other participants have given consent.
One of the simplest forms of usage is to oppose completion using the command above before a completing some given task like programming registers or pulling reset and then giving consent by using the command: this.consent(“Programming Completed”); There is often a need to force consensus to end a test if one of the opposing blocks is not releasing. This can be achieved by using the forced command.
You can choose to use the consensus_force_thru command to pass to propagate the force up.
Using these techniques to end your test will make your testbench scalable and reusable over various projects.