Say what six programs print when they use the reporting options: overlaps, missing-cross listings, per-instance numbers, names and comments.
Hardware context: Covergroups with names, comments, overlap checks and merged instances. Say which reporting options change a number and which only change the report.
Each row of the table is a small program with a covergroup instance c. The last column gives the value it prints. Write answer(q) so it returns what IEEE 1800-2023 says the program prints.
Questions 0 to 2 are worked examples; 3 to 8 are graded only by the full check.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| q | Declarations | Statements | Printed value | Kind |
|---|---|---|---|---|
| 0 | bit v; covergroup cg; option.weight = 3; coverpoint v; endgroup cg c = new; | v = 0; | c.option.weight | worked example |
| 1 | bit v; covergroup cg; coverpoint v; endgroup cg c = new; | c.option.name = "lane2"; | c.option.name.len() | worked example |
| 2 | bit [1:0] v; covergroup cg; coverpoint v { bins one = {1}; bins two = {2}; } endgroup cg c = new; | v = 1; c.sample(); | int'($rtoi(c.get_inst_coverage() * 100.0 + 0.5)) | worked example |
| 3 | bit [3:0] v; covergroup cg; coverpoint v { option.detect_overlap = 1; bins lo = {[0:5]}; bins mid = {[4:9]}; bins hi = {[8:15]}; } endgroup cg c = new; | v = 8; c.sample(); | int'($rtoi(c.get_inst_coverage() * 100.0 + 0.5)) | graded |
| 4 | bit [1:0] a; bit b; covergroup cg; ca: coverpoint a; cb: coverpoint b; x: cross ca, cb { option.cross_num_print_missing = 3; } endgroup cg c = new; | a = 1; b = 0; c.sample(); | int'($rtoi(c.get_inst_coverage() * 100.0 + 0.5)) | graded |
| 5 | covergroup cg with function sample(bit [1:0] a); type_option.merge_instances = 1; option.get_inst_coverage = 1; coverpoint a { bins one = {1}; bins two = {2}; bins three = {3}; } endgroup cg c = new, y = new; | c.sample(1); c.sample(2); y.sample(3); | int'($rtoi(c.get_inst_coverage() * 100.0 + 0.5)) | graded |
| 6 | covergroup cg with function sample(bit [1:0] a); type_option.merge_instances = 1; coverpoint a { bins zero = {0}; bins one = {1}; bins two = {2}; bins three = {3}; } endgroup cg c = new, y = new; | c.sample(1); y.sample(2); | int'($rtoi(c.get_inst_coverage() * 100.0 + 0.5)) | graded |
| 7 | bit v; covergroup cg (string nm); option.name = nm; coverpoint v; endgroup cg c = new("lane07"); | v = 0; | c.option.name.len() | graded |
| 8 | bit v; covergroup cg; option.comment = "retry path"; coverpoint v; endgroup cg c = new; | v = 0; | c.option.comment.len() | graded |
Questions 7 and 8 set a name and a comment in the covergroup definition. The coverage build reads both back empty (lesson C24), so their keys are the standard's.
Examples
Example 1
An Option Read Back- Input
answer(0)
- Output
answer = 3
An option is a member of c.option and can be read: 3.
Example 2
A Name Set After Construction- Input
answer(1)
- Output
answer = 5
"lane2" has five characters: 5.
Example 3
A Coverage Number- Input
answer(2)
- Output
answer = 5000
One of two bins: 50.00%, so 5000.
Constraints and Contract
- Return one value per question from answer(q).
- Keep the function header.
Hints
Hint 1
Which of these options can change a coverage number at all?
Hint 2
With merge_instances, what does get_inst_coverage() return when option.get_inst_coverage is 0?
Hint 3
An option set in the definition is the instance's value.
What the grader checks: Nine constant answers. Questions 3 to 6 were measured on the coverage build, which agrees with the standard. Questions 7 and 8 are standard keys: the build reads both strings back empty (scenarios cov-076 and cov-077 in docs/sva-standard-traces/CG.md).
9 checks on Icarus · browser samples / server checks. 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