Directed Test Generation
Overview
Directed test generation is the use of intentionally targeted stimulus to exercise specific design features, architectural behaviors, or known coverage gaps. In RISC-V processor verification, directed tests are used alongside constrained-random tests because each approach covers different verification needs: random stimulus explores broad and unexpected state spaces, while directed tests provide structure and precision for requirements that random generation may not fully exercise. [C1]
The evidence describes directed generation as part of a hybrid verification strategy: constrained-random stimulus is used for discovery, and directed suites are used for targeted closure and compliance-oriented validation. [C2]
Why directed tests are needed
Random testing is effective for uncovering unanticipated behavior, but random stimulus alone can leave important architectural areas insufficiently exercised. Examples called out in the evidence include privilege-mode transitions, page-table walks, and memory protection. [C3]
Directed tests address this by systematically targeting such features. However, directed suites also have a limitation: because they are structured around known scenarios, they may miss subtle unexpected interactions. The recommended strategy is therefore not directed-only testing, but a combined flow in which random testing discovers unexpected behavior and directed tests close specific coverage or compliance gaps. [C1]
Directed generation with STING
STING is described as a RISC-V bare-metal functional verification tool that supports both constrained-random and directed stimulus. It produces C++-based random streams and ASM-style directed tests, and includes a programming framework for developing directed tests. It also uses stimulus graphs to control scheduling of both random and directed tests. [C4]
The generated programs are portable across simulation, emulation, FPGA prototypes, and silicon, and are architecturally self-checking. This portability supports reuse of directed and random stimulus across multiple verification stages. [C5]
Directed suites with ImperasTS
ImperasTS is presented as a family of directed RISC-V test suites used to address gaps found during coverage analysis. The evidence identifies several suite categories:
- TS-ISA: architectural validation tests similar to compliance suites, included with ImperasDV licences.
- TS-VECT: targeted suites for vector extensions.
- TS-MMU / PMP / ePMP: directed suites for virtual memory and protection features. [C6]
These suites are configured to match the user’s RISC-V processor and are used where random stimulus often leaves gaps. The evidence gives an example in which coverage analysis found weak points in Sv39 and Sv48 page-table walks; adding TS-MMU tests exposed an ordering issue in TLB flush logic. [C7]
Role in coverage closure
Directed test generation is used as part of an iterative coverage-closure flow. A typical workflow begins with constrained-random sweeps using STING, followed by functional coverage analysis using ImperasFC, which generates SystemVerilog coverage models from the ISA specification. Coverage gaps are then highlighted and closed with directed stimulus or directed suites. [C8]
Coverage analysis can also begin before RTL using ImperasSC, enabling a shift-left verification approach. Once RTL is available, coverage results can be merged in Verdi, and failing cases can be replayed deterministically in VCS. [C9]
Integration with reference models and execution platforms
Directed tests are most effective when integrated with simulation, debug, reference-model comparison, and hardware-assisted validation platforms. The evidence states that generated programs can run in simulators such as VCS, with Verdi used for centralized debug. ImperasDV provides lock-step comparison against a reference model at instruction retirement, helping catch errors early. The same stimulus can also be reused in ZeBu emulation or HAPS prototyping, extending validation to system-level workloads. [C10]
Benefits
A hybrid approach that includes directed test generation provides several reported benefits:
- Faster coverage closure by combining random exploration with precise directed tests.
- Improved debug efficiency through self-checking tests and lock-step comparison.
- Scalability from embedded cores to multi-hart systems.
- Reproducibility through logged seeds and directed reruns.
- Portability across simulation, emulation, FPGA prototyping, and silicon.
- Support for verification of RISC-V profiles and privilege-related features such as MMU, PMP, hypervisor, and vector extensions. [C11]
Practical use pattern
A practical directed-generation workflow is:
- Start with broad constrained-random stimulus to find unexpected behavior.
- Analyze functional and stimulus coverage.
- Identify uncovered or weakly covered architectural features.
- Add directed tests or targeted directed suites for those gaps.
- Run with reference-model comparison and debug tooling.
- Replay failures deterministically and iterate until coverage closure is achieved. [C8] [C9] [C10]