VMM provides the vmm_consensus class as a voting mechanism, which is used to determine when the test could be terminated. Earlier before the introduction of vmm_consensus class end of test condition was determined by some condition like score board empty condition or a timeout. The test end condition was tied to a specific environment and was not reusable across environments.
With the introduction of vmm_consensus class various elements such as channels, notification, and transactors play the role of voter and all voters have to agree for a consensus. Even if one voter opposes there will be no consensus. The vmm_consensus has a wait_for_consensus ( ) method which will be called in vmm_env’s wait_for_end ( ) method. The wait_for_consensus ( ) method will block till all voters consent.
How to use vmm_consensus to determine when the test should end ?
1) Add vmm_consensus::wait_for_consensus ( ) method to vmm_env::wait_for_end () method
2) Register voters in the vmm_env::build ( ) using end_vote.register_* () method, where end_vote is the instance of vmm_consensus defined in vmm.sv
3) Each of the sub environment instance has a single vote, it can consent or oppose.
4) We have options such as consensus_force_thru() which can be used by a particular subenv or a VMM components to force consensus through even though other components oppose the decision.
5) As usual we have methods that can be used to monitor the status of consensus, which components oppose and which components consent.