Read six small covergroups and give the number each reports, including those stuck at 0% for a hidden reason.
Hardware context: Six small covergroups whose numbers stay low for different reasons. Predict the number each covergroup reports, including bins that never count.
Each row of the table is a small program: some declarations, a covergroup instance c, and the samples it receives. Each program ends by printing c.get_inst_coverage() times 100, rounded.
Write answer(q) so it returns that number for each program. Questions 0 to 2 are worked examples. Questions 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 | Samples | Kind |
|---|---|---|---|
| 0 | bit [3:0] v; covergroup cg; coverpoint v { bins a = {1}; bins b = {2}; } endgroup cg c = new; | v = 1; c.sample(); | worked example |
| 1 | bit [3:0] v; covergroup cg; coverpoint v { bins a = {1}; ignore_bins ig = {7}; } endgroup cg c = new; | v = 1; c.sample(); v = 7; c.sample(); | worked example |
| 2 | bit [1:0] v; covergroup cg; coverpoint v; endgroup cg c = new; | v = 0; c.sample(); | worked example |
| 3 | bit [3:0] v; covergroup cg; coverpoint v { bins one = {1}; bins two = {2}; bins three = {3}; bins rest = default; } endgroup cg c = new; | v = 1; c.sample(); v = 9; c.sample(); | graded |
| 4 | bit [2:0] v; covergroup cg; coverpoint v { bins lo = {[0:3]}; bins mid = {[4:7]}; bins hi = {[8:15]}; } endgroup cg c = new; | v = 5; c.sample(); | graded |
| 5 | bit clk; bit [1:0] v; covergroup cg @(posedge clk); coverpoint v; endgroup cg c = new; | v = 1; #10; | graded |
| 6 | bit [9:0] v; covergroup cg; coverpoint v; endgroup cg c = new; | v = 0; c.sample(); v = 16; c.sample(); v = 40; c.sample(); | graded |
| 7 | bit [3:0] v; covergroup cg; coverpoint v { option.auto_bin_max = 3; } endgroup cg c = new; | v = 4; c.sample(); v = 10; c.sample(); | graded |
| 8 | bit [3:0] v; covergroup cg; coverpoint v { bins mid = {4'b01zz}; bins one = {1}; } endgroup cg c = new; | v = 5; c.sample(); v = 1; c.sample(); | graded |
Every program is complete as written: module tb; around the declarations and an initial block with the samples. 50.00% is 5000; 0.78125% rounds to 78.
Examples
Example 1
Two Bins, One Hit- Input
answer(0)
- Output
answer = 5000
Two counted bins and one is hit: 50.00%, so answer(0) returns 5000.
Example 2
An Ignored Value Adds Nothing- Input
answer(1)
- Output
answer = 10000
Only a counts, and it is hit. The 7 is ignored: 100.00%. Lesson C14 covers ignore_bins.
Example 3
Four Automatic Bins- Input
answer(2)
- Output
answer = 2500
A 2-bit coverpoint with no bins gets four automatic bins. One is hit: 25.00%.
Constraints and Contract
- Return one value per question from answer(q).
- Keep the function header.
Hints
Hint 1
Which bins count toward the total, and which never do?
Hint 2
How many automatic bins does a coverpoint get, and how many values share each?
Hint 3
A bin value with z in it, and no wildcard, cannot be represented in a two-state compare (19.5.7).
What the grader checks: Nine constant answers: three worked examples and six graded questions. The keys follow IEEE 1800-2023 clause 19. Each was measured on the coverage build, which agrees on all six (tools/probes/cov-w1/measure-keys.mjs).
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 2 steps and the final capstone