Overview
Constrained random instruction generation is a verification approach in which a test generator produces randomized instruction streams while respecting constraints. In the cited processor-verification flow, the generator creates instruction streams "based on constraints" or on coverage goals, rather than emitting unconstrained inputs.
Role in simulation-based processor verification
The cited flow places constrained random instruction generation at the front of a three-phase verification pipeline:
- A test case generator randomly generates instruction streams based on constraints or coverage.
- An RTL simulator translates the processor RTL into a software model and compiles it together with a test harness into a host executable.
- Correctness is checked by comparing the processor under test with a golden reference model at the level of externally visible architectural state.
This makes constrained random generation the stimulus-production stage for differential checking between a design under test and a reference ISA model.
RISC-V encoding context
The cited paper also outlines the RISC-V instruction-encoding structure that such generation must respect:
- RISC-V instructions have two valid lengths in the described setting: 16-bit compressed instructions and 32-bit instructions.
- For 32-bit instructions, the format is determined by the opcode field; for 16-bit instructions, the op and funct fields determine the format.
- Instruction fields are divided into opcode-related fields and operand-related fields.
- The funct and opcode fields determine the instruction operation or opcode type, while rs, imm, and rd fields provide source registers, immediate values, and the destination register.
These encoding rules illustrate why instruction generation is typically constrained: randomization must still produce instruction streams whose encodings and operands are meaningful to the target ISA and verification flow.