Skip to content
STIMSMITH

Program Trace

Concept WIKI v2 · 6/1/2026

In the cited microprocessor constrained-random verification approach, a program trace is the main stimulus for the design under test. It is defined as a collection of one or more instruction scenarios and is used to organize more useful, processor-aware stimulus than pure random instruction streams typically provide.

Definition

In the cited constrained-random verification (CRV) approach for microprocessors, a program trace is the main stimulus for the design under test (DUT). The source describes it as a collection of one or more instruction scenarios, with program traces built from operations, instructions, and scenarios.

Purpose in verification

The source argues that pure random instructions rarely create useful stimulus for important processor behaviors such as branches, jumps, and exceptions. A program trace provides higher-level structure for stimulus generation so that generated instruction streams are more likely to exercise meaningful processor behavior.

Typical contents

Example scenarios within a program trace include:

  • generic boot code with an exception handler;
  • instructions that program internal configuration registers with dynamic contents, such as for hardware watchpoints;
  • instruction groups containing load/store, arithmetic, and branch operations;
  • nested branch loops; and
  • exception conditions introduced at random inside scenarios.

Branch-oriented program traces

The cited source uses a sample program trace containing both a forward BEQ branch and a backward BNE branch to illustrate why unconstrained random register values are often ineffective.

For forward branches, the approach increases the probability that the branch is taken by constraining the operation immediately before the branch to be an ADDI with the same operands and a small immediate value.

For backward branches, the branch is handled as a loop scenario. The source recommends constraining the operation preceding the backward branch to be an ADDI with the same operands and a small negative value, incrementing that operand inside the loop just before the branch, and ensuring that the two compared registers are not modified elsewhere in the loop. This avoids absurdly long or endless loops while still creating multiple loop-length cases.

Exceptions and constraints

Exception planning is described as an early stimulus-generation concern. The source says planning should cover both whether a specific exception cause occurs and how often it occurs, and should also include simultaneous exception conditions to exercise exception priority and handling. It also notes that scenario-level constraints such as memory-alignment rules can be selectively disabled so that exception-causing cases appear during randomized scenario generation.

Directed as well as random use

Although program traces are central to constrained-random stimulus, the same environment also supports directed use. The source describes a class method that can load a directed scenario from a file containing a pre-assembled program trace, which is useful for directed stimuli such as leveraged tests from a processor software team.

CITATIONS

8 sources
8 citations
[1] Program trace is the main stimulus for the DUT and is a collection of one or more instruction scenarios. Applying constrained-random verification to microprocessors
[2] Pure random instructions rarely create useful stimulus for branches, jumps, and exceptions, motivating structured program traces. Applying constrained-random verification to microprocessors
[3] Example contents of a program trace include boot code, configuration-register programming, mixed load/store-arithmetic-branch instruction groups, nested branch loops, and randomly introduced exception conditions. Applying constrained-random verification to microprocessors
[4] A sample program trace contains a forward BEQ branch and a backward BNE branch, showing why unconstrained random register values are ineffective. Applying constrained-random verification to microprocessors
[5] Forward branch scenarios can be improved by constraining the preceding operation to be an ADDI with the same operands and a small immediate value. Applying constrained-random verification to microprocessors
[6] Backward branch scenarios can be constrained as loop scenarios by using a preceding ADDI with a small negative value, incrementing the loop index inside the loop, and preventing other loop instructions from modifying the compared registers. Applying constrained-random verification to microprocessors
[7] Exception planning should cover both occurrence and probability of specific exception causes and include simultaneous exception conditions to test priority and handling. Applying constrained-random verification to microprocessors
[8] A directed scenario can be loaded from a file containing a pre-assembled program trace for directed stimulus. Applying constrained-random verification to microprocessors

VERSION HISTORY

v2 · 6/1/2026 · gpt-5.4 (current)
v1 · 5/28/2026 · gpt-5.5