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.
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).
- Cycle 2
The first try fails: after 1, 2 the next sample is 1, not 3. A new attempt starts at this 1.
- 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.
| Bin | Sequences 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.
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
- Every pair
Each value of the first step pairs with each value of the second: 0=>2, 0=>3, 1=>2 and 1=>3.
- Any pair covers the bin
The samples 1 then 3 complete 1=>3, so
tis covered.Follow the calls, values and waits
- 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.
| Bin | Standard (19.5.2) | Coverage build (measured) |
|---|---|---|
bins t = ([1:2] => 3); on samples 2, 3 | covered: 100.00% | compile error: "Unsupported: covergroup value range" |
bins t = (1 => [2:3]); on samples 1, 3 | covered: 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).
up = (1 => 2 => 3), mid = (4, 5 => 6), go = (7 => 0[->1]) and others = default sequence, with the samples in the first row.- Cycle 2
upwaited 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 startsmid. - Cycle 3
4 then 6 completes
mid. A bin counted, so the default does not. - Cycle 5
6 then 5 and 5 then 7 match nothing, and nothing older is pending: the default counts twice. The 7 starts
go. - Cycle 8
gostays pending through the 3s, so the default waits. The 0 completesgo.
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).
Every complete match counts
Overlapping matches each count: on 1, 1, 1 the bin
(1 => 1)counts twice.At most once per sample
If two of a bin's sequences complete on the same sample, the bin still counts once.
No zero-length transitions
(1)is not a transition: it is illegal. Use a value bin.One number with the value bins
A coverpoint's transition bins and value bins share its denominator.
| Program | Standard (19.5.2) | Coverage build (measured) |
|---|---|---|
option.at_least = 2; bins t = (1 => 1); on 1, 1, 1 | 2 hits: 100.00% | 100.00% |
option.at_least = 2; bins t = (0 => 1), (0, 1 => 1); on 0, 1 | 1 hit: 0.00% | 100.00%: both sequences counted |
bins t = (1); | illegal | compile 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.
OK: 0.00% RETRY: 0.00% RETRY: 0.00% OK: 66.67% RETRY: 66.67% TIMEOUT: 100.00%Check Yourself
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).
bins t = ([1:2] => 3);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 => cmatches 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 sequencecollects 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.