Skip to content

Commit 48317a2

Browse files
committed
report-builder fix
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
1 parent b3f19b1 commit 48317a2

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

src/ucis/report/coverage_report_builder.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,27 @@ def build_covergroup(self, cg_n)->CoverageReport.Covergroup:
7777
for cg_in in cg_n.scopes(ScopeTypeT.COVERINSTANCE):
7878
cg_r.covergroups.append(self.build_covergroup(cg_in))
7979

80-
# Determine the covergroup coverage
80+
# Determine the covergroup coverage.
81+
# If the covergroup has type-level coverpoints/crosses (the aggregate
82+
# view across all instances), use those. Otherwise fall back to the
83+
# average of sub-instances.
8184
coverage = 0.0
82-
8385
div = 0
84-
for cp in cg_r.coverpoints:
85-
if cp.weight > 0:
86-
coverage += cp.coverage * cp.weight
87-
div += cp.weight
88-
89-
for cr in cg_r.crosses:
90-
coverage += cr.coverage * cr.weight
91-
div += cr.weight
92-
93-
for sub in cg_r.covergroups:
94-
if sub.weight > 0:
95-
coverage += sub.coverage * sub.weight
96-
div += sub.weight
86+
87+
if cg_r.coverpoints or cg_r.crosses:
88+
for cp in cg_r.coverpoints:
89+
if cp.weight > 0:
90+
coverage += cp.coverage * cp.weight
91+
div += cp.weight
92+
93+
for cr in cg_r.crosses:
94+
coverage += cr.coverage * cr.weight
95+
div += cr.weight
96+
else:
97+
for sub in cg_r.covergroups:
98+
if sub.weight > 0:
99+
coverage += sub.coverage * sub.weight
100+
div += sub.weight
97101

98102
if div > 0: coverage /= div
99103

0 commit comments

Comments
 (0)