Skip to main content

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.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for dv-solve 0.4.1
File Actions
dv_solve-0.4.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for dv_solve-0.4.1-py3-none-win_amd64.whl
dv_solve-0.4.1-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details for dv_solve-0.4.1-py3-none-manylinux_2_34_x86_64.whl
dv_solve-0.4.1-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details for dv_solve-0.4.1-py3-none-manylinux_2_34_aarch64.whl
dv_solve-0.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.26+ x86-64 Details for dv_solve-0.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
dv_solve-0.4.1-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for dv_solve-0.4.1-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
dv_solve-0.4.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for dv_solve-0.4.1-py3-none-macosx_11_0_arm64.whl
dv_solve-0.4.1-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for dv_solve-0.4.1-py3-none-macosx_10_9_x86_64.whl

Total release size: 42.9 MB

Release files / dv_solve-0.4.1-py3-none-win_amd64.whl

Download URL dv_solve-0.4.1-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6e767bcb6a187d86a77e9265933db8298353ba6c2af9161018c15404dfe56f28
BLAKE2b-256 checksum
How to use checksums
ab1a4ae523d15b0c1ced48eb295a03163799896cf9cb8493d705252d9357e62d
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.4.1-py3-none-manylinux_2_34_x86_64.whl

Download URL dv_solve-0.4.1-py3-none-manylinux_2_34_x86_64.whl
Size 5.4 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
73bce1da5eff671c292e6b711be4f88a36cc314ef0d2dd2bee214b7ee2efa286
BLAKE2b-256 checksum
How to use checksums
6dfffa38d36e098fcc113dfaf64057d20b224cb662a09eecbe8b4e574be7ce2b
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.4.1-py3-none-manylinux_2_34_aarch64.whl

Download URL dv_solve-0.4.1-py3-none-manylinux_2_34_aarch64.whl
Size 5.1 MB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
5ab4028cb275ab9f45f45ee05848c079f369f4dda2abe5ff74c3ba69890db829
BLAKE2b-256 checksum
How to use checksums
b995fef69ab21b4bad7b12266fa1302bf1478ca4d700b12cf886182b25ab3500
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.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL dv_solve-0.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 5.4 MB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
10deabbd5f570e185eae371cee9778af21c71b63a8b664ad4ade65e198fcc8f7
BLAKE2b-256 checksum
How to use checksums
764b8077da077140951f7f734baa153d7fd7451a56f75c2f413870a8128ca007
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.4.1-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL dv_solve-0.4.1-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 5.1 MB
Tags Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
7ea5a39cf734dfe117a5664fad883d2dc5da08436156273c77c91604662b96ca
BLAKE2b-256 checksum
How to use checksums
b8f2227efc3d62bf7761b045bf8bc190afddc24edeef8fc1cbfc003d33a92280
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.4.1-py3-none-macosx_11_0_arm64.whl

Download URL dv_solve-0.4.1-py3-none-macosx_11_0_arm64.whl
Size 9.2 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
46d70121a9f5e22a24d947091a82ef57a9bbbb70aed2eb99b4cf405a7f9048d7
BLAKE2b-256 checksum
How to use checksums
76f8897463c1df4fa0ddec337f2b2243df7fa62ca7264346a5b0d17b451aba4e
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.4.1-py3-none-macosx_10_9_x86_64.whl

Download URL dv_solve-0.4.1-py3-none-macosx_10_9_x86_64.whl
Size 8.7 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
766400d61510d5b59058037e09fb2732571e46efff25a5217e739ddbcb6ae26a
BLAKE2b-256 checksum
How to use checksums
eb289f06887acf1a7e2d8e4633c25c95aa48e063b47b47db5fd348b1caa4e007
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for dv-solve 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page