Skip to content
STIMSMITH

Weighted Knobs

Concept WIKI v1 · 5/26/2026

Weighted knobs are test-level weighted controls used in a hierarchical constrained-random microcode instruction generator to bias the distribution of generated opcode categories and instruction mixes.

Definition

Weighted knobs are weighted values exposed at the test or upper-sequence layer of a constrained-random instruction generator. In the described AMD/Synopsys microcode stimulus generator, tests used these weighted values to direct the generator toward a required mix of instructions, and the constraint solver applied the weights to control the distribution of opcode types that were created.

Role in generator architecture

The opcode generator used a two-layer structure:

  • Upper layer: implemented with a SystemVerilog random sequence construct using weighted knobs to control distribution of high-level items.
  • Lower layer: an opcode class randomized with additional constraints and weights supplied by the upper layer.

This organization allowed the test to express distribution intent through weighted controls rather than by directly constructing every instruction field.

Relationship to opcode categories

In the multi-class randomization approach, opcode handling was split into smaller classes to reduce the size of the constraint-solving problem. The opcodes were divided into categories that mapped well to the knobs or weights used in the test interface. The upper-layer random sequence selected the opcode category first using knobs, which allowed the generator to allocate the correct subclass object for the sequence.

Architectural implications

The described architecture avoided having the test layer directly constrain items inside lower-level subclasses. Instead, the upper layer was controlled only by knobs and selected the opcode category before allocating the corresponding object type.

If tests directly controlled lower-level items, the evidence indicates that decisions about which subclass to randomize would need to be made first. In that case, a wrapper class would likely be required to constrain variables controlled by tests, randomize the wrapper first, and then allocate and randomize the correct subclass in a second generation phase.

Verification use

Weighted knobs support constrained-random verification by giving tests a concise way to bias instruction generation. In the cited generator, this supported distribution control across opcode types and worked with hierarchical constraint partitioning, where common opcode constraints were placed in a base class and opcode-specific constraints were placed in child classes.

CITATIONS

7 sources
7 citations
[1] Weighted knobs controlled high-level distribution in the generator upper layer Generating AMD microcode stimuli using VCS constraint solver
[2] Tests used weighted values to direct the generator to the required instruction mix Generating AMD microcode stimuli using VCS constraint solver
[3] The constraint solver applied weights to control distribution of generated opcode types Generating AMD microcode stimuli using VCS constraint solver
[4] Opcode categories in the multi-class generator mapped to knobs or weights in the test interface Generating AMD microcode stimuli using VCS constraint solver
[5] The upper-layer random sequence was controlled by knobs only and chose the opcode category first Generating AMD microcode stimuli using VCS constraint solver
[6] Direct test-layer control of lower-level subclass items would likely require a wrapper class and two-phase generation Generating AMD microcode stimuli using VCS constraint solver
[7] Hierarchical partitioning of opcode constraints into base and subclasses reduced memory requirements and increased performance Generating AMD microcode stimuli using VCS constraint solver