pyvsc icon indicating copy to clipboard operation
pyvsc copied to clipboard

how to print coverage model

Open songzenghui opened this issue 1 year ago • 3 comments

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?

songzenghui avatar Jun 28 '23 00:06 songzenghui

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

mballance avatar Jun 29 '23 01:06 mballance

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

songzenghui avatar Jun 30 '23 00:06 songzenghui

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.

mballance avatar Jun 30 '23 16:06 mballance