← Protocols Interviews

Interview Question · Design

Functional Coverage for a Bus

L2 Mid-LevelL3 Seniorverificationcoverageaxi
  • Likely at Microchip
  • Likely at Micron
  • Likely at Cadence

The Question

The interviewer asks

What functional coverage would you write for a bus interface like AXI, and what traps do you watch for?

Reveal the Model Answer

Sample from the passive monitor when a transaction completes, not from the driver when it is issued. Cover the attributes: burst, length, size, alignment, and distance to a 4 KB or wrap boundary. Cover concurrency: outstanding depth, ID reuse and interleaving. Add backpressure (stall length per channel, including the last beat), every response type, and reset mid-transaction. Cross only the fields that interact. A cross of every field gives thousands of bins that nobody closes.

Where Bus Coverage SamplesArrows show the item from the sequence to the covergroup. The driver knows the intent; the monitor sees the result.
Where bus coverage samplesArrows show the item from the sequence to the covergroup. The driver knows the intent; the monitor sees the result. component Sequence Creates the intendeditem component Driver Knows the intent, notthe result component Design Accepts, stalls,responds component Passive monitor Sees the acceptedtransaction component Covergroup Samples at completion itemdrives wireswirescompletedtransaction
  1. Intent

    When the driver sends an item, the stall length and the response are still unknown.

  2. Result

    The monitor rebuilds the transaction at completion, with its response and stall pattern. The covergroup samples here.

Read the diagram as text
  • Sequence: Creates the intended item
  • Driver: Knows the intent, not the result
  • Design: Accepts, stalls, responds
  • Passive monitor: Sees the accepted transaction
  • Covergroup: Samples at completion
  • Sequence → Driver: item
  • Driver → Design: drives wires
  • Design → Passive monitor: wires
  • Passive monitor → Covergroup: completed transaction

Sample where the result is known. The same monitor and covergroup also work when the agent only watches.

GroupCoverpointsCross with
AttributesAxBURST, AxLEN (bucketed), AxSIZE, start alignmentburst x length x size, legal combinations only
Boundariesbytes to the next 4 KB edge, start offset in the wrap windowburst type
Concurrencyoutstanding count, same ID in flight, read interleavingID width use
Backpressurestall length on each of AW, W, B, AR, R; stall on LASTchannel
ResponsesOKAY, EXOKAY, SLVERR, DECERR, error mid-burstread or write
Resetreset during address, data or responsechannel

A starting model. Each row should trace back to a line in the test plan.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Mid-Level)

A good mid-level answer samples at the monitor and names the attribute and backpressure groups. It crosses only combinations that are legal.

Cross-Questions

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

WhyWhat IfProve ItBreak ItCompareScale It

  1. Functional Coverage for a Bus
  2. WhyWhere Coverage Is SampledL2 Mid-Level

    Why sample coverage in the monitor at completion rather than in the sequence or the driver?

    Reveal the Model Answer

    Coverage should record what the design actually did. The monitor sees only accepted transactions, with their real response and timing. It also works the same when the agent is passive (only watching) in a larger environment. Sampling at completion lets a bin record the response and the stall pattern. The driver cannot know these when it sends the item.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer gives two reasons. The monitor sees what was really accepted, not what was intended, and it still works when the agent is passive.

  3. What IfCoverage Sampled in the DriverL2 Mid-Level

    What if coverage is sampled in the driver instead? Show a bin it fills falsely.

    Reveal the Model Answer

    Say a write is driven, but reset aborts it before the handshake. The driver has already counted a write of that kind. The bin closes, yet the design never completed it. Driver coverage measures what the stimulus asked for, not what the design did.

    Self-Check

    Tick each key point you covered in your answer.

    Half-Truth

    "Driver coverage equals monitor coverage when there are no errors."

    Reset, a dropped item or a stalled channel can stop a driven item from completing. The driver cannot see that.

    Source Lesson U15.1 key points

  4. CompareCode Coverage Versus Functional Coverage on a BusL1 JuniorL2 Mid-Level

    For a bus subordinate, what does code coverage tell you that functional coverage does not, and the other way round?

    Reveal the Model Answer

    Code coverage finds RTL that no test reached, such as an error path or an unused state. Nobody has to think of these in advance. Functional coverage checks that the scenarios the spec and plan care about happened. That includes combinations and sequences that no single line of code represents. Code coverage cannot see a missing feature and functional coverage cannot see dead code, so you need both.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Junior)

    A good junior answer says code coverage is automatic and follows the RTL structure. Functional coverage is written by hand from the spec.

  5. Scale ItSizing a Cross Before Writing ItL3 Senior

    How many bins does a burst x length x size cross have on a 32-bit AXI interface? How would you cut it down?

    Reveal the Model Answer

    Start from the legal set, not the raw one. On a 32-bit bus Size is 1, 2 or 4 bytes, and INCR allows 256 lengths, FIXED 16 and WRAP 4. That gives 3 x (256 + 16 + 4) = 828 legal combinations, against 6,144 raw. Then bucket the lengths where behaviour does not change: 1, 2 to 15, 16, 17 to 255, and 256. That leaves a few dozen bins, and each one means something.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Senior)

    A good senior answer counts the legal combinations first. It places each length bucket where the design's behaviour really changes.

  6. Break ItThe Backpressure Nobody CoveredL2 Mid-LevelL3 Senior

    All coverage is green, yet a customer hits a hang when the response channel is stalled. How did that escape?

    log
    Illustrative regression/customer comparison
    Regression: response traffic covered, all reported coverage goals met
    Customer: RVALID=1, RREADY=0 for an extended interval
    RREADY returns to 1; transfer never completes
    Reveal the Model Answer

    Most likely the bench kept BREADY and RREADY high, so the subordinate's response-side stall path never ran. Every stall rule then passed vacuously, because no stall ever happened. The coverage model also had no stall-length bins on B or R. Randomise ready with long low runs on every channel the testbench drives, and cover stall length per channel. Also count how often each checker antecedent matched.

    Three Beats, Zero Stalls, Five Vacuous PassesThe hold property on a sink that is always ready.valid && !ready |=> validMeasured on Verilator 5.052: one copy of the assertion per lane
    attempt startsvacuous success: the antecedent did not match
    Three beats, zero stalls, five vacuous passesedge @5, from edge 1 (t=5): succeeds vacuously at edge 1 (t=5). edge @15, from edge 2 (t=15): succeeds vacuously at edge 2 (t=15). edge @25, from edge 3 (t=25): succeeds vacuously at edge 3 (t=25). edge @35, from edge 4 (t=35): succeeds vacuously at edge 4 (t=35). edge @45, from edge 5 (t=45): succeeds vacuously at edge 5 (t=45).edgetime15215325435545655clkvalidreadyattemptsedge @5edge @5: succeeds vacuously at edge 1 (t=5)edge @15edge @15: succeeds vacuously at edge 2 (t=15)edge @25edge @25: succeeds vacuously at edge 3 (t=25)edge @35edge @35: succeeds vacuously at edge 4 (t=35)edge @45edge @45: succeeds vacuously at edge 5 (t=45)
    1. Edge 2 · t=15

      Beat one is taken at 15 with ready already high. valid && !ready is false, so the attempt ends as it starts.

    2. Edge 5 · t=45

      Five edges, five open circles. The hold rule was never exercised, and the report says pass.

    Read the lanes as text
    • edge @5, from edge 1 (t=5): succeeds vacuously at edge 1 (t=5).
    • edge @15, from edge 2 (t=15): succeeds vacuously at edge 2 (t=15).
    • edge @25, from edge 3 (t=25): succeeds vacuously at edge 3 (t=25).
    • edge @35, from edge 4 (t=35): succeeds vacuously at edge 4 (t=35).
    • edge @45, from edge 5 (t=45): succeeds vacuously at edge 5 (t=45).

    Sampled values, edge 1 to 6: valid 0 1 1 1 0 0; ready 1 1 1 1 1 1.

    The program behind the lanes

    The lanes come from running this program on Verilator 5.052. Each lane is a separate copy of hold_valid that can start only at that lane's edge, so every verdict and its edge are read from that copy's own output.

    module tb;
      logic clk = 0;
      always #5 clk = ~clk;                 // rising edges at 5, 15, 25, ...
      logic valid = 0, ready = 1;           // the sink is ready at every edge
    
      hold_valid: assert property (@(posedge clk) valid && !ready |=> valid);
    
      initial begin
        @(negedge clk); valid = 1;          // three beats, taken at 15, 25 and 35
        @(negedge clk);
        @(negedge clk);
        @(negedge clk); valid = 0;
        @(negedge clk);
        @(negedge clk);
        $finish;
      end
    endmodule
    

    A sink that is always ready never stalls the link. The hold rule passes five times without ever being tested.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer points at ready held high on the response channels, so no stall ever happened.

  7. Prove ItSolve P2.17.1: The AXI MonitorSimulator-graded

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

    Open Problem P2.17.1

What People Get Wrong

Common wrong answers and why they fail.

Half-Truth

"Sample in the driver when the sequence item is sent."

That covers what the test intended. A transaction the DUT never accepted, or one cut short by reset, still counts.

Wrong Altitude

"Cross every field with every other field."

AxLEN, AxSIZE and AxBURST alone give 6,144 raw combinations, and most are illegal on a given bus. Restrict and bucket the crosses, or they never close.

Half-Truth

"100% code coverage on the subordinate means the protocol is covered."

Code coverage says the lines ran. It does not say a stall hit the last beat while two IDs were outstanding. Interactions need functional coverage.

Learn It, Then Prove It