Functional coverage proves that planned scenarios happened. A covergroup bundles the measurement points, samples the design at chosen moments, and sorts each sample into bins.
// snippet
covergroup cg_alu @(posedge clk); // the container, with its sampling event
option.per_instance = 1; // options configure it
cp_op : coverpoint opcode { // a coverpoint watches one value
bins add = {OP_ADD}; // a bin is a named bucket
bins sub = {OP_SUB};
bins shifts[] = {OP_SHL, OP_SHR}; // a bin array: one bin per value
}
cp_zero : coverpoint (result == 0); // an expression coverpoint
x_op_zero : cross cp_op, cp_zero; // a cross counts combinations
endgroupLesson | Path | It builds |
|---|---|---|
Required | Group, point and bins; class and module homes; the forgotten | |
Required | Clocked versus explicit sampling, sample arguments and | |
Recommended | Expressions, enums, boolean idioms and the auto-bin cap. | |
Required | Three bins, five samples, a report that names the hole, and the first PacketFIFO step. | |
Recommended | A six-row plan turned into a covergroup, a wrapper class and a report with holes. | |
Recommended | Full line coverage beside a 0% corner, measured on one FIFO. | |
Recommended | The plain-class model every bench in this part counts with, and how it maps to covergroup syntax. |
Required is the core first pass. Recommended is for most learners. Optional is reference, a specialist topic or revision.
Whether the covergroup was ever constructed. A declared but never constructed covergroup never samples, and most flows report that silence as zero coverage.