Registry / testing / cocotb-coverage

cocotb-coverage

JSON →
library2.0pypypi✓ verified 89d ago

Functional coverage and constrained randomization extensions for cocotb. Version 2.0, requires Python >=3.11. Release cadence: irregular.

pip install cocotb-coverage
INSTALL
IMPORT
SIG · COCOTB-COVERAGE
C
cocotb-coverage
testingpythonv2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CoverageDB
✓ from cocotb_coverage.coverage import CoverageDB
✗ from cocotb_coverage import CoverageDB
CoverageDB must be imported from the submodule 'coverage'.
coverage_db
✓ from cocotb_coverage.coverage import coverage_db
✗ from cocotb_coverage import coverage_db
Singleton instance is in the coverage submodule.

Minimal cocotb test with coverage export.

import cocotb from cocotb.clock import Clock from cocotb.triggers import Timer from cocotb_coverage.coverage import coverage_db @cocotb.test() async def test_coverage_example(dut): cocotb.start_soon(Clock(dut.clk, 10, 'ns').start()) await Timer(5, 'ns') # Example coverage (requires user-defined covergroups) coverage_db.export_to_xml(filename="coverage.xml")
Debug
Known issues
breakingVersion 2.0 drops Python <3.11 support. Upgrade toolchain.
fix
Use Python 3.11+ and update dependencies.
affects: >=2.0
gotchaCoverageDB must be imported from cocotb_coverage.coverage, not directly from top-level package.
fix
Use 'from cocotb_coverage.coverage import CoverageDB'.
affects: all
deprecatedOld import paths 'from cocotb_coverage import coverage' may still work but are deprecated.
fix
Switch to new import paths: from cocotb_coverage.coverage import ...
affects: <2.0
Errors
Common errors & fixes
AttributeError: module 'cocotb_coverage' has no attribute 'coverage_db'
Importing from wrong module level.
fix
Use 'from cocotb_coverage.coverage import coverage_db' instead.
ImportError: cannot import name 'CoverageDB' from 'cocotb_coverage'
Wrong import path.
fix
Use 'from cocotb_coverage.coverage import CoverageDB'.
Upgrade
Version history
2.0latest on PyPI · released Oct 3, 2025
Audit
Dependencies
cocotbrequiredRequired for simulation framework
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
cocotb-coverage — pip install cocotb-coverage · libregistry