SystemVerilog Functional Coverage in a Nutshell

Use native SystemVerilog constructs as metrics for verification closure in Riviera-PRO

Henry Chan, Applications Engineer
Like(1)  Comments  (0)

Let’s say you have a block you need to verify. How do you know that the stimulus you are about to use is exhaustive enough and that you have covered the necessary scenarios/situations to prove it is working correctly? This is where functional coverage comes in. SystemVerilog’s functional coverage constructs allow you to quantify the completeness of your stimulus by recording the values that have occurred on your signals.


Consider an 8-bit address signal, paddr, and a 32-bit data signal, pwdata. Assigning a coverpoint to each signal will direct your simulator to track these signals during simulation and record the number of hits. For each coverpoint, bins can be created to organize the possible signal values into meaningful categories. Finally, a covergroup is used to encapsulate it all and is instantiated using the new() constructor. Associating the covergroup with a clock event is also a good way to trigger the coverage sampling.

Example Functional Coverage Syntax, functional coverage in uvm

Figure 1: Example Functional Coverage Syntax


Each covergroup contains options for configuration which allows customization. The example shown in Figure 1 uses options which determine the number of bins that are created for the pwdata signal and whether the covergroup is static across all instances or if there should be a separate covergroup for each instance in which the new() constructor is called. Other options allow you to change the weighting structure for your covergroups and specify the target coverage goal percentage and required number of hits for each bin; plus other options.


Cross coverage is also utilized here which is useful for answering the question: For each paddr bin, is there a sufficient variety of pwdata signals? As seen in the coverage report in Figure 2, the test produced a few hundred different data values for each paddr bin across pwdata’s entire 32-bit range. This should provide enough confidence that the stimulus was reasonably diverse. This can also help you decide if you should be constraining your stimulus more narrowly to achieve more substantial verification results.


After Riviera-PRO has finished running a simulation, a neatly organized HTML report with colored highlights can be generated to review the functional coverage. The report contains information on each covergroup, coverpoint, and the bins. Relevant coverage information such as the amount of hits, coverage percentage (goal), and coverage status are all displayed as a hierarchical tree. This report can become a convenient document shared with the verification team to measure verification progress.


Riviera-PRO Functional Coverage HTML Report, functional coverage in uvm

Figure 2: Riviera-PRO Functional Coverage HTML Report


For an in-depth look into Riviera-PRO’s functional coverage features, you can view Riviera-PRO’s reference pages here:

As an Aldec Applications Engineer, Henry has intimate knowledge of the inner workings behind the latest verification tools, languages, and methodologies. He has a wide breadth of experience across various areas including simulation, emulation, and embedded systems. Henry received his B.S. in Computer Engineering from the University of Nevada, Las Vegas.


Ask Us a Question
Ask Us a Question
Captcha ImageReload Captcha
Incorrect data entered.
Thank you! Your question has been submitted. Please allow 1-3 business days for someone to respond to your question.
Internal error occurred. Your question was not submitted. Please contact us using Feedback form.
We use cookies to ensure we give you the best user experience and to provide you with content we believe will be of relevance to you. If you continue to use our site, you consent to our use of cookies. A detailed overview on the use of cookies and other website information is located in our Privacy Policy.