C17.1 Carve the Cross

HardImplementVerilator coverage build · serverReview the topic

Group the products of an opcode-by-size cross into the four bins the plan names, with binsof, intersect and the logical operators.

Hardware context: A memory port with four operations in four access sizes. Group the operation-by-size products into the four classes the plan names.

A memory port accepts four operations (read, write, read-modify-write, flush) in four sizes (1, 2, 4 and 8 bytes). The coverpoints are written. The plan does not want all 16 products as separate bins: it names four groups.

Add the four user bins to the cross op_x_sz. Products that no group names keep their automatic bins.

Signals in the Timeline

SignalWidthRole
samples8input of each check
Full specification
User binProducts
narrow_wrwrites of 1 or 2 bytes
any_rmwevery read-modify-write
wideevery access of 4 or 8 bytes except a flush
flush_or_byteevery flush, and every 1-byte access

Write each selection by size with intersect on sz values and each by operation with binsof on an op bin. A product may belong to several user bins.

Each case samples a fresh instance and reads get_inst_coverage() times 100, rounded: the average of op, sz and the cross. The full check samples more lists than the examples show.

Examples

Example 1

The Product No Group Names
Input
accesses (opcode, size): (rd, 2)
Output
coverage_percent_x100 = 2333

<rd, b2> is the one automatic bin: 1 of 5 cross bins. op and sz are each at 1 of 4: (25 + 25 + 20) / 3 = 23.33%.

Example 2

Two Groups
Input
accesses (opcode, size): (wr, 2) (rd, 8)
Output
coverage_percent_x100 = 4667

A 2-byte write covers narrow_wr; an 8-byte read covers wide: 2 of 5 cross bins.

Example 3

A Flush and a Read-Modify-Write
Input
accesses (opcode, size): (flush, 4) (rmw, 8)
Output
coverage_percent_x100 = 5333

The 4-byte flush covers flush_or_byte only (wide excludes flush). The 8-byte read-modify-write covers any_rmw and wide.

Constraints and Contract

  • Keep the covergroup, coverpoint and bin names and the coverpoints as given.
  • Add exactly the four user bins of the table to op_x_sz, with no ignore or illegal bins.

Hints

Hint 1

Which of the 16 products does no group name? That one keeps an automatic bin.

Hint 2

!binsof(op.flush) keeps every operation except flush.

Hint 3

&& binds tighter than ||: group with parentheses when in doubt.

What the grader checks: Your covergroup is sampled with 19 lists of accesses. Its instance coverage is compared with the value IEEE 1800-2023 19.6.1 and 19.11 give. Three lists are shown.

19 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

The Product No Group Names

Input
accesses (opcode, size): (rd, 2)
Expected output
coverage_percent_x100 = 2333

<rd, b2> is the one automatic bin: 1 of 5 cross bins. op and sz are each at 1 of 4: (25 + 25 + 20) / 3 = 23.33%.

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

Verilator coverage build · server