Abstract
Functional verification constitutes one of the most challenging tasks in the development of modern hardware systems, and simulation-based verification techniques dominate the functional verification landscape. A dominant paradigm in simulation-based verification is directed random testing, where a model of the system is simulated with a set of random test stimuli that are uniformly or near-uniformly distributed over the space of all stimuli satisfying a given set of constraints. Uniform or near-uniform generation of solutions for large constraint sets is therefore a problem of theoretical and practical interest. For Boolean constraints, prior work offered heuristic approaches with no guarantee of performance, and theoretical approaches with proven guarantees, but poor performance in practice. We offer here a new approach with theoretical performance guarantees and demonstrate its practical utility on large constraint sets.
Introduction
In the world of hardware development, functional verification ensures that a chip design behaves exactly as intended. Because modern designs are too complex to check every possible state, engineers rely on directed random testing. This process involves feeding the design random stimuli that satisfy specific constraints. For this testing to be effective, stimuli must be sampled uniformly; if a generator is biased toward "easy" solutions, it will repeatedly test the same design areas, leaving critical corner cases hidden.
Generating uniform solutions for these constraints is a "Goldilocks" problem: the solution must be mathematically sound (nearly uniform) yet fast enough to handle massive, real-world industrial problems where the solution space can reach $2^{100}$.
The Limitations of Existing Approaches
Prior to this work, solution generators fell into two unsatisfactory categories:
- Heuristics: These tools are fast and scalable but offer no mathematical guarantees. They often "clump" around specific solutions, leaving vast portions of the state space unexamined.
- Theoretical Algorithms: Frameworks like the BGP algorithm provide proven guarantees but are computationally prohibitive. They rely on complex mathematics that causes them to fail on formulas with more than a few dozen variables.
The UniWit Approach
Presented at CAV 2013, UniWit (Uniform Witness generator) re-engineers the theoretical BGP algorithm to make it practical for industrial use. It achieves this through three primary technical innovations:
1. XOR-Based Linear Hashing
The core strategy involves using hash functions to partition the massive solution space into small "cells." While BGP used complex n-wise independent hashes, UniWit utilizes pairwise independent XOR-based hashes. These are significantly easier for modern SAT solvers—specifically those like CryptoMiniSAT that are optimized for parity constraints—to process.
2. The Pivot Optimization
BGP required checking cells until they contained a very large number of solutions (roughly $2n^2$). For a problem with 1,000 variables, this would require finding 2 million solutions per cell, which is computationally exhausting. UniWit proves that a much smaller "pivot" (roughly $2n^{1/k}$) can be used while still maintaining near-uniformity guarantees.
3. Leapfrogging
To isolate a solution, the algorithm must determine how many constraints to add to a cell. The authors observed that this number is relatively consistent for a given formula. "Leapfrogging" uses the results of initial runs to estimate the correct number of constraints for subsequent runs, skipping redundant computational steps.
Experimental Results
The authors evaluated UniWit on over 200 benchmarks, including bit-blasted VHDL designs, SMTLib bit-vector benchmarks, and ISCAS’85 circuits. The problems ranged in size from a few hundred to over 7,600 variables.
- Speed: UniWit consistently outperformed
XORSample', the previous state-of-the-art for near-uniform sampling, by 2 to 3 orders of magnitude. For example, on thecase_3_b14benchmark, UniWit found a witness in 19 seconds, whileXORSample'required over 4 hours. - Quality and Uniformity: In tests with 16,384 known solutions, UniWit successfully identified every single one. In contrast, previous heuristics missed hundreds of solutions and showed high variance in selection frequency.
- Scalability: While the original BGP algorithm typically fails on formulas with 50 variables, UniWit successfully handled benchmarks with over 7,000 variables.
Conclusion and Future Work
UniWit represents the first practical algorithm for near-uniform SAT witness generation that scales to industrial-sized formulas. By bridging the gap between theoretical rigor and computational efficiency, it provides a robust tool for hardware verification. Future research directions include refining the $k$ parameter for automated tuning and extending the framework to Satisfiability Modulo Theories (SMT) to handle complex data types like integers and real numbers directly.
Summary updated