Module 7: Debug and Regression | Intermediate UVM

Seed Reproduction

Reproduce randomized failures reliably by preserving the seed, test configuration, simulation context, and evidence that define the failing run.

Learning objectives

  • Explain what a simulation seed controls and why a seed alone is not always sufficient to reproduce a failure.
  • Distinguish the initial random seed from the random state consumed by individual SystemVerilog objects and processes.
  • Capture the test, seed, configuration, plusargs, simulator settings, and relevant environment metadata for a failing regression.
  • Build a repeatable workflow for reproducing a failing UVM test from regression results.
  • Recognize conditions that can change randomization or scheduling behavior between runs.
  • Separate true reproduction from an apparently similar run that no longer exercises the same failure.
  • Prepare a reproduced failure for the failure-minimization techniques introduced in Lesson 65.

Step 1: Understand why seed reproduction matters

Randomized verification intentionally explores many legal scenarios. Eventually, a regression may discover a failure that is difficult to reproduce manually.

The first debugging question is therefore not:

"What changed in the DUT?"

It is:

"Can I reproduce the exact failing scenario?"

A reproducible failure gives you a stable starting point for waveform inspection, transaction tracing, assertion analysis, and scoreboard debugging.

A useful regression record should preserve at least:

  • test name or test selection;
  • simulation seed;
  • relevant plusargs and command-line options;
  • configuration values that affect stimulus or checking;
  • DUT parameters or build configuration;
  • software or firmware image/version when applicable;
  • simulator and compilation information;
  • the first useful failure and its simulation time;
  • any artifacts needed for debugging, such as logs and waveforms.

Important: a seed identifies a randomized execution starting point, but it does not magically capture every input to a simulation. If the environment, configuration, compiled code, randomization algorithm, or external input changes, the same seed may no longer produce the same behavior.

Step 2: Understand the SystemVerilog randomization model

SystemVerilog provides pseudorandom behavior through simulation randomization facilities. UVM builds on this model rather than replacing it.

For a regression run, the initial seed establishes the starting point for the simulation's pseudorandom state. As execution proceeds, random values are consumed by different processes and objects.

Initial simulation seed
    |
    v


+----------------------+
| Pseudorandom state   |
+----------------------+
|
+----> test randomization
|
+----> sequence randomization
|
+----> transaction randomization
|
+----> other randomized objects/processes
|
v
Failing scenario

This leads to an important debugging distinction:

  • Same initial seed: asks the simulator to start from the same pseudorandom starting point.
  • Same execution context: attempts to ensure that random numbers are consumed in the same way and by the same parts of the testbench.

If an earlier piece of code performs an additional randomization, the subsequent random stream can change. Therefore, inserting temporary random calls while debugging can accidentally destroy reproduction.

Step 3: Record the seed correctly

For UVM debugging, it is useful to record the simulation seed as part of the test's diagnostic information.

class my_test extends uvm_test;


`uvm_component_utils(my_test)

function new(string name = "my_test",
uvm_component parent = null);
super.new(name, parent);
endfunction

function void start_of_simulation_phase(uvm_phase phase);
super.start_of_simulation_phase(phase);


`uvm_info("RUN_INFO",
  $sformatf("test=%s seed=%0d",
            get_type_name(),
            $get_initial_random_seed()),
  UVM_LOW)


endfunction

endclass

The exact seed is also commonly printed by the simulator itself. Prefer the simulator's documented seed mechanism when launching a reproduction rather than inventing a custom seed option in the testbench.

The important goal is not merely printing a number. The regression result should make that number easy to associate with the failing test and configuration.

Step 4: Understand what must be reproduced

Consider a regression result such as:

TEST     : uart_random_test


SEED     : 18472931
CONFIG   : 4Mbps, parity=even
MODE     : active
DUT_REV  : 2026.09
RESULT   : FAIL
TIME     : 184250 ns

FAILURE:
SB_MISMATCH id=417 expected=0x35 actual=0x75

The reproduction target is not simply:

seed = 18472931

The useful reproduction target is the complete run context:

test + seed + configuration + build + simulator context
                 |
                 v
          same scenario
                 |
                 v
          same failure

For example, changing parity configuration while keeping the seed constant may generate a completely different transaction stream. Changing the compiled DUT revision can also turn a real failure into a passing run.

Step 5: Build a reproducible regression record

A practical regression infrastructure should make the reproduction command obvious.

Test:       uart_random_test


Seed:       18472931
Simulator:  
Build:      
DUT:        
Config:     parity=even, baud=4Mbps
Plusargs:   +UVM_VERBOSITY=UVM_LOW
Failure:    SB_MISMATCH
Time:       184250 ns

For larger regressions, store this metadata in a machine-readable result record so a failure can be relaunched without manually reconstructing the command.

A good regression system turns:

"Seed 18472931 failed"

into:

"Run this exact test with this seed and this configuration."

Step 6: Reproduce before modifying the testbench

Start with a clean reproduction.

  1. Identify the exact failing test.
  2. Copy the failing seed.
  3. Recreate the same plusargs and configuration.
  4. Use the same DUT/build revision.
  5. Run without adding debug randomization or stimulus changes.
  6. Confirm that the same failure signature occurs.
  7. Only after reproduction is established, increase diagnostic visibility.

This gives you two useful run classes:

Run Purpose What should change?
Baseline reproduction Prove the failure is reproducible Nothing intentionally
Debug reproduction Collect more evidence Logging, verbosity, waveform/debug settings
Experiment Test a hypothesis One controlled variable
Minimized reproduction Reduce the failing scenario Stimulus or scenario, deliberately and incrementally

This distinction prevents a common debugging error: changing several variables and then assuming that a passing result proves the original failure was fixed.

Step 7: Connect the seed to UVM stimulus

UVM sequences commonly randomize transactions, so a seeded run can produce a particular sequence of randomized operations.

class bus_sequence extends uvm_sequence #(bus_item);


`uvm_object_utils(bus_sequence)

function new(string name = "bus_sequence");
super.new(name);
endfunction

task body();
bus_item item;


repeat (20) begin
  item = bus_item::type_id::create("item");

  start_item(item);

  if (!item.randomize()) begin
    `uvm_fatal("RAND",
      "bus_item randomization failed")
  end

  finish_item(item);
end


endtask

endclass

If the same test, seed, configuration, and execution context are preserved, the randomized sequence can often be reproduced. However, do not assume that every refactoring preserves the exact random stream.

For example, these changes can affect random consumption:

  • adding a new call to randomize();
  • changing the order of randomization calls;
  • adding another randomized object;
  • changing constraints or random variable declarations;
  • changing thread/process behavior that affects randomization order;
  • changing testbench code that consumes random values before the failing sequence runs.

Step 8: Use transaction IDs to prove reproduction

The seed alone is a weak debugging artifact. Transaction-level evidence makes reproduction much stronger.

`uvm_info("TX_TRACE",


$sformatf(
"id=%0d addr=0x%0h data=0x%0h kind=%s",
item.id,
item.addr,
item.data,
item.kind.name()),
UVM_HIGH)

After reproducing a failure, compare an early portion of the transaction trace between the regression run and the local run.

Regression:


id=401 addr=0x1000 data=0x35
id=402 addr=0x1004 data=0x17
id=403 addr=0x1010 data=0x91

Reproduction:
id=401 addr=0x1000 data=0x35
id=402 addr=0x1004 data=0x17
id=403 addr=0x1010 data=0x91

If the traces diverge much earlier than the failure, investigate the first divergence rather than the final mismatch.

This connects directly to Lesson 63: waveform debugging is most effective when you already know which transaction and time window matter.

Step 9: Understand common reasons reproduction fails

When the same seed produces a different result, do not immediately conclude that the failure was nondeterministic.

Different test or configuration

The seed is unchanged, but a mode, constraint, interface setting, timeout, or active/passive configuration changed.

Different compiled environment

A modified sequence, driver, monitor, package, DUT, parameter, or generated source can change execution.

Different random consumption

A code change may consume random values in a different order, shifting later randomized behavior.

Uncontrolled external input

File contents, software images, environment variables, external processes, or other inputs may differ.

Concurrency or scheduling changes

Concurrent processes can expose ordering dependencies. A code or timing change can alter which process reaches a randomization point first.

Different simulator or tool configuration

Simulator version, compilation options, runtime options, or supported language semantics can matter when debugging exact behavior.

Key idea: "same seed, different result" is a debugging symptom. It tells you to compare execution context; it does not by itself prove nondeterminism.

Step 10: Reproduce the first useful failure

A long regression can produce many secondary errors after the first fault.

184250 ns  SB_MISMATCH


184260 ns  PROTOCOL_ERROR
184270 ns  UNEXPECTED_RESPONSE
184300 ns  TIMEOUT
184500 ns  TEST FAILED

The most useful reproduction target is usually the earliest meaningful divergence.

Use the following sequence:

  1. Find the first suspicious failure.
  2. Identify its transaction ID, stream, or protocol context.
  3. Locate the corresponding monitor transaction.
  4. Locate the corresponding waveform interval.
  5. Determine the first point where expected and observed behavior diverged.
  6. Preserve that evidence before experimenting with the testbench.

This is the bridge between seed reproduction and the debugging techniques from Lesson 63.

Step 11: Make reproduction part of regression infrastructure

Seed reproduction should not depend on a verification engineer remembering what command they typed several hours earlier.

A useful regression system can expose a compact failure record:

FAILURE ID : REG-2026-00417


TEST       : uart_random_test
SEED       : 18472931
CONFIG     : parity=even, baud=4Mbps
DUT BUILD  : 8f31c2a
SIM        : 
FIRST FAIL : SB_MISMATCH
FAIL TIME  : 184250 ns

REPRO COMMAND:

The exact launcher format depends on the regression infrastructure, but the principle is universal: the information needed to reproduce a failure should be stored with the failure.

Try it yourself

Run a randomized UVM test and intentionally create a reproducible failure in the scoreboard.

  1. Record the test name and initial seed.
  2. Record the relevant configuration and plusargs.
  3. Record the first useful scoreboard failure and its transaction ID.
  4. Rerun using the same test and seed.
  5. Verify that the same transaction sequence reaches the same failure.
  6. Increase UVM verbosity without changing the stimulus.
  7. Compare the first several transaction records between the two runs.

Success criterion: you can demonstrate that the local run reproduces the same failure signature rather than merely producing another failure.

Debugging challenge

Your regression reports:

TEST : packet_random_test


SEED : 927341
FAIL : SB_MISMATCH id=812
TIME : 921400 ns

You rerun seed 927341, but the test passes.

Investigate systematically:

  1. Was the exact same test selected?
  2. Are all relevant plusargs identical?
  3. Did the configuration object contain the same values?
  4. Was the same DUT and testbench build used?
  5. Were external files or software images unchanged?
  6. Was any code modified between runs?
  7. Did a new randomization call or randomized object change random consumption?
  8. Did concurrent processes or scheduling-sensitive code change?
  9. Can you compare transaction traces before transaction 812?

Do not "fix" the reproduction by adding arbitrary delays or random seeds. First identify which part of the execution context differs.

Common mistakes

  • Recording only the seed: the seed is useful, but the complete execution context matters.
  • Changing code before the baseline reproduction: the modification may alter random consumption and hide the original failure.
  • Adding random debug behavior: additional randomization can shift the subsequent random stream.
  • Assuming a passing rerun proves the failure was nondeterministic: first compare the execution contexts.
  • Comparing only final error messages: compare transaction traces and find the first divergence.
  • Ignoring configuration: active/passive mode, protocol settings, constraints, timeouts, and feature enables can affect the scenario.
  • Assuming the seed is a unique bug identifier: the same seed can be used in different tests or configurations and therefore represent different executions.
  • Minimizing before reproducing: changing stimulus before establishing a baseline can make the original failure disappear.

Knowledge check

  1. What information should be captured in addition to the simulation seed?
  2. Why can adding one extra randomize() call change the later randomized stimulus?
  3. Why should the baseline reproduction happen before increasing debug instrumentation that might alter execution?
  4. What evidence can you compare to determine whether two seeded runs actually produced the same scenario?
  5. Why is "same seed, different result" not sufficient evidence of nondeterminism?
  6. How does seed reproduction prepare a failure for Lesson 65, Failure Minimization?
Check your reasoning
  • A useful reproduction record includes the seed plus test, configuration, build/tool context, relevant external inputs, and failure information.
  • Randomization consumes pseudorandom state. Changing when or how values are consumed can shift subsequent values.
  • The baseline establishes that the original failure can still be reproduced before debugging changes are introduced.
  • Transaction IDs, transaction fields, monitor output, assertions, timestamps, and waveform evidence can be compared.
  • Different configuration, code, build, external input, random consumption, or concurrency can explain the difference.
  • Once the failure is reproducible, stimulus can be reduced systematically while checking that the same failure remains.

Key takeaways

  • Reproduce first. A reliable baseline is the foundation for useful debugging.
  • A seed is not the whole run. Test, configuration, build, tool context, and external inputs can all matter.
  • Protect the random stream. Debug changes that consume random values can alter the scenario you are trying to reproduce.
  • Compare evidence. Transaction traces and first-divergence analysis are stronger than comparing final failure messages alone.
  • Preserve the reproduction. Once a failure is reproducible, keep a known-good reproduction before experimenting.
  • Then minimize. Lesson 65 can reduce the reproduced scenario without losing the failure.

What comes next

Lesson 65 — Failure Minimization builds directly on this workflow. Once you can reliably reproduce a failure, the next skill is reducing the test, sequence, transaction set, configuration, or timing window until the smallest useful reproducer remains.

The goal is not simply a shorter test. The goal is a smaller scenario that still demonstrates the same underlying failure.