Cover a response with wildcard bins on its error class, filtered bins for even lengths, and automatic bins capped to tag groups.
Hardware context: A response with an error class, a length and a tag. Cover bit patterns, filtered values and capped automatic bins in one covergroup.
A response carries an 8-bit status, a length and a tag. The top two status bits give the error class; the other six bits are detail the plan does not care about.
The plan asks three questions. Did a fatal (class 3) and a warning (class 2) response occur? Did every even length occur? Did each group of four tags appear?
Write the covergroup resp_cov.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
samples | 8 | input of each check |
Full specification
covergroup resp_cov with function sample(bit [7:0] status, bit [3:0] len, bit [3:0] tag);
| Coverpoint | Bins |
|---|---|
| err (status) | fatal: class 3, any detail; warn: class 2, any detail (wildcard bins) |
| even (len) | one bin per even length, 0 to 14, by a with filter |
| tags (tag) | automatic bins, at most 4 |
Each case samples a fresh instance and reads get_inst_coverage() times 100, rounded. The full check samples more lists than the examples show.
Examples
Example 1
One Fatal Response- Input
responses (status, len, tag): (11000001, 2, 0)
- Output
coverage_percent_x100 = 2917
fatal (1 of 2), e[2] (1 of 8) and the tag group 0-3 (1 of 4): (50 + 12.5 + 25) / 3 = 29.17%.
Example 2
A Warning and a Fatal- Input
responses (status, len, tag): (10000000, 4, 5) (11111111, 6, 15)
- Output
coverage_percent_x100 = 5833
Both error bins, e[4] and e[6] (2 of 8), and tag groups 4-7 and 12-15 (2 of 4): 58.33%.
Example 3
Nothing the Plan Names- Input
responses (status, len, tag): (00000000, 3, 8) (01000000, 15, 9)
- Output
coverage_percent_x100 = 833
Status 00 and 40 are classes 0 and 1, and the lengths are odd. Tags 8 and 9 share one group: 1 of 4, 8.33% overall.
Constraints and Contract
- Keep the covergroup name, the sample arguments and the coverpoint and bin names.
- Use wildcard bins for err, a with filter for even, and auto_bin_max for tags.
Hints
Hint 1
? marks a bit as "either value" only in a wildcard bin.
Hint 2
item is each candidate value in a with filter.
Hint 3
Sixteen tags in four automatic bins: which tags share a bin?
What the grader checks: Your covergroup is sampled with 18 lists of responses. Its instance coverage is compared with the value IEEE 1800-2023 clause 19 gives for the specified bins. 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 2 steps and the final capstone