Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • Meet DCRouter
  • Glossary
  • Part 0: What Verification Is8
  • Part 1: What Can Go Wrong11
  • Part 2: Specifications as Checkable Rules8
  • Part 3: Observability and Controllability7
  • Part 4: Stimulus11
    • Directed Tests
    • Why Random Works
    • Constrained Random
    • Distributions and Bias
    • The Long Tail
    • Scenarios and Layered Stimulus
    • Error Injection
    • Timing and Back-Pressure
    • Seeds and Regressions
    • Hunting the Zoo with Random
    • Drills: Stimulus
  • Part 5: Checking11
  • Part 6: Coverage10
  • Part 7: Formal and Simulation10
  • Part 8: Verification Levels and Reuse8
  • Part 9: Planning and Risk9
  • Part 10: Emulation and Prototyping8
  • Part 11: Post-Silicon Validation8
  • Part 12: Bug Economics8
  • Part 13: Debug7
  • Part 14: Sign-Off7
  • Part 15: Verification in Context8
  • Part 16: Case Studies5
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 4: Stimulus
  1. Topics
  2. First Principles of Verification Strategy
  3. Part 4: Stimulus
  4. Seeds and Regressions

Part 4 · Stimulus · Working (W)

Seeds and Regressions

A random test is a family of tests, one per seed. The same seed reproduces a run exactly; a different seed is a different test. Measured on DCRouter: the random hunt catches BUG_21 with 16 of 20 seeds and misses it with 4. What a passing seed proves, how to treat a one-in-a-thousand failure, and how teams run seeds in regressions.

On this page

    Note

    Level: Working (W) · Answers: How do we drive the design into the states that matter?

    Before this: Why Random Works

    A nightly regression reports one failure in 1,000 runs of a random test. The test passed the night before and passes when rerun with a new seed the next morning. Someone suggests it was a glitch and proposes closing the ticket. The seed of the failing run is in the log. Whether that one failure is noise or the most important result of the week depends entirely on what is done with that seed.

    What does a seed mean, and how should random tests be run and trusted?

    The obvious answer, and why it breaks

    The obvious mental model treats a random test as one test that either passes or fails. It is really a family of tests, one per seed, each with different packets, timing and choices. A pass with one seed says that one member of the family passed. A rare failure says some members fail, and the seed identifies one of them exactly. Treating a random test as a single verdict throws both facts away.

    The idea: a seed names one test

    • Reproducible: with SystemVerilog random stability, the same seed and the same code reproduce the same run, cycle for cycle (fact V7).

    • Different seed, different test: each seed is an independent sample of the stimulus space.

    • Fragile across edits: adding or reordering a random call in the testbench changes what every seed produces, so a failing seed should be reproduced on the same build first.

    If a bug is triggered and caught with probability r per seed, the chance that at least one of N seeds catches it is (fact M3):

    P(caught by at least one of N seeds)=1−(1−r)N

    A bug caught by one seed in a thousand (r = 0.001) has a 63% chance of being seen in 1,000 seeds and needs about 3,000 seeds for 95%.

    Measured: one test, twenty seeds

    Lesson 4.10's random hunt was built three times (clean, with BUG_20, with BUG_21) and each build was run with seeds 1 to 20 (Verilator's +verilator+seed+<n>). Each seed generates different traffic: between 194 and 354 packets in the five seeds sampled.

    Diagram
    build      seeds passing   seeds catching the bug
    clean      20 of 20        -
    BUG_20      0 of 20        20 of 20
    BUG_21      4 of 20        16 of 20   (missed with seeds 2, 5, 17, 18)

    How to read it: BUG_20 (sleeping with an output locked) is caught by every seed: the random rounds make mid-packet pauses common. BUG_21 (port 3 cannot wake the router) needs the router to fall asleep while input 3 is the only input with traffic left to send, for example when input 3 is alone in a round, or is the last slow source still sending; if any other input sends, it wakes the router for input 3. Four seeds never produce that situation. A single run of this test with seed 2 would pass with BUG_21 present. Two independent seeds would catch it with probability about 1 − 0.2² = 0.96.

    A test fails once in 1,000 seeds. Now what?

    Step

    Why

    Rerun the failing seed on the same build

    Confirms it reproduces; random stability makes this exact

    Debug it like any failure

    It is a real behaviour of the design or the testbench, not a glitch

    Decide: design bug, testbench bug or illegal stimulus

    All three happen; a rare seed often finds a rare legal case

    Turn it into a permanent test

    Keep the seed in a list of fixed regression seeds, and write a directed test for the case, which survives testbench edits

    Estimate how rare the trigger is

    One in 1,000 seeds says roughly how much coverage or bias is missing (lesson 4.5)

    How real teams run seeds

    Practice

    Purpose

    Fresh random seeds every night, logged

    Each regression explores new members of each test's family

    A fixed list of seeds that once failed

    Fixed bugs stay fixed

    Many seeds of few tests, rather than one seed of many

    Rare triggers need samples (the formula above)

    Coverage merged across all seeds

    Shows what the family as a whole reached (Part 6)

    Never close an unreproduced failure

    A missing seed or build is a process bug to fix

    What breaks

    A team (illustrative) ran each random test with one fixed seed for months, for "stable results". Their regression was in effect a directed suite whose cases they had never seen. Switching to fresh seeds nightly produced a burst of failures in the first week, every one a real bug that the fixed seeds had happened to avoid.

    Why this matters

    Senior lens. Think of every random test as a distribution and every seed as a sample. Run many samples, log every seed, reproduce every failure exactly, and treat rare failures as rare cases found, not noise. A random test with one fixed seed is a directed test nobody wrote down.

    Interview

    Asked: "A test fails once in 1,000 seeds. Now what?"

    Weak answer: It's probably a flaky test; rerun it.

    Strong answer: It's a real, rare behaviour, and the seed reproduces it exactly on the same build, so I rerun that seed and debug it like any other failure. Then I decide whether it's a design bug, a testbench bug or illegal stimulus. Once fixed, the seed goes into the fixed-seed regression list and I write a directed test for the case, because seeds stop reproducing when the testbench changes. The rate also tells me something: a one-in-a-thousand trigger means most nights wouldn't see it, so I'd add bias or coverage to reach it on purpose.

    Follow-ups: (1) Why might the seed stop reproducing? (2) How many seeds to be 95% sure of seeing a 1-in-1,000 bug?

    Check yourself Why does the random hunt pass with BUG_21 when run with seed 2?

    That seed never lets the router fall asleep while input 3 is the only input with traffic left, so the bug is never activated.

    Check yourself How many independent seeds give a 95% chance of catching a bug that 1 seed in 1,000 catches?

    About 3,000, since (1 − 0.001)^3000 ≈ e^(−3) ≈ 0.05.

    Key takeaways

    • A random test is a family of tests; a seed names one member and reproduces it exactly.

    • A passing seed proves little; rare triggers need many seeds, as 1 − (1 − r)^N shows.

    • Log every seed, reproduce every failure on the same build, and keep failing seeds and directed tests for fixed bugs.

    Keep going

    Next: Lesson 4.10, Hunting the Zoo with Random. DCRouter step 5: a constrained-random hunt through the Bug Zoo.

    Related topics

    • Part 4 overview: Stimulus

    Previous

    48 / 160

    Next: Hunting the Zoo with Random

    Up next

    Up nextHunting the Zoo with Random

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Directed Tests
    • Why Random Works
    • Constrained Random