skillfed

cocotb-coverage

Functional Coverage and Constrained Randomization Extensions for Cocotb

cocotb-coverage v2.0 382.4K downloads/30d#7,088 on PyPI127
Permissive license BSD AGING released

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-coverage

uv

uv add cocotb-coverage

poetry

poetry add cocotb-coverage

Installing 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

License :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)

Tags

constrained random verification pythonhardware coverage metrics cocotbfunctional coverage cocotbcrv constrained randomizationverification environment cocotbcoverage export xml yamlmdv metric-driven verification
hardware-verificationconstrained-randomizationcoverage-metrics

More Electronic Design Automation (EDA) packages

Further reading