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

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.5.0
File Actions
dv_solve-0.5.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for dv_solve-0.5.0-py3-none-win_amd64.whl
dv_solve-0.5.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details for dv_solve-0.5.0-py3-none-manylinux_2_34_x86_64.whl
dv_solve-0.5.0-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details for dv_solve-0.5.0-py3-none-manylinux_2_34_aarch64.whl
dv_solve-0.5.0-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.5.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
dv_solve-0.5.0-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.5.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
dv_solve-0.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for dv_solve-0.5.0-py3-none-macosx_11_0_arm64.whl
dv_solve-0.5.0-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for dv_solve-0.5.0-py3-none-macosx_10_9_x86_64.whl

Total release size: 45.1 MB

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

Download URL dv_solve-0.5.0-py3-none-win_amd64.whl
Size 4.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bc7d612a4ff16120f90a16b9c21e82f581ae0133d7cd2b8bc61670db20347212
BLAKE2b-256 checksum
How to use checksums
990369f2f02bd4b48e37c2152f19b64c48a0c2a48fc881395085ae3168bf1e9b
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.5.0-py3-none-manylinux_2_34_x86_64.whl

Download URL dv_solve-0.5.0-py3-none-manylinux_2_34_x86_64.whl
Size 5.6 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
9774a81e6e2d35ffeefddbe050bf61376f316fb88e015ce11ae15a78793697dc
BLAKE2b-256 checksum
How to use checksums
0548f565a65791e3d2ab4923c102a07725010d16a74cc22a986338ac566666a0
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.5.0-py3-none-manylinux_2_34_aarch64.whl

Download URL dv_solve-0.5.0-py3-none-manylinux_2_34_aarch64.whl
Size 5.4 MB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
da9532ce4a3ba63687e846cb90001c63952cf48cf564118fc6ea52948b22806a
BLAKE2b-256 checksum
How to use checksums
50ac528395c5ba88bf87f7b0ea0b4eb0285ede780f869a91acc8d876e50b91fa
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.5.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL dv_solve-0.5.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 5.6 MB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
67ef1afc4cc4945393bb6fb25426628c7562b1fa06fac7db8d3258c0a83469d6
BLAKE2b-256 checksum
How to use checksums
a463d5b58d7dc9dff590c9c14c72f613c4289860da8504a7dd36d8cda3872868
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.5.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL dv_solve-0.5.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 5.4 MB
Tags Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b9230f7a34f88b64a2fa2495260e1d5c9251e4ccdf566f646541f5984b71fca2
BLAKE2b-256 checksum
How to use checksums
cd2634234cb3d6163fc17da5c1637bef428c5bcd321e0f96a8098d96a882edfc
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.5.0-py3-none-macosx_11_0_arm64.whl

Download URL dv_solve-0.5.0-py3-none-macosx_11_0_arm64.whl
Size 9.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e4af1e91eafb27c1fd4ea04914e3cd8a25f4690de8a339c7d55b8a892745cb3a
BLAKE2b-256 checksum
How to use checksums
57277c4624dd9fac29e41378b0212e4b1d64fb06fb2ce884fefdf917fcd9866e
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.5.0-py3-none-macosx_10_9_x86_64.whl

Download URL dv_solve-0.5.0-py3-none-macosx_10_9_x86_64.whl
Size 9.2 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
87de65a6b5bd905d930f921a41f40fee6dedce813fc56ba75838556bd82ea4f6
BLAKE2b-256 checksum
How to use checksums
dc2ddaffa05dbf1e601cb3ff5795ea4e64b0afad5d2bea64134269a0067a8114
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.5.0

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