Count the bins of seven crosses with user, ignored and illegal bins, a coverpoint exclusion and two 1800-2023 options.
Hardware context: Seven crosses with user, ignored and illegal bins. Count the bins each cross puts in its coverage number.
Each row of the table is a cross. Unless the row says otherwise, a and b are 2-bit variables, coverpoints ca and cb have automatic bins, and the cross is x: cross ca, cb.
Write answer(q) so it returns the number of bins the cross counts in its coverage, as IEEE 1800-2023 19.11.2 defines it. Questions 0 to 2 are worked examples; 3 to 10 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 a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb; endgroup cg c = new; | a = 0; b = 0; c.sample(); | worked example |
| 1 | bit [1:0] a; bit b; covergroup cg; ca: coverpoint a { option.weight = 0; bins v[] = {[0:2]}; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { ignore_bins z = binsof(ca) intersect {0}; } endgroup cg c = new; | a = 1; b = 0; c.sample(); | worked example |
| 2 | bit a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { bins a1 = binsof(ca) intersect {1}; } endgroup cg c = new; | a = 0; b = 0; c.sample(); | worked example |
| 3 | bit [1:0] a; bit [2:0] b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { ignore_bins lo_b = binsof(cb) intersect {[0:3]}; } endgroup cg c = new; | a = 0; b = 5; c.sample(); | graded |
| 4 | bit [1:0] a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { bins mid_a = binsof(ca) intersect {1, 2}; ignore_bins b3 = binsof(cb) intersect {3}; }; endgroup cg c = new; | a = 0; b = 0; c.sample(); | graded |
| 5 | bit [1:0] a; bit [2:0] b; covergroup cg; ca: coverpoint a { option.weight = 0; ignore_bins ig = {0}; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb; endgroup cg c = new; | a = 1; b = 0; c.sample(); | graded |
| 6 | bit [1:0] a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { bins a0 = binsof(ca) intersect {0}; bins b_hi = binsof(cb) intersect {[2:3]}; }; endgroup cg c = new; | a = 1; b = 0; c.sample(); | graded |
| 7 | bit [1:0] a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { illegal_bins bad = binsof(ca) intersect {0} && binsof(cb) intersect {[2:3]}; }; endgroup cg c = new; | a = 1; b = 1; c.sample(); | graded |
| 8 | bit [1:0] a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { option.cross_retain_auto_bins = 0; bins a0 = binsof(ca) intersect {0}; bins a1 = binsof(ca) intersect {1}; bins a2 = binsof(ca) intersect {2}; } endgroup cg c = new; | a = 0; b = 0; c.sample(); | graded |
| 9 | bit [1:0] a, b; covergroup cg; ca: coverpoint a { option.weight = 0; bins lo = {[0:1]}; bins hi = {[2:3]}; } cb: coverpoint b { option.weight = 0; bins lo = {[0:1]}; bins hi = {[2:3]}; } x: cross ca, cb { bins m = x with (ca + cb >= 3) matches 2; } endgroup cg c = new; | a = 2; b = 2; c.sample(); | graded |
| 10 | bit [1:0] a; covergroup cg; lo: coverpoint a { option.weight = 0; bins l = {[0:1]}; bins h = {[2:3]}; } coverpoint a { option.weight = 0; } x: cross a, lo; endgroup cg c = new; | a = 0; c.sample(); | graded |
Question 8 uses an option added in IEEE 1800-2023; question 9 uses matches, which the coverage build rejects (lesson C17). Their keys come from the standard.
Examples
Example 1
Two by Two- Input
answer(0)
- Output
answer = 4
Two bins times two bins: 4 cross bins.
Example 2
An Ignored Row- Input
answer(1)
- Output
answer = 4
Six products, two ignored: 4 bins.
Example 3
A User Bin- Input
answer(2)
- Output
answer = 3
The user bin takes two products and counts as one bin; two automatic bins remain: 3.
Constraints and Contract
- Return one value per question from answer(q).
- Keep the function header.
Hints
Hint 1
Count the user bins that are not ignored or illegal, then the products no user, ignore or illegal bin selects.
Hint 2
An ignored product leaves a user bin, but it still counts as taken.
Hint 3
An excluded coverpoint value takes its whole row out of the cross.
What the grader checks: Eleven constant answers. Questions 3 to 7 and 10 were measured on the coverage build, which agrees with the standard. Questions 8 and 9 are standard keys. The build ignores cross_retain_auto_bins (it counts 7) and rejects matches; see scenarios cov-2023-retain and cov-matches in docs/sva-standard-traces/CE.md.
11 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