C26.1 Compute the Number

HardDebugIcarus · browser samples / server checksReview the topic

Compute eight coverage numbers by the formulas of IEEE 1800-2023 19.11, from coverpoints and crosses to weighted types.

Hardware context: Covergroups with exclusions, transitions, crosses and weighted instances. Compute each coverage number by the formulas of IEEE 1800-2023 19.11.

Each row of the table is a small program. It prints c.get_inst_coverage() times 100, rounded, unless the row says it prints the type number cg::get_coverage().

Write answer(q) so it returns the number IEEE 1800-2023 19.11 gives. Questions 0 to 2 are worked examples; 3 to 10 are graded only by the full check.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
qDeclarationsSamplesKind
0bit [2:0] v; covergroup cg; coverpoint v { bins a = {0}; bins b = {1}; bins c = {2}; bins d = {3}; } endgroup cg c = new;v = 0; c.sample(); v = 3; c.sample();worked example
1bit [1:0] v; covergroup cg; coverpoint v; endgroup cg c = new;v = 2; c.sample();worked example
2bit a, b; covergroup cg; ca: coverpoint a; cb: coverpoint b; x: cross ca, cb; endgroup cg c = new;a = 0; b = 1; c.sample();worked example
3bit [3:0] v; covergroup cg; coverpoint v { option.auto_bin_max = 5; ignore_bins ig = {[0:2]}; } endgroup cg c = new;v = 3; c.sample(); v = 12; c.sample();graded
4bit [2:0] v; covergroup cg; coverpoint v { option.auto_bin_max = 4; ignore_bins ig = {0, 1, 6}; } endgroup cg c = new;v = 7; c.sample();graded
5bit [1:0] v, w; covergroup cg; cv: coverpoint v { bins one = {1}; bins two = {2}; bins three = {3}; bins up = (1 => 2); } cw: coverpoint w; x: cross cv, cw; endgroup cg c = new;v = 1; w = 0; c.sample(); v = 2; w = 0; c.sample(); v = 3; w = 1; c.sample();graded
6bit [1:0] a, b; covergroup cg; ca: coverpoint a { option.weight = 0; } cb: coverpoint b { option.weight = 0; } x: cross ca, cb { bins one = binsof(ca) intersect {2}; ignore_bins lo = binsof(cb) intersect {[0:1]}; } endgroup cg c = new;a = 0; b = 3; c.sample();graded
7covergroup cg (int w) with function sample(bit [1:0] a); option.weight = w; coverpoint a { bins one = {1}; bins two = {2}; } endgroup cg c = new(3), y = new(1);c.sample(1); y.sample(1); y.sample(2);graded
8bit [2:0] v, w; covergroup cg; cv: coverpoint v { bins big = {[8:15]}; } cw: coverpoint w { bins one = {1}; bins two = {2}; bins three = {3}; } endgroup cg c = new;w = 1; c.sample();graded
9bit [1:0] v; covergroup cg; coverpoint v { option.at_least = 2; bins t = (0 => 1), (0, 2 => 1), (0 => 1, 3); bins u = {0}; } endgroup cg c = new;v = 0; c.sample(); c.sample(); v = 1; c.sample();graded
10covergroup cg (int n) with function sample(bit [1:0] a); type_option.merge_instances = 1; coverpoint a { option.at_least = n; bins one = {1}; bins two = {2}; bins three = {3}; } endgroup cg c = new(1), y = new(3);c.sample(1); c.sample(2); c.sample(3); y.sample(2); y.sample(2);graded

Rows that print the type number say so. Questions 9 and 10 test two counting rules the coverage build does not apply (lessons C15 and C26). Their keys are the standard's.

Examples

Example 1

User Bins
Input
answer(0)
Output
answer = 5000

2 of 4: 5000.

Example 2

Automatic Bins
Input
answer(1)
Output
answer = 2500

1 of 4: 2500.

Example 3

A Cross
Input
answer(2)
Output
answer = 4167

(50 + 50 + 25) / 3 = 41.67%: 4167.

Constraints and Contract

  • Return one value per question from answer(q).
  • Keep the function header.

Hints

Hint 1

Does an ignore empty an automatic bin, or only shrink it?

Hint 2

Cross: Bu + Bc, with Bc the products no user, ignore or illegal bin takes.

Hint 3

A transition bin counts at most once per sample; merged instances use the largest at_least.

What the grader checks: Eleven constant answers. Questions 3 to 8 were measured on the coverage build, which agrees with the standard. Questions 9 and 10 are standard keys. The build counts the bin twice in one sample (10000) and does not apply the largest at_least (10000). See scenarios cov-032 (CD.md) and cov-089 (CG.md) in docs/sva-standard-traces.

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 1 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

User Bins

Input
answer(0)
Expected output
answer = 5000

2 of 4: 5000.

Run samples executes all 3 public checks. Check all tests runs 11 checks on the server.

Icarus · browser samples / server checks