SystemVerilog functional coverage bins and crosses
Create meaningful coverpoints, bins, illegal and ignore bins, and cross coverage without inflating the coverage model.
Coverpoints and bins
Functional coverage measures whether meaningful scenarios from the verification plan occurred. A coverpoint samples an expression; bins group values into reviewable goals.
covergroup bus_cg @(posedge clk);
cp_kind: coverpoint kind {
bins read = {0};
bins write = {1};
illegal_bins reserved = {[2:3]};
}
endgroup
Use illegal_bins only for values that must never occur. An illegal-bin hit is a coverage-model diagnostic, not a replacement for an assertion. Use ignore_bins for legal values intentionally excluded from the current coverage goal.
Cross coverage
A cross measures combinations of coverpoints.
cp_kind: coverpoint kind;
cp_size: coverpoint size {
bins small = {[1:4]};
bins large = {[5:16]};
}
kind_x_size: cross cp_kind, cp_size;
Do not cross every field automatically. Large crosses create many bins, slow analysis and make closure meaningless. Cross only combinations tied to a requirement or known risk, and use ignore_bins to remove impossible or irrelevant combinations.
Sampling discipline
Sample at the point where a transaction is accepted or completed, not merely whenever signals toggle. A class-based environment often calls sample() after the monitor constructs a valid transaction. Avoid sampling reset or partially assembled data unless the coverage plan explicitly requires it.
Coverage closure means explaining every uncovered goal: add stimulus for reachable missing scenarios, waive unreachable bins with evidence, and correct a faulty model. A high percentage alone does not prove correctness; combine functional coverage with checking, assertions, code coverage and review.