Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheriting Virtually from fc4sc::covergroup causes crosses to not show #23

Open
amal-khailtash opened this issue Oct 25, 2024 · 0 comments

Comments

@amal-khailtash
Copy link

I have a case of multiple inheritance and the classic C++ diamond hierarchy. When I inherit from fc4sc::covergroup, the crosses seem to be not created and the dumped XML file does not include crosses.

I have the following class Hierarchy for demonstration:

graph TD;
    CoverGroupTop --> CoverGroupA;
    CoverGroupTop --> CoverGroupB;
    CoverGroupA --> CoverGroupBase;
    CoverGroupB --> CoverGroupBase;
    CoverGroupBase --> fc4sc::covergroup;
Loading

The idea is that CoverGroupBase defines some common coverpoints, then CoverGroupA and CoverGroupB each add their own coverpoints. CoverGroupTop will put groups together.

If issue #22 was supported, we could put some common coverpoints in our CoverGroupBase, but now we get two copies of each coverpoint in CoverGroupTop.

This requires that the base classes are inherited virtually. In the example attached, I have a define named VIRTUAL that allows putting virtual keyword in the class inheritance. A Makefile is provided for this:

$ make
Usage: make [target]

 Targets:
  main-non-virtual : build without VIRTUAL inheritance
  main-virtual     : build with VIRTUAL inheritance
  conv             : convert coverage data
  view             : view coverage data
  help             : print this help

$ make main-non-virtual makes the non-virtual version. Once that is built, we can run it and see:

$ ./main
Coverage = 42.8571%

$ make main-virtual makes the virtual version. Once that is built, we can run it and see:

$ ./main
Coverage = 50%

Even from these results, one can tell that something affected the coverage. And this is because crosses do not appear in the UCIS XML file.

Also, if one samples the crosses in the case of virtual inheritance, one would get segmentation fault. Seems like the crosses are not really instantiated/initialized.

Note

There seems to be a problem with the non-virtual version XML file and VCS seems to choke on this XML file.

`main.cpp instantiates both CoverGroupA, CoverGroupB as well as CoverGroupTop for illustration purposes.

virtual.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant