Module 7: Debug and Regression | Intermediate UVM

Failure Minimization

Turn a reproducible regression failure into the smallest useful scenario without accidentally removing the cause or changing the failure you are investigating.

Learning objectives

  • Explain why failure minimization should begin only after a failure is reproducible.
  • Define a stable failure signature that can be used to judge whether a reduced test still reproduces the same problem.
  • Reduce stimulus systematically by removing transactions, constraints, scenarios, agents, or configuration options.
  • Distinguish removing irrelevant stimulus from changing the conditions that cause the failure.
  • Use controlled experiments to identify which part of a randomized scenario is necessary for the failure.
  • Recognize when a minimized test is no longer equivalent to the original failure.
  • Produce a compact reproducer that can be handed to designers or preserved as regression metadata.

Step 1: Understand why minimization matters

Lesson 64 established the first requirement: reproduce the failure reliably.

A regression failure might originally look like this:

Test:       packet_random_test


Seed:       927341
Duration:   2.8 ms

Stimulus:
2,400 randomized transactions
4 protocol modes
3 concurrent sequences
error injection enabled
reset scenarios enabled

Failure:
SB_MISMATCH id=812
expected=0x35
actual=0x75

This is useful evidence, but it is a poor debugging experiment. There may be thousands of transactions between test start and the failure, several independent sequences, and many configuration options that have nothing to do with the bug.

Failure minimization asks:

What is the smallest scenario that still reproduces the same failure?

A smaller reproducer can make waveforms easier to inspect, logs easier to understand, hypotheses easier to test, and designer handoff much faster.

Minimization is not the same as fixing. You are deliberately changing the stimulus while trying to preserve the failure. The DUT and checker should not be modified merely to make the test easier to pass.

Step 2: Establish the baseline reproducer

Never begin minimization from a failure that you cannot reproduce consistently.

Your baseline should contain enough information to rerun the original scenario:

Baseline


test       = packet_random_test
seed       = 927341
config     = mode=burst, checks=on
DUT build  = 8f31c2a
first fail = SB_MISMATCH
transaction= 812
expected   = 0x35
actual     = 0x75

Run the baseline at least enough times to establish that the failure is reproducible under the same execution context.

Then create a copy of the reproducer for experimentation.

Step 3: Define the failure signature

Before reducing anything, decide what counts as "the same failure."

A useful failure signature can include:

  • failure class or report ID;
  • transaction ID or correlation key;
  • protocol operation;
  • expected and actual values;
  • assertion or checker name;
  • relevant error/status condition;
  • important timing relationship.

For example:

Failure signature:


checker    = SB_MISMATCH
transaction= 812
expected   = 0x35
actual     = 0x75
operation  = READ
mode       = BURST

Do not require every detail to remain identical if the reduction legitimately changes transaction numbering. The important question is whether the underlying failure mechanism remains the same.

This distinction becomes important when removing transactions before the failing operation causes IDs or timestamps to change.

Step 4: Understand the minimization loop

A disciplined minimization process looks like this:

Known reproducer
   |
   v


Choose ONE reduction
|
v
Run reduced test
|
+---+---+
|       |
FAIL     PASS
|       |
v       v
Keep      Restore
change    change
|       |
+---+---+
|
v
Try next reduction

Each experiment should answer one question.

For example:

  • Can the failure occur with half the transactions?
  • Is the second sequence necessary?
  • Is error injection required?
  • Does the failure require a particular protocol mode?
  • Does the failure require a reset?
  • Is concurrency required?

If you remove five unrelated features simultaneously and the failure disappears, you have learned very little. You do not know which change removed the required condition.

Step 5: Reduce the transaction stream

The most useful first reduction is often the amount of stimulus.

Suppose the failure occurs at transaction 812 in a sequence containing 2,400 transactions. Try reducing the sequence length while preserving the portion that reaches the failure.

Original:


2400 transactions
|
v
Failure at transaction 812

Experiment 1:
1200 transactions
|
v
Does failure remain?

Experiment 2:
900 transactions
|
v
Does failure remain?

Experiment 3:
850 transactions
|
v
Does failure remain?

If the failure still occurs, continue reducing. If it disappears, restore the previous passing boundary and investigate what transactions or state transitions were removed.

Be careful with randomized sequences: simply changing repeat (2400) to repeat (100) may produce a completely different random scenario. A better reduction may be to preserve the relevant transaction sequence explicitly once the failing behavior has been identified.

Step 6: Replace broad random stimulus with explicit stimulus

Random stimulus is excellent for discovering failures, but explicit stimulus is often better for explaining them.

Suppose a random sequence eventually discovers:

WRITE A


WRITE B
READ A
RESET
WRITE C
READ B
READ C
...

After identifying that only a small sequence is necessary, create a focused reproducer:

task body();


send_write('h100, 'h35);
send_write('h104, 'h17);
send_read ('h100);

apply_reset();

send_write('h108, 'h91);
send_read ('h104);

endtask

The exact transaction APIs depend on the protocol agent, but the architectural idea is important:

Random discovery
  |
  v


Identify relevant operations
|
v
Explicit reproducer
|
v
Simpler debugging

Do not assume that the original random seed remains useful after converting the scenario into explicit stimulus. At this point, the sequence itself becomes the reproduction artifact.

Step 7: Reduce dimensions systematically

Large randomized scenarios have many dimensions. Reduce them one at a time.

Dimension Example reduction Question
Transaction count 2400 → 1200 How much stimulus is necessary?
Sequences 3 → 1 Is concurrency necessary?
Protocol modes 4 → 1 Does the failure depend on a mode?
Payload values random → fixed Does data content matter?
Timing random delays → fixed delays Does a timing relationship matter?
Error injection enabled → disabled Is the injected fault required?
Reset mid-test reset → no reset Does reset participate in the failure?
Agents active + passive → active only Is another interface involved?

This produces a useful causal map instead of a collection of arbitrary passing tests.

Step 8: Be careful with concurrency

Concurrency deserves special attention in UVM environments.

A failure may depend on two sequences overlapping in time:

Sequence A:  |----TX----|       |----TX----|


Sequence B:       |----TX----|----TX----|
^
|
failure condition

Removing Sequence B may make the test pass, but that does not mean Sequence B is the bug. It may simply provide the event ordering necessary to expose the DUT problem.

Likewise, replacing concurrent activity with a sequential sequence can destroy the race or ordering condition being investigated.

When minimizing concurrency, ask:

  • Does the failure require overlapping operations?
  • Does the failure require a particular ordering?
  • Does the DUT support multiple outstanding transactions?
  • Does the scoreboard correlate transactions by ID?
  • Is the failure caused by a protocol ordering violation?

For concurrency-sensitive failures, preserve the smallest set of parallel activities that still reproduces the failure.

Step 9: Do not minimize by weakening the checker

A dangerous form of "minimization" is changing the verification environment until the failure disappears.

// Dangerous debugging approach


scoreboard.enable_checks = 0;

This does not minimize the failure. It suppresses the observation that identified it.

Similarly, avoid changing:

  • expected-value generation simply to match actual behavior;
  • timeouts solely to hide missing responses;
  • assertions by disabling the failing property;
  • monitor transaction boundaries to avoid reporting a mismatch;
  • error severity merely to turn a failure into a passing regression.

Step 10: Use binary-style reduction for large stimulus

When a long sequence is responsible for a failure, you can reduce it efficiently by testing large portions of the stimulus at once.

Conceptually:

Original stimulus:


[------------------------------------------------------------]

Remove approximately half:
[------------------------------]

Failure remains?
|
+---+---+
|       |
yes      no
|       |
keep       restore
reduction  some portion

Repeat until the smallest useful region is found.

This is especially effective when the test consists of a long list of mostly independent transactions.

However, it is not universally valid. Some failures depend on accumulated state, ordering, outstanding requests, or history. Removing the middle of a sequence can change the state before the failing transaction and therefore change the failure mechanism.

For stateful protocols, preserve the setup and reduce the active region separately:

Initialization / required history
          |
          v
   Reduced failing region
          |
          v
      Failure

Step 11: Preserve causal evidence

A minimized test should still provide enough evidence to understand what happened.

Keep the useful artifacts from the baseline:

  • seed or original regression identifier;
  • reduced sequence or stimulus list;
  • failure signature;
  • transaction ID or correlation key;
  • relevant UVM logs;
  • assertion results;
  • focused waveform interval;
  • configuration required for reproduction.

For example:

MINIMIZED FAILURE


Original:
2400 transactions
3 concurrent sequences
4 protocol modes

Reduced:
17 transactions
2 concurrent sequences
1 protocol mode

Failure:
SB_MISMATCH
operation = READ
expected  = 0x35
actual    = 0x75

Required condition:
outstanding write + subsequent read
across reset boundary

This is much more useful to another engineer than a raw regression log.

Step 12: Know when minimization has gone too far

A smaller test is not automatically a better test.

Stop reducing when one of these occurs:

  • the failure disappears;
  • the failure changes into a different failure;
  • the causal ordering is no longer preserved;
  • the required protocol state can no longer be reached;
  • the reproducer no longer exercises the same DUT behavior;
  • the remaining scenario is smaller but less understandable.

For example, suppose the original failure is:

SB_MISMATCH


write accepted
reset occurs
read returns stale data

If you remove the reset and obtain:

SB_MISMATCH


read returns wrong data

you may have discovered another failure, but you have not necessarily minimized the original reset-related failure.

Always compare the failure mechanism, not merely the fact that some checker still fails.

Step 13: Verify the final reproducer

Once you believe the scenario is minimal, perform a final validation.

  1. Run the minimized test from a clean simulation.
  2. Confirm that the expected failure occurs.
  3. Repeat it when practical to establish stability.
  4. Compare the failure signature with the original.
  5. Record the configuration and remaining assumptions.
  6. Preserve the minimized reproducer separately from experimental work.

A useful final result might look like:

Original failure:


packet_random_test
seed=927341
2400 transactions

Minimized failure:
packet_failure_reproducer
17 explicit transactions
2 concurrent sequences
1 reset
1 protocol mode

Same failure:
SB_MISMATCH
stale response after reset

Required conditions:
outstanding write
reset
read after reset
preserved correlation ID

Try it yourself

Take a seeded failure from Lesson 64 and create a smaller reproducer.

  1. Preserve the original test, seed, configuration, and failure record.
  2. Write down the failure signature.
  3. Remove approximately half of the irrelevant transactions.
  4. Run the test and record whether the same failure remains.
  5. Restore the last successful reduction if the failure disappears.
  6. Repeat with one dimension at a time: transactions, sequences, modes, delays, or features.
  7. Convert the remaining randomized behavior into explicit stimulus where practical.
  8. Verify that the final reproducer still demonstrates the original failure mechanism.

Success criterion: produce a significantly smaller test while preserving a recognizable and explainable failure signature.

Debugging challenge

A regression failure requires 1,000 transactions and two concurrent sequences.

You discover:

Experiment A:


500 transactions
2 sequences
FAIL

Experiment B:
250 transactions
2 sequences
PASS

Experiment C:
500 transactions
1 sequence
PASS

Experiment D:
500 transactions
2 sequences
reset disabled
PASS

What have you learned?

  • The failure requires more than 250 transactions, or at least requires state that is reached only in the larger scenario.
  • The second sequence appears necessary for the current reproducer.
  • The reset appears to participate in the failure.

But none of these observations alone proves the root cause.

Your next experiment should isolate one of these dependencies rather than making another broad change.

Common mistakes

  • Minimizing before reproduction: you may remove the very condition needed to reproduce the original failure.
  • Changing several dimensions at once: you cannot tell which change affected the result.
  • Assuming the first remaining failure is the same failure: compare its mechanism and signature.
  • Removing concurrency blindly: ordering and overlap may be essential to the bug.
  • Changing the checker: suppressing an error is not minimization.
  • Changing randomization without recording the consequence: the reduced scenario may no longer correspond to the original random execution.
  • Deleting required history: stateful DUT behavior can depend on transactions that occur well before the visible failure.
  • Over-minimizing: the smallest possible test is not always the clearest or most useful reproducer.
  • Failing to preserve the baseline: experimentation should never destroy the known failing reference.

Knowledge check

  1. Why should a failure be reproducible before minimization begins?
  2. What is a failure signature, and why is it more useful than simply checking whether the test exits with an error?
  3. Why can removing an apparently unrelated transaction change a stateful DUT failure?
  4. Why should one reduction dimension be changed at a time?
  5. Why can replacing random stimulus with explicit stimulus make debugging easier?
  6. Why is disabling a scoreboard check not a valid minimization technique?
  7. How can a minimized failure be different from the original failure even though both produce UVM_ERROR?
Check your reasoning
  • You need a stable baseline so that a passing reduced test can be interpreted as the result of the reduction rather than an already unstable failure.
  • A failure signature captures the important characteristics of the failure, such as checker, transaction, expected/actual result, and timing or protocol context.
  • Earlier transactions can establish internal DUT state, outstanding requests, ordering, or history required by the failing operation.
  • Changing one dimension at a time preserves causal information about which condition matters.
  • Explicit stimulus removes unnecessary random exploration and makes the relevant sequence easier to inspect and modify.
  • Disabling a checker removes the observation rather than reducing the stimulus that causes the failure.
  • Two failures can share the same report severity while having different underlying causes, transactions, state, or protocol conditions.

Key takeaways

  • Reproduce before reducing. Start with a known, stable failure from Lesson 64.
  • Define what must survive. Use a failure signature to distinguish the original problem from a different failure.
  • Change one dimension at a time. This turns minimization into a controlled experiment.
  • Preserve causality. State, ordering, outstanding transactions, reset, and concurrency may all be necessary.
  • Do not weaken verification. A disabled checker creates a passing test, not a minimized failure.
  • Prefer explicit stimulus for the final reproducer. Randomization discovers failures; focused stimulus often explains them.
  • Preserve the final artifact. A compact reproducer is valuable for debugging, designer handoff, and regression tracking.

What comes next

Lesson 66 — Test Naming and Metadata takes the minimized failure and makes it easier to identify, store, communicate, and reproduce in a regression environment.

The progression is intentional:

Lesson 63


Waveform Debug
|
v
Lesson 64
Seed Reproduction
|
v
Lesson 65
Failure Minimization
|
v
Lesson 66
Test Naming & Metadata

First find the failure, then reproduce it, then reduce it, and finally give the resulting test enough metadata that another engineer can understand and rerun it.