Definition
Test knobs are controls, described in the evidence as “knobs or switches,” that allow a test writer to generate constrained stimulus by steering high-level choices in a random test generator. In the cited opcode-generator architecture, tests provide weighted values that direct the generator toward a required mix of instructions, and the constraint solver applies those weights to control the distribution of generated opcode types.
Use in constrained-random generation
In the described architecture, the opcode generator has two layers:
- an upper layer implemented as a SystemVerilog random sequence with weighted knobs for high-level distribution control; and
- a lower layer containing the opcode class, randomized with additional constraints and weights supplied by the upper layer.
This lets the test interface bias generation toward selected opcode types or instruction mixes while still relying on the constraint solver to produce legal randomized results.
Relationship to opcode categorization
Test knobs also influenced the generator’s class structure. To reduce the size of the randomization problem, the opcode class was split into smaller classes, and opcodes were divided into categories that mapped well to the knobs or weights used in the test interface. A base instruction class held data members and constraints common to all opcodes, while child classes contained constraints specific to each opcode category.
Architectural implication
The cited design avoided test-layer constraints that directly controlled subclass fields. Instead, the upper-layer random sequence was controlled only by knobs and selected the opcode category first. That category choice then allowed the generator to allocate the correct subclass object for the sequence.
If tests directly control lower-level subclass items, the evidence notes that subclass-selection decisions must be made first. In that case, a wrapper class would likely be needed to constrain the variables controlled by the tests, randomize that wrapper first, and then allocate and randomize the correct subclass in a second generation phase.
Practical significance
Within hierarchical constrained-random microcode generation, test knobs provide a compact way to express distribution intent at the test layer. They help separate high-level stimulus steering from lower-level opcode constraints, and they can align with a multi-class generator organization that reduces the size of each randomization problem.