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.