Commit Graph

9176 Commits

Author SHA1 Message Date
Matthew Ballance d23db1915a Whitespace fixes
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-03-02 14:20:31 +00:00
Matthew Ballance c003a07495 Update golden file for covergroup fileline fix
The covergroup keyword fileline fix (using $<fl>1 instead of $<fl>2)
shifts error column from the name position to the 'covergroup' keyword.
Update the golden output for t_covergroup_in_class_duplicate_bad to match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-02 04:47:49 +00:00
Matthew Ballance f147b0854a Fix infinite recursion in visit(AstCovergroup*) and fileline
Two bugs in the covergroup -> AstClass transformation in V3LinkParse:

1. Infinite recursion: when a covergroup has a clocking event (e.g.
   `@(posedge clk)`), visit(AstCovergroup*) embeds a sentinel
   AstCovergroup node inside the new AstClass to carry the event for
   V3Covergroup.cpp. The subsequent iterate(cgClassp) call then visits
   the sentinel via visit(AstNodeModule*) -> iterateChildren -> which
   hits visit(AstCovergroup*) again, creating another class with another
   sentinel, infinitely.

   Fix: skip transformation in visit(AstCovergroup*) when already inside
   a covergroup class (m_modp->isCovergroup()), so sentinel nodes are
   left alone.

2. Wrong fileline column: AstCovergroup was created with the fileline of
   the identifier token ($<fl>2, the name position) rather than the
   'covergroup' keyword token ($<fl>1). This caused warnings about the
   covergroup to point to the name column instead of the keyword column.

   Fix: use $<fl>1 (the 'covergroup' keyword fileline) when constructing
   AstCovergroup in the parser.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-02 04:26:11 +00:00
Matthew Ballance 344586dfa2 Fix: move removeStd() to after V3LinkParse
V3LinkParse's visit(AstCovergroup) creates std:: references and calls
setUsesStdPackage(). The previous removeStd() call happened before
V3LinkParse ran, so it deleted the std package before those references
were created, causing:

  %Error: Package/class for ':: reference' not found: 'std'

Move removeStd() to immediately after V3LinkParse::linkParse() inside
process() so the std package is only pruned after all parse-time
transformations have had a chance to declare their std:: usage.

Fixes test failures:
  - t_covergroup_option
  - t_covergroup_with_sample_args_too_many_bad

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-02 03:23:07 +00:00
github action 68df201260 Apply 'make format' 2026-03-01 19:05:36 +00:00
Matthew Ballance 8860ad4b3e Parser clean-up
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-03-01 15:46:20 +00:00
Matthew Ballance 42debebb07 verilog.y: fix accidental DEL omissions for wait_order, expect, property case
Three node deletions were accidentally dropped from the initial covergroup
commit as collateral damage:
- wait_order (no-stmt variant): restore DEL($3) for vrdList
- expect (no-stmt variant): restore DEL($3) for property_spec
- property_exprCaseIf yIF/yELSE: restore DEL($3) for condition expr

In all three cases $3 is an AstNode* that is not assigned to $$ and would
be leaked without the deletion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 20:58:54 +00:00
Matthew Ballance 4005cd33fb Gate V3Covergroup pass on useCovergroup() flag
Add v3Global.useCovergroup() flag (following the useRandSequence()
pattern) that is set to true when a covergroup_declaration is parsed.
Gate the V3Covergroup::covergroup() pass in Verilator.cpp on this flag
so the pass is skipped entirely for designs with no covergroups.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 20:49:22 +00:00
Matthew Ballance a5f10c9abf 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-02-28 20:34:14 +00:00
Matthew Ballance 14c67621ac 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-02-28 20:10:20 +00:00
github action 4f725a54ec Apply 'make format' 2026-02-25 23:44:47 +00:00
Matthew Ballance aa23b6d075 Revert V3Coverage.cpp to funccov-minimal merge base
The VLifetime::AUTOMATIC_EXPLICIT addition is not required for
functional coverage — all 60 covergroup tests pass without it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-25 23:31:41 +00:00
Matthew Ballance b4244fc575 Revert V3EmitV.cpp and V3LinkInc.cpp to funccov-minimal merge base
These changes are not required for functional coverage support and
should not be included in the upstream patch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-25 23:22:36 +00:00
Matthew Ballance 0a05813149 Adopt use of MemberMap
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-02-25 23:15:08 +00:00
Matthew Ballance fd873c04df Rename funccov tests to covergroup
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-02-25 01:31:12 +00:00
Matthew Ballance cb3172707f Refactoring before renaming tests
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-02-25 01:16:55 +00:00
github action 11b070c387 Apply 'make format' 2026-02-20 19:45:39 +00:00
Matthew Ballance bb37a44b50 CMake: detect PCH include flag for GCC/Clang in verilated.mk
Without this, CFG_CXXFLAGS_PCH_I was left empty in CMake builds, causing
GCC to treat the PCH filename as a linker input instead of applying it as
a -include flag, breaking compilation of any model that uses PCH.

This is a general CMake build fix (not funccov-specific); the same bug
exists in upstream CMakeLists.txt. It is included here because funccov's
cross-coverage tests expose the issue.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-20 19:45:39 +00:00
Matthew Ballance ab6424313e Add function coverage (funccov) and covergroup support
Implement functional coverage collection via covergroups, coverpoints,
and cross coverage bins. Introduces V3CoverageFunctional pass and
verilated_funccov.h runtime support.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-20 15:12:14 +00:00
Wilson Snyder 2d86f1373e Support vpiBitVar (#7107).
Fixes #7107.
2026-02-20 05:39:38 -05:00
Wilson Snyder ace9a34c10 Internal: Fix clang override warning (#7106 repair). 2026-02-19 21:34:17 -05:00
Wilson Snyder 0d2fcfd49d Fix circular class reference %p-printing causing infinite recursion (#7106).
Fixes #7106.
2026-02-19 20:15:37 -05:00
Geza Lore 4a4f8c6698
Optimize continuous assignments with function on RHS in Dfg (#7096) 2026-02-19 18:21:55 +00:00
Igor Zaworski 69564078da
Fix determinism of AwaitBeforeTrigVisitor (#6932 repair) (#7101) 2026-02-19 18:21:40 +00:00
Wilson Snyder d6f8425e16 Tests: Update t_uvm_dpi (#7097 test) 2026-02-19 07:11:36 -05:00
Wilson Snyder 2309d52fd6 Tests: Cleanup t_uvm_dpi. No test change. 2026-02-19 07:05:33 -05:00
Ryszard Rozak ff3028aca3
Support `disable iff` with sequences (#7090) 2026-02-19 11:33:30 +01:00
Yilou Wang 0e26b049ea
Support function calls with random arguments in constraints (#7061) (#7083) 2026-02-19 15:37:55 +05:30
Ryszard Rozak f843780aad
Add UNSUPPORTED on $sampled in sensitivity list (#7093) 2026-02-19 08:36:21 +01:00
Wilson Snyder 702d6ede09 Fix time to not advance after `$finish` (#7095).
Fixes #7095.
2026-02-18 19:36:36 -05:00
Wilson Snyder 3b7dfce6f5 Commentary: Changes update 2026-02-18 19:30:34 -05:00
Geza Lore 2cd8dc6cf7
Optimize functions inlined from packages in Dfg (#7091) 2026-02-18 19:11:33 +00:00
Todd Strader cf1de0b9a8
Fix interface internal type reference (#6920) (#6966) 2026-02-18 09:38:42 +05:30
Artur Bieniek da28c67e60
Fix #0 delays to control fork scheduling (#6730 repair) (#6891)
Signed-off-by: Artur Bieniek <abieniek@internships.antmicro.com>
2026-02-17 21:51:11 -05:00
Geza Lore 7176bdcff6
Optimize always blocks using local temporary variables in Dfg (#7085)
Enable synthesis of blocks that use a variable only within certain
branches, if that variable is not externally observable.
2026-02-17 20:00:55 +00:00
Ryszard Rozak 5d0352ab46
Fix conditional expressions in constraints (#7087) 2026-02-17 11:40:15 -05:00
Wilson Snyder 81d1d79585 Tests: Cleanup t_cover_assert 2026-02-17 08:47:43 -05:00
Wilson Snyder 089672b200 Tests: Improve t_lint_unused_func_bad.v 2026-02-17 06:20:42 -05:00
Wilson Snyder 9049c93009 Internals: Call common V3NUmber function to zero data type. Cleanup chandle clearling. 2026-02-17 06:18:57 -05:00
Geza Lore a1a9147267
Optimize straight line code in Dfg always (#7084) 2026-02-17 11:17:52 +00:00
Geza Lore 5834f22944
Optimize logic and variable removal early in Dfg (#7081)
After conversion of Ast to Dfg, but before synthesizing AstAlways into
primitives, run a pass to remove variables that are not observable, and
all logic that only computes such variables. This can get rid of a lot
of content early so we don't build redundant Dfgs, and also enables
synthesizing always blocks that use temporaries only in some branches,
which will come in a follow up.
2026-02-17 08:28:06 +00:00
Wilson Snyder ed2f018729 Tests: Improve t_var_static_assign_decl_bad 2026-02-17 02:18:56 -05:00
Wilson Snyder 7182e8d937 Internals: Track what variables get user initial assignment. 2026-02-17 02:05:05 -05:00
Wilson Snyder 6c5dee5043 Change automatic variables to not be traced. 2026-02-17 01:38:39 -05:00
Veripool API Bot 300be3e388 Verilog format 2026-02-16 23:21:53 -05:00
Wilson Snyder 1f157b36f5 Commentary: Changes update 2026-02-16 23:19:19 -05:00
Yilou Wang ed3aa43657
Fix enum variables in constraint solver producing invalid enum values (#7058) (#7065) 2026-02-16 22:44:38 -05:00
Yilou Wang 4357aee09a
Fix randomize() on null object handle crashing instead of returning 0 (#7059) (#7066) 2026-02-16 22:43:57 -05:00
Yilou Wang 5173f7e42f
Fix inside operator crash with impure expression and unsized range literals (#7063) (#7067) 2026-02-17 08:33:31 +05:30
Yilou Wang 994ef82e76
Support unique constraint on explicit array element subsets (#7057) (#7064) 2026-02-16 19:46:46 -05:00