Overview
Illegal opcode injection is a stimulus-generation technique used in constrained-random microprocessor verification. The technique deliberately creates an instruction operation with an opcode value that is not assigned by the processor ISA, causing the operation to be illegal so that the processor's exception behavior can be tested.
Modeling approach
In the cited verification approach, the operation/opcode class is extended with an additional operation kind named ILLEGAL. This ILLEGAL value is added to the enumerated kind property alongside other operation kinds. When constrained randomization selects ILLEGAL, the generator uses a random unassigned opcode value, making the generated operation illegal for exception testing.
Verification purpose
Processors support exceptions so software can handle conditions such as illegal opcodes and watchpoints. Illegal opcode injection targets this mechanism by creating illegal instruction encodings intentionally, allowing verification environments to exercise the processor's illegal-opcode exception path rather than relying on accidental generation of such cases.
Relationship to constraint control
The same constrained-random verification style also uses independently controllable constraint blocks to enforce or violate processor rules. Although the evidence gives separate examples such as slot-placement rules for load/store operations and exception-return instructions, the common verification pattern is that constraints can be adjusted to generate legal instructions or intentionally create exception-triggering cases.