Skip to main content

Functional Coverage and Constrained Randomization Extensions for Cocotb

Project description

cocotb-coverage

Functional Coverage and Constrained Randomization Extensions for Cocotb

Documentation Status Regression Tests PyPI

This package allows you to use constrained randomization and functional coverage techniques known from CRV (constrained random verification) and MDV (metric-driven verification) methodologies, available in SystemVerilog or e. Such extensions enable the implementation of an advanced verification environment for complex projects.

The implemented functionality is intended to be easily understandable by SystemVerilog users and provides significant extensions compared to Hardware Verification Languages.

There is an option to export coverage database to a readable XML or YML format and a function which allows for merging such files is provided.

Installation

The package can be installed with pip. Version 1.1.0 is the latest one and recommended.

pip install cocotb-coverage

References

Roadmap

  • 1.1 released - 7 Aug 2020
  • Planned basic support for UCIS coverage database format
  • Any suggestions welcome - you are encouraged to open an issue!

Code Example

# point represented by x and y coordinates in range (-10,10)
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)))
        # constraining the space so that x < y
        self.add_constraint(lambda x, y: x < y)

...

# create an arbitrary point
p = Point(0,0)

for _ in range (10):

    # cover example arithmetic properties
    @CoverPoint("top.x_negative", xf = lambda point : point.x < 0, bins = [True, False])
    @CoverPoint("top.y_negative", xf = lambda point : point.y < 0, bins = [True, False])
    @CoverPoint("top.xy_equal", xf = lambda point : point.x == point.y, bins = [True, False])
    @CoverCross("top.cross", items = ["top.x_negative", "top.y_negative"])
    def plot_point(point):
        ...

    p.randomize()  # randomize object
    plot_point(p)  # call a function which will sample the coverage

# export coverage to XML
coverage_db.export_to_xml(filename="coverage.xml")
# export coverage to YAML
coverage_db.export_to_yaml(filename="coverage.yml")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cocotb-coverage-1.2.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

cocotb_coverage-1.2.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file cocotb-coverage-1.2.0.tar.gz.

File metadata

  • Download URL: cocotb-coverage-1.2.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for cocotb-coverage-1.2.0.tar.gz
Algorithm Hash digest
SHA256 0ac0af59be97aca48eb852817442b15d642f0eb4905fba8fbd9ee3da6a40365c
MD5 ad272dfc953767942e703d7ef18db179
BLAKE2b-256 2becc3db4c91faa759161aedeb26d38e41abca5e1d1a0eeef286fdda51c18959

See more details on using hashes here.

File details

Details for the file cocotb_coverage-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cocotb_coverage-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 831a12425e02cef9715cdd6b7122ea0c20ba184b11675d55ec3057194e07841c
MD5 d9ad64e2b6a1f14e6e43512adaa280fa
BLAKE2b-256 f58040db1aee3604803993b8f8c9832e7c981fa5ef811115a19860a84149010d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page