Coverage

What is the difference between option and type_option in coverage options in system verilog.And when we should use option and type_option.

Hi,

As stated in the LRM, option shall be used with coverage instances while type_option shall be used once per coverage type.

For example:

covergroup coverage_type_name;
    option.weight = 10;
    type_option.comment = "This is a covergroup comment";
endgroup

If you want to set the weight of a certain coverage instance to 5 relative to this coverage_type you must use:

coverage_type_name coverage_instance_name = new();
coverage_instance_name.option.weight = 5;

If you want to set the weight of this coverage_type relative to total coverage then you must use:

coverage_type_name.type_option.weight = 5;

Also type_option’s shall take only constant expressions, while option’s can take also variables.

Best regards,
Aurelian.