Commit Graph

7 Commits

Author SHA1 Message Date
Matthew Ballance dda0405fce V3Covergroup: initialize bin counters to 0, not random
Coverage bin counters (__Vcov_* member variables) were being initialized
with VL_SCOPED_RAND_RESET_I because they are plain uint32 members with no
explicit initial value. This caused 0% coverage readings at runtime when
randReset != 0 (as used in CI).

Fix all 5 bin counter AstVar creation sites to set an explicit valuep of
AstConst(0), so V3EmitCFunc emits '= 0U' instead of VL_SCOPED_RAND_RESET_I.

Affects: regular bins, default bins, array bins, transition array bins,
and cross bins.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-05 21:10:33 +00:00
github action eba0dcdb37 Apply 'make format' 2026-04-05 21:10:33 +00:00
Matthew Ballance 3aef029184 V3Covergroup: fix coverpoint cleanup for unsupported covergroups
Two bugs fixed:
1. AstCReset: mark as ineligible for coverage expressions via
   isExprCoverageEligible() override, preventing verilogForTree
   from being called on CReset nodes (which has no V3EmitV handler).

2. generateCrossCode: when a cross references an unknown coverpoint,
   don't delete the cross node early. The caller's cleanup loop
   (in visit(AstClass*)) is responsible for deleting all coverpoints
   and crosses. Early deletion left a dangling pointer in m_coverCrosses
   causing a use-after-free segfault.

3. hasUnsupportedEvent path: added coverpoint/cross cleanup before
   returning so AST nodes don't reach downstream passes (V3EmitCFunc,
   V3MergeCond) which no longer have stub visitors for them.

All 60 covergroup tests now pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-05 21:10:32 +00:00
Matthew Ballance 07f959d31d Refactoring node locations and enums ; Delete coverpoints after V3Covergroup so they don't accidentally hit the generators
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:10:32 +00:00
github action 30ca516362 Apply 'make format' 2026-04-05 21:10:32 +00:00
Matthew Ballance 17eaa5514b Adopt use of MemberMap
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:09:39 +00:00
Matthew Ballance c749ff09b4 Refactoring before renaming tests
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:09:39 +00:00