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

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

Total release size: 42.6 MB

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

Download URL dv_solve-0.2.5-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
de7b2298fb0adf61c198aca249abaf9eda1c79cc8a3e421b546c770a0b16a075
BLAKE2b-256 checksum
How to use checksums
fa93e86f42eb35a010f4130b1a6b0b8d82c454b669988c719443abf6658868ef
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.5-py3-none-manylinux_2_34_x86_64.whl

Download URL dv_solve-0.2.5-py3-none-manylinux_2_34_x86_64.whl
Size 5.3 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7d71c2129493404734570d6413a2e0e84b10273ab4d0f220b6b9fb9b020a2270
BLAKE2b-256 checksum
How to use checksums
d11a2499646e362897bf1474e86c46834f932a031d13e74d3c4be4aeb7a883a2
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.5-py3-none-manylinux_2_34_aarch64.whl

Download URL dv_solve-0.2.5-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
fcf59fe45377c88d59ea196bd0a47545c3fa0cf5896e33c98bddc38136f55be0
BLAKE2b-256 checksum
How to use checksums
665e91da1208c18ea166e385bd055b2d1abad25d693f4b61427922578ad40039
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.5-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL dv_solve-0.2.5-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 5.3 MB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
174bc7251299b0ccee15e56f6c2e0368919410c4822c9b043c149f9c00acc89a
BLAKE2b-256 checksum
How to use checksums
f40a73c549bad1f5bdcc2b64bc25926a8e67da7797a254824e231dfd7030e645
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.5-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL dv_solve-0.2.5-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
ce3eb3066dbcd21ec764f0c20a7b598352df1ca105730c922f8bdb3fa74e2bb7
BLAKE2b-256 checksum
How to use checksums
de3acf2972f297d67186cf5afb9b692e3eefc5f98499097c544983c642494b5b
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.5-py3-none-macosx_11_0_arm64.whl

Download URL dv_solve-0.2.5-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
4b95e0ec64f0633f393320a509e82a5fc9b2472324724a2260dbb18e7d5c19c9
BLAKE2b-256 checksum
How to use checksums
aa84914694c5dda2e3e03529e82337ce53e5ab4d7379359358c1d0e42fe86d9c
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.5-py3-none-macosx_10_9_x86_64.whl

Download URL dv_solve-0.2.5-py3-none-macosx_10_9_x86_64.whl
Size 8.6 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
b9e2867ed0305762b4e0be530667c840a1832d35d3cca5b3f47b0f8b0d10c65c
BLAKE2b-256 checksum
How to use checksums
15c4d9642796c65647e7fa0f5df9733cef332839163d79723a7d3f41cfcd43d2
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.2.5

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