Skip to content
STIMSMITH

SystemVerilog Random Sequence Construct

Concept WIKI v1 · 5/26/2026

The SystemVerilog random sequence construct is described in the evidence as the upper layer of a constrained-random opcode generator architecture, where weighted knobs control the distribution of high-level generated items. In the cited AMD/Synopsys microcode-stimulus generator, this construct works with a lower opcode-class layer randomized under additional constraints and weights.

Overview

The SystemVerilog random sequence construct is used in the cited generator architecture as a high-level mechanism for controlling randomized stimulus generation. In the AMD/Synopsys microcode-stimulus generator, the opcode generator has two layers: an upper layer implemented with a SystemVerilog random sequence construct, and a lower layer made up of an opcode class that is randomized with additional constraints and weights supplied by the upper layer. [C1]

Role in constrained-random stimulus generation

The evidence places the construct in the context of automated random test generation for microprocessor verification. As designs became more complex, hand-written directed tests were increasingly replaced by automated random test generators intended to cover stimulus space more efficiently. These generators create microcode test sequences and emphasize distribution across meaningful opcode values and instruction attributes. [C2]

Within that environment, SystemVerilog constraint-language constructs provide a concise way to describe microcode instructions by their possible attribute combinations and to control value distributions for individual fields. [C3]

Generator architecture

In the described two-layer architecture:

  • The upper layer uses a SystemVerilog random sequence construct with weighted knobs to control the distribution of high-level items.
  • The lower layer is an opcode class randomized with additional constraints and weights from the upper layer.
  • Tests provide weighted values that direct the generator toward the required instruction mix.
  • The constraint solver applies those weights to the generator layer to control the distribution of generated opcode types. [C1]

Relationship to opcode-class randomization

The random sequence construct is presented alongside class-based constrained randomization. A simple single-class generator can place all opcode constraints in one class, which allows constraints between any class data members but may slow randomization because the solver receives many random variables and a large constraint set. The cited example reports an opcode class with approximately 100 random variables and 800 constraint equations. [C4]

The evidence also describes a hierarchical object-oriented approach in which global constraints are placed in a base class and related opcodes are modeled in derived subclasses. Partitioning constraints into smaller opcode groups reduced memory requirements and improved performance. [C5]

Practical significance

In the cited use case, the SystemVerilog random sequence construct is significant because it provides a high-level weighted control point for the generator, while the lower opcode class and constraint solver handle legality and detailed field constraints. This combination supports distribution control and biasing toward desired instruction mixes or corner cases within a constrained-random verification flow. [C1][C2]

CITATIONS

5 sources
5 citations
[1] The opcode generator has an upper layer implemented using a SystemVerilog random sequence construct with weighted knobs, and a lower opcode-class layer randomized with additional constraints and weights. Generating AMD microcode stimuli using VCS constraint solver
[2] Automated random test generators are used to create microcode test sequences and distribute stimuli across meaningful opcode and instruction-attribute values. Generating AMD microcode stimuli using VCS constraint solver
[3] SystemVerilog constraint-language constructs provide a concise format for describing microcode instruction attribute combinations and controlling value distributions for fields. Generating AMD microcode stimuli using VCS constraint solver
[4] A single-class opcode generator is flexible but can be slow because the solver sees many random variables and constraints; the cited opcode class had about 100 random variables and 800 constraint equations. Generating AMD microcode stimuli using VCS constraint solver
[5] Using a base class with global constraints and subclasses for related opcode groups partitioned constraints hierarchically, reducing memory requirements and increasing performance. Generating AMD microcode stimuli using VCS constraint solver