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 Build Status 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 format and a function which allows for merging such files is provided.

References:

Simple example below:

# 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.

Files for cocotb-coverage, version 1.1.dev0
Filename, size File type Python version Upload date Hashes
Filename, size cocotb-coverage-1.1.dev0.tar.gz (21.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page