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 | It builds |
|---|---|
Group, point and bins; class and module homes; the forgotten | |
Clocked versus explicit sampling, sample arguments and | |
Expressions, enums, boolean idioms and the auto-bin cap. | |
An ALU plan turned into a wrapper class, a report, holes and sign-off. |
Whether the covergroup was ever constructed. A declared but never constructed covergroup never samples, and most flows report that silence as zero coverage.