Constrained Random Generation (CRG)
Definition
Constrained Random Generation (CRG) is a powerful and scalable test generation technique that has been shown to be very effective in many different application areas. Rather than relying on fully random stimulus, CRG works by specifying and solving constraints to generate new tests in a structured approach, yielding better results than pure randomized generation.
Role in Verification Flows
CRG is a central building block of a Constrained Random Verification (CRV) framework. Within a CRV flow:
- Tests are generated by specifying and solving constraints over the space of valid stimuli.
- Coverage information is tracked during the run and is utilized to measure the verification progress as well as to assess the verification quality.
By combining constraint-based generation with coverage feedback, CRV (powered by CRG) can direct stimulus generation toward hard-to-reach corner cases and report meaningful progress metrics.
Application Areas
According to the literature, CRG has been demonstrated as effective in a range of application areas, including:
- Functional verification of hardware designs.
- Validation of power management functionality.
- Error resiliency evaluations.
Concrete Implementations
- RISC-V DV is a powerful CRV framework, actively developed by Google and tailored for RISC-V, that implements Constrained Random Generation. It leverages SystemVerilog and the Universal Verification Methodology (UVM) to generate tests in assembly format based on randomized instruction streams, supporting the complete 32- and 64-bit standard RISC-V instruction set extensions. Generated tests are executed on both a reference system and the system under test (a high-level simulator or RTL core), and the outputs are compared to enable an end-to-end verification flow. RISC-V DV is designed as a configurable framework that can be adapted to different verification needs.
Relationship to Constrained Random Verification (CRV)
While CRG focuses on the generation step — producing valid, structured stimuli by solving constraints — it is normally embedded inside a larger Constrained Random Verification (CRV) methodology, which adds the surrounding infrastructure for self-checking, reference comparison, coverage collection, and result analysis.