← Design Verification Interviews

Interview Question · Design

A Cross Stuck at 12 Percent

L2 Mid-LevelL3 Seniorfunctional coveragecross coveragecoverage model

The Question

The interviewer asks

You cross address region (16 bins), burst length (8), size (4) and ID (16). Coverage has been stuck near 12% for weeks. What do you tell your manager?

Reveal the Model Answer

The cross has 16 × 8 × 4 × 16 = 8192 cells, and each needs its own hit. Most of them are not interesting, and many are impossible, so a low number says more about the model than the design. Cross only the pairs the spec ties together, such as length with size. Cover the ID on its own. Each cell should be a case someone would write a test for.

Every Field Multiplies the CellsArrows show which coverpoints feed which cross.
Every Field Multiplies the CellsArrows show which coverpoints feed which cross. component Region 16 bins component Burst length 8 bins component Size 4 bins component ID 16 bins component Four-way cross 16 x 8 x 4 x 16 =8192 cells component Length x size A pair the spec tiestogether: 32 cells component ID on its own 16 bins, no cross
Read the diagram as text
  • Region: 16 bins
  • Burst length: 8 bins
  • Size: 4 bins
  • ID: 16 bins
  • Four-way cross: 16 x 8 x 4 x 16 = 8192 cells
  • Length x size: A pair the spec ties together: 32 cells
  • ID on its own: 16 bins, no cross
  • Region → Four-way cross
  • Burst length → Four-way cross
  • Size → Four-way cross
  • ID → Four-way cross
  • Burst length → Length x size
  • Size → Length x size
  • ID → ID on its own

Each cell needs its own hit. Cross only the fields that a spec rule names together.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Mid-Level)

A good mid-level answer multiplies the bins to get the cell count and says how many cells can really be reached. It proposes the pairs worth keeping.

Cross-Questions

Where the interviewer goes next. Open a node to practise that follow-up.

What IfProve ItBreak ItCompare

  1. A Cross Stuck at 12 Percent
  2. What IfHow Long Random Stimulus Takes to Fill a CrossL2 Mid-Level

    What if every cell is legal and equally likely? Roughly how many random samples does a 512-cell cross need? Read the run.

    systemverilog
    module tb;
      bit [2:0] a, b, c;
      covergroup cg;
        ca: coverpoint a { option.weight = 0; }
        cb: coverpoint b { option.weight = 0; }
        cc: coverpoint c { option.weight = 0; }
        x:  cross ca, cb, cc;              // 8 x 8 x 8 = 512 cells, all equally likely
      endgroup
      cg cov = new();
      int n = 0;
      initial begin
        while (cov.get_coverage() < 100.0) begin
          a = 3'($urandom); b = 3'($urandom); c = 3'($urandom);
          cov.sample();
          n++;
          if (n == 512)  $display("after 512 samples: %0.2f%%", cov.get_coverage());
          if (n == 1536) $display("after 1536 samples: %0.2f%%", cov.get_coverage());
        end
        $display("all 512 cells covered after %0d random samples", n);
      end
    endmodule
    
    Reveal the Model Answer

    Many more than 512. Random samples repeat cells, so the last few empty cells take the longest. After 512 samples this run has about 63% of the cells. It needs 3384 samples, more than six per cell, to fill them all. Uneven probabilities make it much worse, so rare cells need biased constraints or a directed test.

    Random samplesCells covered (of 512)
    51263.09%
    153694.73%
    3384100%

    Measured by the run on this question. The last 5% of the cells took more samples than the first 63%.

    RUNVerilator (coverage build) · simulator service
    Edit the code, then run it
    Expected: after 512 samples: 63.09% after 1536 samples: 94.73% all 512 cells covered after 3384 random samples

    Self-Check

    Tick each key point you covered in your answer.

    Misconception

    "512 cells need about 512 random samples."

    Random samples land on cells already hit. The last empty cells are found slowly, which is why the run needs over six times as many.

    Source Spear & Tumbush, SystemVerilog for Verification (3rd ed.), §9.11 (PDF p395)

  3. CompareOne Big Cross vs Several PairsL2 Mid-LevelL3 Senior

    Compare one four-way cross with a set of two-way crosses over the same fields.

    Reveal the Model Answer

    The four-way cross demands every combination, 8192 cells here. The pairs, such as length with size and region with size, need every combination of two fields. That is a few hundred cells in all. Most spec rules involve two fields at a time, so pairs cover them at a small cost. Keep a three-way cross only where the spec states a rule that names three fields.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Senior)

    A good senior answer points to the spec rule behind each cross it keeps. It drops every cross that has no such rule.

    Half-Truth

    "Pairs cover everything the big cross covers."

    Some bugs need three fields together, such as a burst that wraps at one size in one region. Pairs alone miss them.

    Source IEEE 1800-2017 §19.6

  4. Break ItA Cross Hidden in the Covergroup TotalL2 Mid-Level

    How can the covergroup total make a weak cross look fine?

    Reveal the Model Answer

    By default the covergroup averages its coverpoints and crosses with equal weight. In the twin above, two closed coverpoints and a 12.5% cross average to 70.83%. With four closed coverpoints beside the cross, the total would pass 80% while the cross is nearly empty. Report each cross on its own.

    Self-Check

    Tick each key point you covered in your answer.

    Misconception

    "The total weighs each bin equally, so a big cross dominates it."

    The total weighs each coverpoint and cross equally, whatever its size. A 128-cell cross counts the same as a 2-bin coverpoint.

    Source IEEE 1800-2017 §19.11

  5. Prove ItReading a Cross as Its Own NumberL2 Mid-Level

    Prove it: how do you get one number that is just the cross? What does this print?

    systemverilog
    module tb;
      bit [1:0] a, b;
      covergroup cg;
        ca: coverpoint a { option.weight = 0; }   // still collected and reported
        cb: coverpoint b { option.weight = 0; }
        x:  cross ca, cb;                         // the only item that counts
      endgroup
      cg cov = new();
      initial begin
        for (int i = 0; i < 4; i++) begin a = 2'(i); b = 2'(i); cov.sample(); end
        $display("covergroup number = cross alone = %0.2f", cov.get_coverage());
      end
    endmodule
    
    Reveal the Model Answer

    It prints 25.00. The two coverpoints have weight 0, so they still collect data and show in the report, but they add nothing to the total. The cross is the only item left, and 4 of its 16 cells are hit. Put each key cross in a covergroup built this way, or read it from the report tool.

    RUNVerilator (coverage build) · simulator service
    Edit the code, then run it
    Expected: covergroup number = cross alone = 25.00

    Self-Check

    Tick each key point you covered in your answer.

    Tool as Truth

    "Call cg.x.get_coverage() to read the cross."

    The standard allows it, but some tools do not. This site's coverage build cannot read one item's coverage that way, so the weight trick is the portable route.

    Source IEEE 1800-2017 §19.8; ASIC Point engine notes (Verilator master b8e7f1e coverage build)

  6. Prove ItSolve 7.5.9: The Cross That Can Never CloseSimulator-graded

    Show it, don't just say it: this Silicon Lab problem is graded by the simulator.

    Open Problem 7.5.9

What People Get Wrong

Common wrong answers and why they fail. Run It shows the wrong belief failing on a real simulator.

Misconception

"If each coverpoint is closed, the cross is nearly closed."

Each cell needs its own combination. In the twin both coverpoints close after 16 samples, and the cross has 16 of 128 cells.

Run It

Sixteen samples that close both coverpoints.

RUNVerilator (coverage build) · simulator service
Edit the code, then run it
Expected: covergroup total=70.83 cross alone=12.50 FAIL: both coverpoints closed after 16 samples, but the cross has 128 cells and only 16 were hit

Wrong Altitude

"Delete the cross; it will never close."

The interactions in it may be where the bugs are. Cut it down to the combinations the spec cares about instead of losing them all.

Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §27.1 (PDF p502)

Buzzword Without Mechanism

"Crosses cost nothing in modern simulators."

Every cell is stored and updated on each sample, and every cell appears in the report. Big crosses slow runs and bury real holes.

Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §26.20 (PDF p481)

Learn It, Then Prove It