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

Total release size: 42.8 MB

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

Download URL dv_solve-0.3.0-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bca51fa89b23f181c33aad0907530886e28868ed6f0651e92346b5fde02f1ca3
BLAKE2b-256 checksum
How to use checksums
4616203495ff944bb99075cc5149eb59f496413729b54a5ba0d1716436044e59
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.3.0-py3-none-manylinux_2_34_x86_64.whl

Download URL dv_solve-0.3.0-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
a5e8a864db374b32a0efa19453f60c558fe2998c0f724ed7aadfc241bf25de8c
BLAKE2b-256 checksum
How to use checksums
ea0c57a0239df948d6b43438757b0fc512c4b0a9865cf8af9c4f85646640bbe4
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.3.0-py3-none-manylinux_2_34_aarch64.whl

Download URL dv_solve-0.3.0-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
5ce5100a6af881c9fcf4350beb467be905fa6f180644c3b296eeaf15f8ec7714
BLAKE2b-256 checksum
How to use checksums
03a140750365305b7081edf12b7d21d60220dda04588d73c30daca9c151eaba6
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.3.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL dv_solve-0.3.0-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
d63d9f980709139b7ae9284c63b9c7f7949f88738818413209cc87cc432507e0
BLAKE2b-256 checksum
How to use checksums
ee39546851f17944d46190a6e85145b54b4fe4d7a083ad5e19de8c4452dd22b9
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.3.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL dv_solve-0.3.0-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
ba3bd12d9e4318d326f3e13ab28ef15099418e6d86f7c25ecde47523b504af1f
BLAKE2b-256 checksum
How to use checksums
edf125f03674b0bb0ce4b5df065ae93345f08e61b20cb4eb0511de54da7f8e00
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.3.0-py3-none-macosx_11_0_arm64.whl

Download URL dv_solve-0.3.0-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
3033e355a9f9e2b9f7794da8bbafdcd022844259c914048d64cae1db3383f72b
BLAKE2b-256 checksum
How to use checksums
7865653bd5e08f9e1a466e114fbe1f87ae8062eedef5d055a39a47fe6c93b681
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.3.0-py3-none-macosx_10_9_x86_64.whl

Download URL dv_solve-0.3.0-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
be05efa6fc27fcb99eec61c3ede6584c8ac13f2bb3a8aac58784ab35d36f9715
BLAKE2b-256 checksum
How to use checksums
0ee986449a9f1683911b7acbcbb8f566e94426d27460b4ac51ee1bfd761ea75f
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.3.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