Skip to main content...
S3 · Verification Engineering (SV + UVM)
30 min

Day 102: Functional coverage: covergroups, coverpoints, bins

Coverage answers 'did I actually test that?' Covergroups turn your test plan into a measurable, closable target.

Functional coverage: covergroups

Random stimulus is only useful if you *measure* what it exercised. Functional coverage does this: a covergroup samples signals/variables at defined events; coverpoints track which values occurred; bins group values into buckets of interest (each opcode, each FIFO occupancy level, each error type). The percentage of bins hit is your coverage — a direct, quantitative answer to 'did we test that scenario?'.

A covergroup with explicit bins
covergroup cg_uart @(posedge clk);
    cp_data: coverpoint txn.data {
        bins low     = {[0:63]};
        bins mid     = {[64:191]};
        bins high    = {[192:255]};
        bins corners = {0, 255};      // explicitly track the extremes
    }
    cp_err: coverpoint txn.parity_err { bins ok = {0}; bins err = {1}; }
endgroup

cg_uart cov = new();
// call cov.sample() (or rely on @event) as transactions occur

Coverage vs assertions

A crucial distinction interviewers probe: assertions check correctness (did something *wrong* happen?), while coverage measures completeness (did something *interesting* happen?). You need both — a design can pass every assertion simply because a scenario was never stimulated. Coverage tells you the assertions were actually exercised.

Key terms

Functional coverage
A measure of which interesting scenarios the stimulus actually exercised.
Covergroup
A sampling construct grouping coverpoints, triggered at a defined event.
Coverpoint
A variable/signal whose observed values are tracked for coverage.
Bin
A bucket of values a coverpoint counts; coverage = fraction of bins hit.

Before moving on, you should be able to

What is the key difference between an assertion and a functional coverage point?

We use cookies

We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies. Learn more

    Day 102: Functional coverage: covergroups, coverpoints, bins | RBTechIconX