mciepluc / cocotb-coverage

Functional Coverage and Constrained Randomization Extensions for Cocotb
BSD 2-Clause "Simplified" License
100 stars 15 forks source link

Access to `coverage_db['top'].detailed_coverage` field is failed. #66

Closed glkclass closed 2 years ago

glkclass commented 2 years ago

CoverItem class contains detailed_coverage property and it can be accessed accordingly to spec. But trying to address it (for instance: coverage_db['top'].detailed_coverage) leads to fail. The cause of exception is using append() method for a dict in CoverItem code:

coverage = {}
for child in self._children:
    coverage.append(child.detailed_coverage)
mciepluc commented 2 years ago

@glkclass thanks a lot for your contributions!. Could you please prepare a unit test for this (simply add a test function to the existing tests).

glkclass commented 2 years ago

@mciepluc Thanks a lot for your work as well ) Without constrained randomization and coverage collection features CocoTB itself doesn't make a lot of sense.

I Added a unit test for this fix. And removed child name modification inside a dict. To keep detailed_coverage dict keys matching to child._name values.