Transition Forms

Write transition bins for chains, sets, ranges and a default sequence, and know exactly when a transition bin counts.

You Will Be Able To

  • Write a transition bin for a chain of values, a => b => c.
  • Expand a transition with sets or ranges into the sequences it stands for.
  • Catch every other transition with default sequence, and say why it never counts.
  • Predict how often a transition bin counts when matches overlap.
Lesson
C15
Time
30 min
Runs on
Coverage build
Check
4 questions

A link retried failed transfers, and every response code had been covered thousands of times. The bug only fired when a transfer needed two retries in a row and then succeeded. Nobody had asked about the order of responses, and the stimulus never produced RETRY, RETRY, OK.

Each value common, one order never seen
012345respOKRETRYOKRETRYERROKRETRY => OK-match-RETRY => RETRY => OK-one retry worked
Scroll horizontally ↔

One column per sampled response. A value coverpoint reads 100% here; the two-retry chain never appears.

A Chain of Values

A transition bin names values at consecutive samples. (RETRY => OK) matches a RETRY followed, at the next sample, by OK. (RETRY => RETRY => OK) needs three samples in a row (IEEE 1800-2023 19.5.2).

The Chain 1 => 2 => 3 on the Samples 1, 2, 1, 2, 3
01234sample12123chain startedyes-chain complete-yes
Scroll horizontally ↔
  1. Cycle 2

    The first try fails: after 1, 2 the next sample is 1, not 3. A new attempt starts at this 1.

  2. Cycle 4

    The second try completes: 1, 2, 3 at the last three samples. The bin counts once.

Every sample can start an attempt. Only the last three samples complete the chain.

Consecutive means consecutive samples of that covergroup instance. Sample once per cycle if the chain is about cycles, and once per transfer if it is about transfers.

Sets of Values in a Step

A step can list several values. (RETRY => ERR, TIMEOUT) stands for two sequences, RETRY then ERR and RETRY then TIMEOUT. (0, 1 => 2, 3) stands for four: every value on the left with every value on the right.

BinSequences it stands for
(0, 1 => 2, 3)0=>2, 0=>3, 1=>2, 1=>3
(4 => 5 => 6), (7 => 8)two chains in one bin
(RETRY => ERR, TIMEOUT)RETRY=>ERR, RETRY=>TIMEOUT

A single bin (no brackets after the name) is covered by any one of its sequences.

One Bin, Four SequencesThe bin t = (0, 1 => 2, 3). Arrows show each first value paired with each second value; any of the four pairs covers the one bin.
  • Neutral
  • Data
CallValueReturnWaiting
One bin, four sequencesThe bin `t = (0, 1 => 2, 3)`. Arrows show each first value paired with each second value; any of the four pairs covers the one bin. neutral 0 first step neutral 1 first step neutral 2 second step neutral 3 second step neutral bins t one bin
  1. neutral 0first step
    • 2
    • 3
  2. neutral 1first step
    • 2
    • 3
  3. neutral 2second step
    • bins t
  4. neutral 3second step
    • bins t
  5. neutral bins tone bin
  1. Every pair

    Each value of the first step pairs with each value of the second: 0=>2, 0=>3, 1=>2 and 1=>3.

  2. Any pair covers the bin

    The samples 1 then 3 complete 1=>3, so t is covered.

    Follow the calls, values and waits
    1. data 1 then 3: 1 → 3
Read the diagram as text
  • 0: first step
  • 1: first step
  • 2: second step
  • 3: second step
  • bins t: one bin
  • 0 → 2
  • 0 → 3
  • 1 → 2
  • 1 → 3
  • 2 → bins t
  • 3 → bins t

A set in a step multiplies the sequences; without brackets they all feed one bin.

With brackets, bins t[] = (0, 1 => 2, 3);, the standard makes one bin per sequence. Lesson C16 covers that array form, which the coverage build counts as one bin.

Ranges in a Step

A step can also hold a range: ([1:2] => 3) means 1 or 2, then 3 (19.5.2). It is the same as writing the values out.

BinStandard (19.5.2)Coverage build (measured)
bins t = ([1:2] => 3); on samples 2, 3covered: 100.00%compile error: "Unsupported: covergroup value range"
bins t = (1 => [2:3]); on samples 1, 3covered: 100.00%compile error

Standard behaviour, not run on this build. Scenario cov-030 in docs/sva-standard-traces/CD.md.

Default Sequence Catches the Rest

bins others = default sequence; counts transitions that no other transition bin matches. Like a value default, it is left out of the coverage number, and it cannot be an array (19.5, 19.5.2).

Standard Behaviour: When a Default Sequence Bin CountsBins up = (1 => 2 => 3), mid = (4, 5 => 6), go = (7 => 0[->1]) and others = default sequence, with the samples in the first row.
012345678sample12465730pending binupmid-midgo-bin counted-mid-godefault counts-yes-yes-
Scroll horizontally ↔
  1. Cycle 2

    up waited for a 3 after 1, 2; the 4 breaks it. No bin counts and no older attempt is still pending, so the default sequence counts. The 4 starts mid.

  2. Cycle 3

    4 then 6 completes mid. A bin counted, so the default does not.

  3. Cycle 5

    6 then 5 and 5 then 7 match nothing, and nothing older is pending: the default counts twice. The 7 starts go.

  4. Cycle 8

    go stays pending through the 3s, so the default waits. The 0 completes go.

Derived from the rules of IEEE 1800-2023 19.5.2: the default sequence counts three times. A per-bin count cannot be read on the coverage build; it agrees that the default bin adds nothing to the number.

How a Transition Bin Counts

Four rules decide the count (19.5.2, 19.11.1).

  1. Every complete match counts

    Overlapping matches each count: on 1, 1, 1 the bin (1 => 1) counts twice.

  2. At most once per sample

    If two of a bin's sequences complete on the same sample, the bin still counts once.

  3. No zero-length transitions

    (1) is not a transition: it is illegal. Use a value bin.

  4. One number with the value bins

    A coverpoint's transition bins and value bins share its denominator.

ProgramStandard (19.5.2)Coverage build (measured)
option.at_least = 2; bins t = (1 => 1); on 1, 1, 12 hits: 100.00%100.00%
option.at_least = 2; bins t = (0 => 1), (0, 1 => 1); on 0, 11 hit: 0.00%100.00%: both sequences counted
bins t = (1);illegalcompile error

The second row is a departure: the build counts a bin twice when two of its sequences end on one sample. Scenario cov-032 in docs/sva-standard-traces/CD.md.

Try It

RETRY, RETRY, OK completes two bins on one sample: two_tries, and recover from its last two values. RETRY, TIMEOUT then completes gave_up through its set.

Three bins count; others collects the rest without moving the number. Predict the output if the last response were ERR.

RUNVerilator (coverage build) · simulator service
Edit the code, then run it
Expected: OK: 0.00% RETRY: 0.00% RETRY: 0.00% OK: 66.67% RETRY: 66.67% TIMEOUT: 100.00%

Check Yourself

Predict the outputPredict the exact output.
module tb;
  bit [1:0] v;
  covergroup cg;
    coverpoint v { bins up2 = (0 => 1 => 2); bins wrap = (3 => 0); }
  endgroup
  cg c = new;
  initial begin
    v = 3; c.sample(); v = 0; c.sample(); v = 1; c.sample(); v = 1; c.sample(); v = 2; c.sample();
    $display("%0.2f%%", c.get_inst_coverage());
  end
endmodule
ConceptHow many sequences does (1, 5 => 6, 7) stand for?
ConceptA covergroup samples a handshake state only on transfers. Why can (WAIT => XFER) never be covered?
ConceptWhat does bins others = default sequence; add to the coverage number?

Common Mistakes

Wrong Sample a covergroup only on transfers and write transitions about per-cycle states.

Consecutive samples are consecutive transfers, so the cycle states between them never appear.

Fix Sample every cycle when a transition is about cycles.

Wrong Write ([1:2] => 3) on the coverage build.

The build rejects a range inside a transition, although the standard allows it.

Fix List the values: (1, 2 => 3).

Before
bins t = ([1:2] => 3);
After
bins t = (1, 2 => 3);

Wrong Expect default sequence to show progress in the number.

It is never counted.

Fix Name the transitions the plan cares about as bins of their own.

Remember

  • a => b => c matches values at consecutive samples of one instance.
  • Sets and ranges in a step expand into every combination of sequences; one bin is covered by any of them.
  • default sequence collects other transitions and never counts.
  • Every complete match counts, overlaps included, but a bin counts at most once per sample.
  • The coverage build rejects ranges in transitions and can count one sample twice; list values and avoid sequences that end together.

Practice

Report a problem with this page