dv-solve
dv-solve is a constraint solver for design verification. It finds values for
bit-vector variables that satisfy a set of constraints, and when asked for many
solutions it spreads them across the solution space. That suits it both to
constrained-random stimulus generation and to answering yes/no questions from
formal tools. Answers are sound: sat and unsat are definitive, and when
dv-solve can't decide a problem it says unknown rather than guessing.
Documentation: https://dvkit.org/fvutils/dv-solve/
Ways to use it
| If you are... | Use | Start here |
|---|---|---|
| Building constraint problems from Python | the dv_solve package |
Python quick start |
| Running SMT-LIB2 files, or plugging a solver into a tool that speaks SMT-LIB2 | the dv-solve-smt2 executable |
SMT-LIB2 quick start |
| Randomizing SystemVerilog classes in Verilator | dv-solve-smt2 as Verilator's constraint solver |
Verilator quick start |
| Randomizing from SystemVerilog through DPI, on any simulator | dvs_dpi_pkg and libdv_solve_dpi |
DPI guide |
| Embedding the solver in a C or C++ program | libdv_solve and dv_solve.h |
C API |
Install
pip install dv-solve
The wheel holds the Python package, the native libraries, the C header, the
SystemVerilog packages and the dv-solve-smt2 executable, which pip puts on
PATH:
dv-solve-smt2 --version
To build everything from source instead:
cmake -S . -B build -DDVS_WITH_CADICAL=OFF
cmake --build build
See Installation for the details, including the optional CaDiCaL back end.
To develop in a checkout, set up the workspace with IVPM and build in place:
ivpm update -d dev
packages/python/bin/python setup.py build_ext --inplace
That fetches CaDiCaL and the Python environment into packages/, then builds
the libraries into build/lib and dv-solve-smt2 into build/bin. The
dv_solve package in src/ loads the library from build/lib.
Quick start
from dv_solve.builder import SolveProblemBuilder
from dv_solve.ctx import SolveCtx, SOLVE_OK
from dv_solve.problem import BIN_GT
b = SolveProblemBuilder()
X = 0
b.add_var(X, width=8, is_signed=False, lo=0, hi=255)
b.add_constraint(b.expr_binary(BIN_GT, b.expr_var(X), b.expr_const(100)))
problem, _ = b.finalize()
with SolveCtx(problem) as ctx:
assert ctx.solve(seed=1, fair_pick=True) == SOLVE_OK
print("x =", ctx.get_value(X))
Public API
| Module | Purpose |
|---|---|
dv_solve.builder |
SolveProblemBuilder: declare variables and constraints |
dv_solve.ctx |
SolveCtx: compile and solve; status codes and exceptions |
dv_solve.problem |
operator constants (BIN_*, UN_*) |
dv_solve |
get_libs(), get_libdirs(), get_incdirs(), get_svdirs(), get_dpi_lib() for build systems |
Other modules are internal and may change. The C API is the one header
dv_solve.h; other installed headers are internal. See the
reference.
License
Apache-2.0.
Metadata
Release files for dv-solve 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| dv_solve-0.2.3-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| dv_solve-0.2.3-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details |
| dv_solve-0.2.3-py3-none-manylinux_2_34_aarch64.whl | Python 3 | none | Linux glibc 2.34+ ARM64 | Details |
| dv_solve-0.2.3-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| dv_solve-0.2.3-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64, Linux glibc 2.24+ ARM64 | Details |
| dv_solve-0.2.3-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| dv_solve-0.2.3-py3-none-macosx_10_9_x86_64.whl | Python 3 | none | macOS 10.9+ x86-64 | Details |
Total release size: 36.5 MB
Release files / dv_solve-0.2.3-py3-none-win_amd64.whl
| Download URL | dv_solve-0.2.3-py3-none-win_amd64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
da4ca9bd5db2937c92d9b9c4dbb140742823aab72b7bbd6116c49c00439ca468
|
|
BLAKE2b-256 checksum How to use checksums |
66cab78031995045612152228962354bde854c770ea29b5e9c7aa0764582f6fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dv_solve-0.2.3-py3-none-manylinux_2_34_x86_64.whl
| Download URL | dv_solve-0.2.3-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f2ef6fb7d064bea0f306c77ce3e8b3ed486f833848f3f90a1b14efd9731e6e71
|
|
BLAKE2b-256 checksum How to use checksums |
b5b0be998747cdc958eb654eb0a315c6c3011a7a68519e936b5b90a8f1c9c6a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dv_solve-0.2.3-py3-none-manylinux_2_34_aarch64.whl
| Download URL | dv_solve-0.2.3-py3-none-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Linux glibc 2.34+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
6055b46e25af2c79433a08917044875c87624e0f15cdb430145ddf088d1de0bd
|
|
BLAKE2b-256 checksum How to use checksums |
e8e5bc56854dd08aae90bb6e47b724c13a11951b7f9b8756f2feb9606f6ac112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dv_solve-0.2.3-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | dv_solve-0.2.3-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
9ad10157b26758a2d92651cb0d0ba49c2a9a68879455660a7587413e029ca857
|
|
BLAKE2b-256 checksum How to use checksums |
52a3b5d1710931163536cb240f90a20734ecff588a5e20bf10995e87f7353d29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dv_solve-0.2.3-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | dv_solve-0.2.3-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
f9dac3c86e22415d64998963f3f6cad7cf667a7bc48174cea7514b2275923258
|
|
BLAKE2b-256 checksum How to use checksums |
8509c07c666fae52e15aa8946e0bc5d0bd5d023978e863020e15230ff804795c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dv_solve-0.2.3-py3-none-macosx_11_0_arm64.whl
| Download URL | dv_solve-0.2.3-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d3fd5e669c1051bef4a047f061201cca6feb2c64de4a14d99893b8382a4f67b9
|
|
BLAKE2b-256 checksum How to use checksums |
267d13c9cebe0902c442ce1f9d80205e0bcdf9a8805ca413a62a2a9414f0b3a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dv_solve-0.2.3-py3-none-macosx_10_9_x86_64.whl
| Download URL | dv_solve-0.2.3-py3-none-macosx_10_9_x86_64.whl |
|---|---|
| Size | 7.6 MB |
| Tags | Python 3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
9c17695b488aa0c384eafce9c4ad7c718402c8f695dd4447d447d8091579da7c
|
|
BLAKE2b-256 checksum How to use checksums |
dea32c653cba282e3a964d48da73978c65a5da54fb741f4f009af31d9591ceff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|