Functional coverage is a methodology used in SystemVerilog to measure the completeness of the verification process by tracking how much of the design functionality has been exercised during simulation. Functional coverage is used to ensure that all possible scenarios and use cases of a design have been tested, and to identify any areas of the design that have not been exercised during simulation.
Functional coverage is implemented using coverage groups, which are used to group related coverage points together. A coverage point is a specific aspect of the design functionality that needs to be tested, such as the values of specific signals or the execution of specific code paths.
Functional coverage is typically used in conjunction with a coverage model, which is used to specify the coverage points that need to be tracked during simulation. The coverage model is specified using the “covergroup” statement in SystemVerilog, which is used to define the coverage points and the bins that track the coverage.
Here is an example of a coverage group:
covergroup my_coverage; option.per_instance = 1; coverpoint signal_a { bins bin1 = {0,1,2,3}; bins bin2 = {4,5,6,7}; } coverpoint signal_b { bins bin3 = {[0:7]}; } endgroup
In this example, the coverage group “my_coverage” includes two coverpoints, “signal_a” and “signal_b”. The “signal_a” coverpoint has two bins, “bin1” and “bin2”, which track the values of the signal within the specified ranges. The “signal_b” coverpoint has a single bin, “bin3”, which tracks the values of the signal across the entire range.
During simulation, the values of the coverage points are tracked and recorded in a coverage database. The coverage database can then be analyzed to determine the completeness of the verification process and to identify any areas of the design that have not been exercised during simulation.
Functional coverage helps with verification by providing a systematic way to measure the completeness of the verification process and to ensure that all aspects of the design functionality have been tested. By using functional coverage, designers can identify any areas of the design that need additional testing and can ensure that the design meets the required specifications and functionality.