Coverage Options

Fine-tune how your coverage is collected and reported. Use options to set goals, minimum hits, and control aggregation behavior.

Instance vs Type Options

It is crucial to understand the difference:

  • option: Applies to the specific instance of the covergroup.
  • type_option: Applies to the covergroup type (statically for all instances).

Key Options

Option Description Default
option.weight Importance of this coverpoint (0 to disable). 1
option.goal Target coverage percentage for this item. 100
option.at_least Minimum hits required to mark a bin as "Covered". 1
option.auto_bin_max Max number of automatically created bins. 64
option.per_instance If 1, coverage is reported separately for every new() instance. 0

Code Example

covergroup cg_config;
    // Track coverage per instance (e.g., separate for Master 1 vs Master 2)
    option.per_instance = 1;
    option.comment = "Tracks register configurations";

    cp_addr: coverpoint addr {
        // We need to see this address at least 5 times
        option.at_least = 5;
    }

    cp_error: coverpoint error_flag {
        // This is low priority, don't let it drag down overall score
        option.weight = 0; 
    }
endgroup

Common Interview Questions

Q: When would you use option.weight = 0?
Use weight = 0 when you want to collect data for analysis (e.g., "See what happened"), but you don't want the result to affect the overall coverage grade. It's often used for "informational" coverpoints.
Q: What is the difference between per_instance and cumulative coverage?
By default (cumulative), if you have 2 packet generators, and Gen1 sends packet A, and Gen2 sends packet B, the "Packet Type" covergroup will show A and B as covered. With per_instance=1, you will see a specific report for Gen1 (only A covered) and Gen2 (only B covered).