cocotb-coverage
Functional Coverage and Constrained Randomization Extensions for Cocotb
What it is and what it does
cocotb-coverage extends the cocotb hardware verification framework with constrained random verification (CRV) and metric-driven verification (MDV) techniques traditionally found in SystemVerilog or _e_. It allows you to define randomized objects with constraints, sample functional coverage points and crosses, and export coverage results to XML or YAML formats for analysis and merging.
The package is designed for developers building advanced verification environments for complex hardware projects. It depends on cocotb for testbench execution, python-constraint for constraint solving, and pyyaml for coverage export. The implementation aims to be intuitive for users familiar with SystemVerilog verification methodologies while providing Python-native abstractions.
Use it for:
- Build constrained random testbenches for complex hardware designs using Python instead of SystemVerilog.
- Define and track functional coverage metrics (cover points and crosses) across multiple test runs.
- Export and merge coverage databases in XML or YAML format for cross-tool analysis and reporting.
- Implement metric-driven verification workflows to guide test generation toward uncovered design scenarios.
- Extend cocotb testbenches with advanced randomization strategies beyond simple random generation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds constrained randomization and functional coverage capabilities to cocotb, enabling SystemVerilog-style verification methodologies in Python for hardware testbenches.
Yes, if you are using cocotb and need SystemVerilog-style constrained randomization and coverage tracking. The package is stable (version 2.0 released recently), has no known vulnerabilities, and low install friction. The aging maintenance status (315 days since last release) is a minor concern but not a blocker if the feature set meets your needs. Verify that version 2.0 is compatible with your cocotb version and test requirements before committing to production use.
Install
cocotb-coverage on PyPI
pip
pip install cocotb-coverageuv
uv add cocotb-coveragepoetry
poetry add cocotb-coverageInstalling cocotb-coverage
Before you install
Low friction install as a pure Python wheel. Maintenance status is aging—last release was 315 days ago—but the repository remains active and the package targets current Python versions (3.11+).
License in practice
BSD license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you include the license notice.
Quickstart
pip install cocotb-coverage
from cocotb_coverage import crv, CoverPoint, CoverCross
class Point(crv.Randomized):
def __init__(self, x, y):
crv.Randomized.__init__(self)
self.x = x
self.y = y
self.add_rand("x", list(range(-10, 10)))
self.add_rand("y", list(range(-10, 10)))
self.add_constraint(lambda x, y: x < y)
p = Point(0, 0)
p.randomize()
Requires Python 3.11 or later and cocotb as a runtime dependency.
Verify before relying
- Whether version 2.0 is stable or still subject to breaking changes relative to 1.2.0.
- Current test coverage and test suite maturity for the 2.0 release.
- Performance characteristics when handling large constraint spaces or coverage databases.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — cocotb, python-constraint, pyyaml |
| Maintenance | aging — 315 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 382,362/month — #7,088 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cocotb_coverage-2.0-py3-none-any.whl
Tags
More Electronic Design Automation (EDA) packages
Parses and elaborates SystemRDL 2.0 register…
permissive · top 15,000 on PyPI
planarityTests whether a graph is planar, computes…
permissive · top 15,000 on PyPI
cocotbcocotb is a Python framework for writing…
permissive · top 15,000 on PyPI
pyslangpyslang provides Python bindings to parse,…
permissive · top 15,000 on PyPI
peakrdl-ipxactConverts between SystemRDL register…
copyleft · top 15,000 on PyPI
klayoutKLayout is a Python package for layout viewing,…
copyleft · top 15,000 on PyPI
pyucisPyUCIS provides a Python API and CLI tools for…
permissive · top 15,000 on PyPI
pyvscPyVSC generates randomized test stimulus and…
permissive · top 15,000 on PyPI
cocotb-buscocotb-bus provides pre-built testbenching…
unclear · top 15,000 on PyPI
pyuvmImplements the IEEE 1800.2 Universal…
permissive · top 15,000 on PyPI
cocotb-testcocotb-test wraps cocotb hardware simulations…
permissive · top 15,000 on PyPI
peakrdl-regblockCompiles SystemRDL register descriptions into…
copyleft · top 15,000 on PyPI
tree-sitter-verilogProvides a SystemVerilog grammar parser for…
permissive · top 5,000 on PyPI
dvsimDVSim is a Python-based build and run system…
permissive · top 15,000 on PyPI
samplomaticSamplomatic generates randomized variants of…
permissive · top 15,000 on PyPI