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

how to print coverage model #181

Open songzenghui opened 1 year ago

songzenghui commented 1 year ago

I want to print my coverage model to confirm it met my exceptations. I use get_coverage_report_model, but the CoverageReport does not implement __str__ or __repr__. Could you implement that to print the coverage model?

mballance commented 1 year ago

Hi @songzenghui, Let me give that some thought. In general, it's a good idea to have Python objects be easily converted to a string representation. Currently, you can use get_coverage_report to get a string representation of the coverage. You can also use report_coverage to write the report to a file. See the information here: Coverage Reports

songzenghui commented 1 year ago

Yes, I use this api. But why it print two covergroup, actually i build one covergroup model. image Look, I want to print one. why there is TYPE and INST

mballance commented 1 year ago

Hi @songzenghui, Okay, so it sounds like you'd like to be able to selectively display portions of the coverage model, and having str/repr on the coverage model will help with that. To your specific question about Type vs Instance coverage, coverage tools generally maintain coverage information on a per-covergroup-type basis as well as a per-covergroup-instance basis. When you only have a single instance of a covergroup, the Type and Inst information is the same. I decided to keep the format of the coverage report the same, instead of changing the format depending on whether a single or multiple instances of a covergroup had been created.