Cover the orders of responses that a retry mechanism must handle, with chains, sets, a range and a default sequence.
Hardware context: A link that answers every transfer with OK, RETRY, ERR or TIMEOUT and retries failures. Cover the orders of responses that the retry logic must handle.
A link answers every transfer with OK, RETRY, ERR or TIMEOUT, and the covergroup samples once per transfer. Every response code is common. The retry logic only matters in some orders.
Write the covergroup resp_cov with the transition bins of the plan.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
samples | 8 | input of each check |
Full specification
typedef enum bit [1:0] {OK, RETRY, ERR, TIMEOUT} resp_e; // given
covergroup resp_cov with function sample(resp_e r); // you write
| Bin | Plan |
|---|---|
| recover | RETRY, then OK |
| two_tries | RETRY, RETRY, then OK |
| gave_up | RETRY, then any failure code in the range ERR to TIMEOUT |
| fail_ok | ERR or TIMEOUT, then OK |
| others | every other transition, shown in reports but not counted |
Each case samples a fresh instance with a list of responses and reads get_inst_coverage() times 100, rounded. The full check samples more lists than the examples show.
Examples
Example 1
One Retry- Input
responses: OK RETRY OK
- Output
coverage_percent_x100 = 2500
RETRY then OK covers recover: 1 of 4 bins.
Example 2
Two Retries and a Recovery- Input
responses: RETRY RETRY OK ERR OK
- Output
coverage_percent_x100 = 7500
The last of RETRY, RETRY, OK completes two_tries and recover together; ERR then OK covers fail_ok: 3 of 4.
Example 3
Retries That Failed- Input
responses: RETRY ERR RETRY ERR
- Output
coverage_percent_x100 = 2500
RETRY then ERR covers gave_up. ERR then RETRY is in no counted bin: 1 of 4.
Constraints and Contract
- Keep the covergroup name, the sample argument, the coverpoint
cpand the bin names; each bin is one bin, not an array. - The coverage build rejects a range inside a transition (lesson C15): write the range as a list of values.
Hints
Hint 1
a => b means a at one sample and b at the next.
Hint 2
A step may list several values: (x => y, z).
Hint 3
Which kind of bin collects transitions without counting them?
What the grader checks: Your covergroup is sampled with 18 lists of responses. Its instance coverage is compared with the value IEEE 1800-2023 19.5.2 and 19.11.1 give. Three lists are shown.
18 checks on Verilator coverage build · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 1 steps and the final capstone