module cov;
typedef enum {UDP= 0, ICMP =2, NONE =3} inner_l4_protocol_t;
inner_l4_protocol_t inner_l4_protocol;
int pkt_is_cloud;
int cloud_type;
int ipe;
int ipcs;
event some_event;
covergroup temp_something @(some_event);
option.per_instance = 1; // may not be required
//**************************** 1st part ***************************//
//cp_1
inner_l4_protocol_cp : coverpoint inner_l4_protocol {
bins dont_care = {NONE, ICMP, UDP};
}
//cp_2
cloud_pkt_cp : coverpoint pkt_is_cloud {
bins dont_care = {1};
}
//cp_3
cloud_type_cp : coverpoint cloud_type {
bins dont_care = {1};
}
cloud_over_l4_protocol_encapsulated : cross inner_l4_protocol, pkt_is_cloud, cloud_type;
//**************************** 2nd part ***************************//
//cp_1_1
ipe_cp : coverpoint ipe {
bins dont_care = {1};
}
//cp_1_2
ipcs_cp : coverpoint ipcs {
bins dont_care = {1};
}
//cloud_with_checksum_options_status_fields : cross ipe, ipcs, inner_l4_protocol {
cloud_with_checksum_options_status_fields : cross ipe, ipcs, cloud_over_l4_protocol_encapsulated { // will not inherit the bins of inner_l4_protocol through cloud_over_l4_protocol_encapsulated cross??
ignore_bins grabage_stuff = (
(binsof(ipcs) intersect {0} && binsof(ipe) intersect {1}) ||
//(binsof(inner_l4_protocol) intersect {UDP} && binsof(inner_l4_protocol) intersect {!NONE})
(binsof(cloud_over_l4_protocol_encapsulated.inner_l4_protocol.dont_care) intersect {UDP} && binsof(cloud_over_l4_protocol_encapsulated.inner_l4_protocol.dont_care) intersect {!NONE})
//return errors why? Accessing specific bins inside a cross is not supported directly in SystemVerilog or tool? checking further
);
}
endgroup
// Instantiate the covergroup
initial begin
end
endmodule
A covergroup cross
can be between signals (nets or variables) and other coverpoints. A cross cannot contain other crosses.
When including a signal in the cross, an implicit coverpoint gets created with automatically generated bins. That implicit coverpoint gets used even if there is another coverpoint with the same signal as its expression.