fvutils / pyvsc

Python packages providing a library for Verification Stimulus and Coverage
https://fvutils.github.io/pyvsc
Apache License 2.0
113 stars 26 forks source link

Supporting inheritance in PyVSC #159

Open walido78 opened 2 years ago

walido78 commented 2 years ago

Hello, As I was writing my test cases in CocoTB, I had a design where there was 10 subdesigns that are identical. Currently the only way to create a covergroup for each entity (i.e sub-design), is for example to duplicate this code 10 times:

@vsc.covergroup
class internal_coverage(object):
    _inst=None
    def __init__(self,uut):     

            self.caryallcount=vsc.coverpoint(uut,lambda : getattr(uut.adder,"c"), bins={
             str(63-i):vsc.wildcard_bin("0b" + "x" * (63-i) + "1" + "x" * (i)) for i in range(64)})

and instantiate it with each different entity.

So a good enhancement could be to write :

class internal_coverage_entity2(internal_coverage):
         pass;
mballance commented 2 years ago

Thanks for the enhancement request, @walido78. If I'm reading this correctly, you a set of designs where the coverage data to be collected is identical (same coverpoints, same bins, same data to be sampled), but you want the coverage for each design to be captured in a different type of covergroup.

walido78 commented 2 years ago

Yes that is correct.