Part 5 · Functional Coverage · Intermediate

Covergroups & Coverpoints

Hub — covergroup anatomy, sampling strategies, coverpoint expressions, embedded vs standalone covergroups, your first coverage model, and code vs functional coverage.

Overview

A covergroup is a user-defined type that bundles a set of measurement points (coverpoints), a sampling trigger, and configuration options. Each coverpoint watches a variable or expression, and every time the covergroup samples, the current value is sorted into a bin. Bin hit counts are the raw material of functional coverage — they prove which scenarios from your verification plan actually occurred in simulation.

This topic builds the foundation: what a covergroup is made of, how and when it samples, what a coverpoint can legally watch, where the covergroup should live, and how to grow a real coverage model from a spec. It closes with the code-vs-functional-coverage distinction every interviewer asks about.

Sub-topics

  1. Covergroup Anatomy — structure, declaration contexts, the new() requirement, naming.

  2. Sampling: Clocked, Event & sample() — clocking events vs explicit calls, sample() with arguments, iff guards.

  3. Coverpoint Expressions & Types — expressions, enums, condition idioms, auto bin counts.

  4. Embedded vs Standalone Covergroups — class-embedded instances vs module-level, wrapper-class reuse.

  5. Building Your First Coverage Model — ALU spec to coverage report, end to end.

  6. Code Coverage vs Functional Coverage — what each proves, why both are required for sign-off.

diagram
COVERGROUP BASICS — topic map

  ┌──────────────────────────────────────────────────────┐
  │ 1. ANATOMY        covergroup  coverpoint  bins      │
  │                   declaration │ new() │ naming        │
  ├──────────────────────────────────────────────────────┤
  │ 2. SAMPLING       @(posedge clk) │ .sample() │        │
  │                   with function sample(...) │ iff     │
  ├──────────────────────────────────────────────────────┤
  │ 3. EXPRESSIONS    signals │ expressions │ enums │     │
  │                   booleans │ auto_bin_max             │
  ├──────────────────────────────────────────────────────┤
  │ 4. PLACEMENT      in class (per object) vs in module  │
  │                   wrapper class for reuse             │
  ├──────────────────────────────────────────────────────┤
  │ 5. FIRST MODEL    spec  plan  covergroup  report   │
  ├──────────────────────────────────────────────────────┤
  │ 6. CODE vs FUNC   structure vs scenario │ sign-off    │
  └──────────────────────────────────────────────────────┘

Key takeaways

  • A covergroup is a type: declare it, then construct it with new() — no new(), no coverage, no error.

  • Coverpoints watch values or expressions; bins turn sampled values into countable scenarios.

  • Where the covergroup lives (class vs module) decides whether coverage is per-object or global.

  • Functional coverage is hand-written from the spec; code coverage is tool-extracted from the RTL.