Code Monkey home page Code Monkey logo

Comments (3)

mballance avatar mballance commented on June 19, 2024

Hi Hodjat,
Interesting... I thought I had a test for coverpoints on enum types, but perhaps not. Can you add a testcase for both cases (enum, list) to the issue?

Thanks,
Matthew

from pyvsc.

hodjat91 avatar hodjat91 commented on June 19, 2024

Hi Matthew,

There is actually separate tests for the covergroup and coverage report, but not a combination for a coverpoint with cp_t=enum type and the coverage report. Here is a small test:

import vsc
from enum import IntEnum, auto
from vsc import *


class my_e(IntEnum):
    A = auto()
    B = auto()


my_l = ["one", "two"]


@covergroup
class my_covergroup(object):
    def __init__(self, a, b, c):  # Need to use lambda for non-reference values
        super().__init__()
        self.cp1 = coverpoint(a,
                              options=dict(
                                  auto_bin_max=64
                              ),
                              bins=dict(
                                  a=bin_array([], [1, 15])
                              ))

        self.cp2 = coverpoint(b, cp_t=my_e)

        self.cp3 = coverpoint(c, cp_t=my_l)


a = 1
b = my_e.A
c = "one"
cg = my_covergroup(lambda: a, lambda: b, lambda: c)

cg.sample()

cg.dump()

vsc.report_coverage(details=True)

-Hodjat

from pyvsc.

mballance avatar mballance commented on June 19, 2024

Hi Hodjat,
Okay, there might be a couple of issues here. I uncovered a few issues with coverpoints on enumerated types. These are resolved now, and the only change needed to the enumerated-type portion of your test is that you need to wrap the parameter value for cp_t with enum_t:

def __init__(self):
self.with_sample(dict(
a=vsc.enum_t(my_e)))
self.a_cp = vsc.coverpoint(self.a)

The coverpoint on a string is a different story. PyVSC doesn't currently support coverpoints on string values -- not to say that it shouldn't ;-). Is there a reason you need to use a string instead of an enum? If so, please open a separate enhancement request for that.
By the way, I've released version 0.0.8 with the fixes needed for coverpoints on enum types.

Thanks and Best Regards,
Matthew

from pyvsc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.