C14.1 Ignore or Illegal?

MediumFixVerilator coverage build · serverReview the topic

Fix an opcode covergroup that can never pass 75%, by excluding reserved codes and marking the forbidden one illegal.

Hardware context: An opcode decoder with reserved codes and one forbidden code. Exclude what the plan does not need so that a complete regression can reach 100%.

This is a Fix problem: the covergroup in the editor has one realistic defect. Find it and fix it.

A controller accepts 4-bit opcodes. The plan groups them in fours, grp[0] to grp[3]. Codes 12 to 14 are reserved and never sent. Code 15 is KILL, which the bench must never send.

The best regression sends every code from 0 to 11, and the covergroup still stops at 75%.

Signals in the Timeline

SignalWidthRole
samples8input of each check
Full specification
CodesMeaningIn the plan?
0 to 11commandsyes, in groups of four
12 to 14reserved, never sentno
15KILL, must never be sentno, and its appearance is an error

Each case samples a fresh instance and reads get_inst_coverage() times 100, rounded. The cases may send reserved codes; they never send KILL, which would stop the run on the coverage build. The full check samples more lists than the examples show.

Examples

Example 1

Every Command but One
Input
opcodes: 0 1 2 3 4 5 6 7 8 9 10
Output
coverage_percent_x100 = 10000

All three command groups are hit. With grp[3] out of the number, that is 100.00%.

Example 2

A Reserved Code Changes Nothing
Input
opcodes: 2 6 13
Output
coverage_percent_x100 = 6667

grp[0] and grp[1]: 2 of 3. The 13 is excluded.

Example 3

Only Reserved Codes
Input
opcodes: 12 14
Output
coverage_percent_x100 = 0

Nothing counted is hit: 0.00%.

Constraints and Contract

  • Keep grp[4] = {[0:15]} and the covergroup and coverpoint names.
  • Leave codes 12 to 15 out of the coverage number, and make KILL an illegal_bins.

Hints

Hint 1

With every code from 0 to 11 sent, which group can never be hit?

Hint 2

Is a reserved code an error, or simply not part of the plan? Is KILL?

Hint 3

Exclusions are applied after the codes are dealt into the groups. What happens to a group whose codes are all excluded?

What the grader checks: Your covergroup is sampled with 18 lists of opcodes (never KILL). Its instance coverage is compared with the value IEEE 1800-2023 clause 19 gives. Three lists are shown. Whether 15 is illegal or ignored gives the same numbers on these lists.

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

Report a problem with this page

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

Every Command but One

Input
opcodes: 0 1 2 3 4 5 6 7 8 9 10
Expected output
coverage_percent_x100 = 10000

All three command groups are hit. With grp[3] out of the number, that is 100.00%.

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

Verilator coverage build · server