--- id: cocotb-coverage version: "2.0" license: BSD license_treatment: permissive maintenance: aging --- # cocotb-coverage — Functional Coverage and Constrained Randomization Extensions for Cocotb License: permissive · Maintenance: aging · Downloads: 382.4K/mo ## 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 above — 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 pip install cocotb-coverage uv add cocotb-coverage 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_current - Install friction: low - Maintenance: aging - Downloads: 382.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags constrained random verification python, hardware coverage metrics cocotb, functional coverage cocotb, crv constrained randomization, verification environment cocotb, coverage export xml yaml, mdv metric-driven verification, hardware-verification, constrained-randomization, coverage-metrics [View on SkillFed](https://skillfed.io/packages/cocotb-coverage) · [View on PyPI](https://pypi.org/project/cocotb-coverage/)