Commit Graph

299 Commits

Author SHA1 Message Date
github action a6acde41a8 Apply 'make format' 2026-04-05 21:10:49 +00:00
Matthew Ballance 65ee9cd865 Format fixes
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:10:49 +00:00
github action 601e05615d Apply 'make format' 2026-04-05 21:10:49 +00:00
Matthew Ballance 8eb03568fd Cleanup mis-merge ; move initial Ast manipulation out of Grammar
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:10:48 +00:00
Matthew Ballance 94a65f8e64 Comment new Ast classes, clean up accidentally added members, clean up a few interim workarounds, and adjust approach to stay out of sensitive paths
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:10:48 +00:00
Matthew Ballance e347943e3b Whitespace fixes
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:10:33 +00:00
Matthew Ballance 80dd984780 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-04-05 21:10:33 +00:00
github action eba0dcdb37 Apply 'make format' 2026-04-05 21:10:33 +00:00
Matthew Ballance 15bcf7b2fb Parser clean-up
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2026-04-05 21:10:33 +00:00
Wilson Snyder 9f4546fcb9
Fix constraint 'with' in parameter classes (#7375) 2026-04-04 21:03:44 -04:00
Wilson Snyder 5036af3d37 Commentary: Refer to latest standard where can 2026-03-29 18:06:12 -04:00
Wilson Snyder 7607f0e7fa
Support proper automatic/static initialization, and remove STATICVAR warning (#6405). (#7086) 2026-02-24 14:04:43 -05:00
Geza Lore da51021b0a
Internals: Simplify AstForeach header handling (#7126)
Rename AstSelLoopVars to AstForeachHeader, and make it a non-NodeExpr.
Tweak parser to always create an AstForeachHeader, so no need to fix it
up later.
2026-02-22 18:57:12 +00:00
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
Wilson Snyder 7182e8d937 Internals: Track what variables get user initial assignment. 2026-02-17 02:05:05 -05:00
Wilson Snyder 5a236dd35d
Change INITIALSTATIC to also report on processes, per IEEE (#7020) 2026-02-08 20:47:12 -05:00
Wilson Snyder 7c6c6a684b Add SPDX copyright identifiers, and get 'reuse' clean. No functional change. 2026-01-26 20:24:34 -05:00
Jose Drowne 12080dfcb1
Internals: Add AST nodes for tagged union parsing (#6867 partial) (#6881) 2026-01-17 14:15:52 -05:00
Wilson Snyder 13327fa9c0 Copyright year update. 2026-01-01 07:22:09 -05:00
Geza Lore 04a7b31b84
Fix false IMPLICITSTATIC on localparam (#6835) 2025-12-18 12:51:31 +00:00
Luca Colagrande a9ef4b3ff1
Fix nested struct within parameter port list (#6818) (#6824) 2025-12-16 18:08:49 -05:00
em2machine d0a5da2445
Fix typedef derived from type defined inside interface (#3441) (#6776) 2025-12-08 15:36:21 -05:00
Wilson Snyder 35a794687b Internals: Add some additional dangling checks. No functional change intended 2025-12-07 13:25:37 -05:00
Wilson Snyder 7957701db8 Suppress unsupported for unused constant sequences 2025-12-03 21:23:48 -05:00
Wilson Snyder b9b6eb61d9 Support randsequence (#6131) 2025-11-30 09:04:42 -05:00
Artur Bieniek 2c5ff3f63f
Fix fork scheduling semantics (#6730)
Signed-off-by: Artur Bieniek <abieniek@internships.antmicro.com>
2025-11-26 15:52:53 +03:00
Wilson Snyder 087ca15138 Support clocking output delay `1step` (#6681). 2025-11-22 17:40:40 -05:00
Jakub Wasilewski 0b8c369740
Add `sc_biguint` pragma (#6712) 2025-11-20 17:08:59 -05:00
Paul Swirhun 10935ee031
Fix HIERPARAM to be suppressed for interface ports (#6587) (#6609)
Co-authored-by: Paul Swirhun <paulswirhun@gmail.com>
2025-10-31 15:49:30 -04:00
Geza Lore d864057a60
Internals: Refactor AstNodeBlock representation (#6280) (#6588)
Internals: Refactor AstNodeBlock representation (#6280)

AstNodeBlock now has 2 child lists: 'declsp' to hold declarations within
the block, and 'stmtsp' to hold the procedural statements.

AstBegin is then just a simple subtype of AstNodeBlock.

AstFork is a proper superset of AstNodeBlock (and also AstBegin), and
adds 'forksp' which hold the parallel statements. Having the sequential
'stmtsp' in AstFork is required to properly implement variable
initializers in fork blocks (IEEE 1800-2023 9.3.2), this makes that
clear, while also separating the non AstNodeStmt declarations
(for #6280). The actual fork branches in 'AstFork::forkps()' are all
AstBegin nodes. This is required as lowering stages will introduce
additional statements in each parallel branch. (We used to wrap AstFork
statements into AstBegin in 3 different places, now they always are
AstBegin and this is enforced via the type checker/V3Broken).

Also fixes incorrect disabling of forked processes from within the `fork`.
2025-10-24 14:00:07 +01:00
Wilson Snyder 71941cc673 Fix incorrect nested interface-class error (#6549). 2025-10-11 19:07:37 -04:00
Wilson Snyder 078275034d Internals: Parse randsequence but still unsupported (#6131 partial) 2025-10-11 10:47:46 -04:00
Geza Lore 838b8a2bec Internals: Remove dead code, fix or sign off coverage
Remove/fix/signoff uncontroversial code coverage holes. Also added a
couple TODOs that should be investigated at some point
2025-10-08 08:24:06 +01:00
Geza Lore 603f4c615a
Improve Loop unrolling (#6480) (#6493)
This patch implements #6480. All loop statements are represented using
AstLoop and AstLoopTest.

This necessitates rework of the loop unroller to handle loops of
arbitrary form. To enable this, I have split the old unroller used for
'generate for' statements and moved it into V3Param, and subsequently
rewrote V3Unroll to handle the new representation. V3Unroll can now
unroll more complex loops, including with loop conditions containing
multiple variable references or inlined functions.

Handling the more generic code also requires some restrictions. If a
loop contains any of the following, it cannot be unrolled:
- A timing control that might suspend the loop
- A non-inlined call to a non-pure function

These constructs can change the values of variables in the loop, so are
generally not safe to unroll if they are present. (We could still unroll
if all the variables needed for unrolling are automatic, however we
don't do that right now.)

These restrictions seem ok in the benchmark suite, where the new
unroller can generally unroll many more loops than before.
2025-09-29 15:25:25 +01:00
Wilson Snyder fd12ab3413 Fix interface exposure with `--public-depth` or `--trace-depth` (#5758). 2025-09-23 22:05:51 -04:00
Wilson Snyder 4e00539308 Fix MISINDENT on SweRV verilator_ext_tests with GenBlock (#6470 repair) 2025-09-23 19:49:57 -04:00
Geza Lore 800af37975
Internals: Refactor generate construct Ast handling (#6280) (#6470)
Internals: Refactor generate construct Ast handling (#6280)

We introduce AstNodeGen, the common base class of AstGenBlock,
AstGenCase, AstGenFor, and AstGenIf, which together represent all SV
generate constructs. Subsequently remove AstNodeFor, AstNodeCase
(AstCase is now directly derived from AstNodeStmt) and adjust internals
to work on the new representation.

Output is identical modulo hashes do to changed AstNode type ids, no
functional change intended.

Step towards #6280.
2025-09-23 19:49:01 +01:00
Wilson Snyder a647747260 Add IMPLICITSTATIC also on procedure variables. 2025-09-21 19:52:19 -04:00
Wilson Snyder 9e664a3921 Internals: Cleanup some V3LinkParse code; ignore whitespace if diff. No functional change. 2025-09-21 15:30:49 -04:00
Wilson Snyder ad6379b762 Internals: Cleanup some V3LinkParse code. No functional change intended. 2025-09-21 15:28:36 -04:00
Geza Lore d1eda66668
Deprecate clocker attribute and --clk option (#6463)
The only use for the clocker attribute and the AstVar::isUsedClock that
is actually necessary today for correctness is to mark top level inputs
of --lib-create blocks as being (or driving) a clock signal. Correctness
of --lib-create (and hence hierarchical blocks) actually used to depend
on having the right optimizations eliminate intermediate clocks (e.g.:
V3Gate), when the top level port was not used directly in a sensitivity
list, or marking top level signals manually via --clk or the clocker
attribute. However V3Sched::partition already needs to trace through the
logic to figure out what signals might drive a sensitivity list, so it
can very easily mark all top level inputs as such.

In this patch we remove the AstVar::attrClocker and AstVar::isUsedClock
attributes, and replace them with AstVar::isPrimaryClock, automatically
set by V3Sched::partition. This eliminates all need for manual
annotation so we are deprecating the --clk/--no-clk options and the
clocker/no_clocker attributes.

This also eliminates the opportunity for any further mis-optimization
similar to #6453.

Regarding the other uses of the removed AstVar attributes:
- As of 5.000, initial edges are triggered via a separate mechanism
  applied in V3Sched, so the use in V3EmitCFunc.cpp is redundant
- Also as of 5.000, we can handle arbitrary sensitivity expressions, so
  the restriction on eliminating clock signals in V3Gate is unnecessary
- Since the recent change when Dfg is applied after V3Scope, it does
  perform the equivalent of GateClkDecomp, so we can delete that pass.
2025-09-20 15:50:22 +01:00
Wilson Snyder 4e866fd710 Add error on module automatic variables. 2025-09-19 22:05:03 -04:00
Geza Lore f39d6e6108
Deprecate sensitivity list on public_flat_rw attributes (#6443)
These are no longer required for correct scheduling. They are still
accepted for backward compatibility, but have no effect on simulation
and are dropped in the front-end. Also removed the then redundant
AstAlwaysPublic class.

Fixes #6442
2025-09-16 22:38:53 +01:00
Wilson Snyder 3f7d13b2cf Internals: Less debug verbosity 2025-09-14 22:41:35 -04:00
Wilson Snyder a9f95f2f08 Fix false CONSTVAR error on initializers (#4992). 2025-09-09 19:27:43 -04:00
Wilson Snyder 67f26508ba Support `$sscanf %t` 2025-09-01 14:40:22 -04:00
Igor Zaworski b95a974ff1
Support generic interfaces (#6272) 2025-08-22 06:44:35 -04:00
Wilson Snyder c90f9e53b7
Add ALWNEVER warning, for `always @*` that never execute (#6291) (#6303) 2025-08-18 12:00:53 -04:00
Wilson Snyder 88046c8063 Internals: Rename AstSenTree pointers to sentreep. No functional change intended except JSON. 2025-08-17 19:14:34 -04:00
Wilson Snyder 6467351752 Add error on class 'function static'. 2025-08-05 17:12:00 -04:00