Skip to content
STIMSMITH

Scenario Generator

Concept WIKI v1 · 5/28/2026

A scenario generator is a verification testbench component that selects and randomizes scenario objects to produce processor stimulus. In the cited constrained-random verification flow, it can operate over constrained-random, directed-random, and directed scenarios, repeating selection and randomization until a user-specified stopping condition is reached.

Definition

A scenario generator is a testbench stimulus-generation component that operates on a set of scenario objects. In the described processor verification approach, the generator randomly selects and randomizes one scenario from the available set, then repeats that process until a user-specified condition is reached.[1]

Role in stimulus generation

The scenario generator is part of a controllable stimulus-generation strategy. Both the test scenarios and the generator itself should be controllable so that verification engineers can generate stimuli with varying levels of randomness.[2]

The evidence describes scenario contents using SystemVerilog: an instruction scenario can be represented as a dynamic array of instruction objects, and SystemVerilog foreach array constraints can be used to express scenario-level constraints.[2]

Supported scenario styles

The cited flow describes three scenario styles that a scenario generator can work with:

  • Constrained-random scenarios: scenarios constrained to focus the generated instruction stream. For example, a long arithmetic-focused sequence can constrain operations to the computational kind, excluding branches, loads, and stores.[3]
  • Directed-random scenarios: scenarios that combine directed setup with randomized execution. For processor arithmetic testing, the cited example preloads data memory with special values such as walking 0/1 patterns and values near zero or near minimum and maximum numbers, then reads those values before executing an arithmetic instruction stream.[4]
  • Directed scenarios: scenarios used to cover specific functionality. The cited example implements a scenario class that reads a pre-assembled program as a directed scenario; a common scenario class method can load a directed scenario from a file containing a pre-assembled program trace.[5]

Use in processor verification

In processor constrained-random verification, scenario generation must account for architectural and boundary-condition constraints. The evidence gives an example involving backward branches: the testbench must prevent invalid or unhelpful cases such as a branch that is always taken because an operand has the smallest possible number, and must ensure loop-related registers are not modified elsewhere in the loop.[6]

The overall approach combines constrained-random stimulus with support for directed-random and directed stimulus. This helps address limitations of traditional directed tests while still allowing reuse of directed stimuli, such as tests leveraged from a processor software team.[5][7]

CITATIONS

7 sources
7 citations
[1] A scenario generator works over a set of scenario objects by randomly selecting and randomizing one scenario, repeating until a user-specified condition is reached. Applying constrained-random verification to microprocessors
[2] Test scenarios and the scenario-generator component should be controllable to generate stimuli with varying levels of randomness; SystemVerilog constraints and foreach array constraints can describe instruction-scenario constraints. Applying constrained-random verification to microprocessors
[3] A constrained-random scenario can constrain a long sequence to computational operations, excluding branches, loads, and stores. Applying constrained-random verification to microprocessors
[4] A directed-random scenario can preload data memory with special values, such as walking 0/1 patterns and values near zero or near min/max numbers, before executing arithmetic instructions. Applying constrained-random verification to microprocessors
[5] Directed scenarios can cover specific functionality by reading a pre-assembled program or program trace from a file, including leveraged tests from a processor software team. Applying constrained-random verification to microprocessors
[6] Processor scenario generation must consider boundary conditions for branches, including avoiding cases such as a backward branch that is always taken and ensuring loop-related registers are not modified elsewhere in the loop. Applying constrained-random verification to microprocessors
[7] The described constrained-random verification approach supports directed random and directed stimulus to overcome limitations of traditional directed tests while supporting testbench reuse. Applying constrained-random verification to microprocessors