Commit Graph
6863 Commits
Author SHA1 Message Date
Geza Lore f2114d3dc3 Internals: Make node type hashes stable with Ast changes
Instead of hashing node types by type id (which can change when
adding/removing Ast node types), astgen a stable hash based on node
name. This makes output more stable through Ast node
additions/deletions. Largely to help with 'make test-diff', should have
no user noticeable impact.
2026-09-26 10:37:56 +01:00
Geza Lore 33d63ac0b0 Internals: Identify $unit package by netlist pointer 2026-09-26 07:48:56 +01:00
em2machine 435af6afe6 Internals: Coverage cleanups before UAF fix (#8494) 2026-09-25 18:54:53 -04:00
Ethan Sifferman f6ff5b4cfb Fix elaboration of classes reached through deferred references (#8440) (#8510) 2026-09-25 17:34:47 -04:00
Marco Bartoli 4e29ecbf44 Fix disable fork and wait fork affecting pending NBA updates (#8483) 2026-09-25 16:35:51 -04:00
Deanyone Su 8b663f9c84 Optimize modport resolution with many interface instances (#8496) (#8497) 2026-09-25 14:38:18 -04:00
Marco Bartoli 3a76b29cb3 Add --coverage-max-bins and --coverage-max-real-bins and optimize covergroup bin generation (#8499) 2026-09-25 13:23:46 -04:00
Geza Lore 2e5e34d426 Internals: Set fabricated variable lifetimes
Set implicit net and traced coverage var lifetimes. No functional change.
2026-09-25 16:33:53 +01:00
Ryszard Rozak ba8e0a1437 Set status of finished process immediately (#8503)
Signed-off-by: Ryszard Rozak <[email protected]>
2026-09-25 09:26:22 -04:00
Geza Lore 84dec259c8 Fix constant oversized shifts in V3Premit
- Arithmetic right shift used the MSB of the C++ type as the sign bit,
  instead of the MSB at the Verilog width.
- Constant shift amounts with their top bit set were treated as
  negative, so the oversized shift was emitted as undefined behavior.
- Shifts of an impure operand were replaced by zero, discarding the
  side effects of the operand.
2026-09-25 14:12:00 +01:00
Geza Lore f2dbf210a8 Fix masking of right shifted values with dirty upper bits (#8500)
Fixes #8500
2026-09-25 11:12:30 +01:00
Geza Lore 1c94fbb5d6 Internals: Remove code dead after recent refactoring (#8498) 2026-09-25 08:30:34 +02:00
Kristof Marien 4202862472 Fix disabled random dynamic array of structs referenced in a constraint (#8454) (#8455) 2026-09-24 20:44:09 -04:00
Geza Lore 02546791da Internals: Remove V3LinkDot::linkDotArrayed (#8495)
Follow up to #8476 and #8493, now that elaboration fully expands
instance arrays, linkDotArrayed's only remaining purpose was to name
AstBegin blocks created after V3Width.

Fix up earlier passes to name all Begin blocks they create, or avoid
creating AstBegin in the first place if possible.

One warning about assigning to a modport input of a generic interface
port had to move into LinkLValue (previously this only used to be
reported by linkDotArrayed, as the type/modportness only resolved in
V3Param, and the lvalueness is subsequently only known in LinkLValue).

Then remove linkDotArrayed and simplify V3LinkDot.cpp
2026-09-24 22:41:24 +01:00
Geza Lore 9e03fed56b Support multi-dim interface instance arrays and interface array ports (#8493)
Companion to #8476, and this now moves all instance array and interface
array/modport array port expansion into elaboration. Fixes #2675.

Arrays of interface instances and interface array ports are now split
into their elements during elaboration, instead of after V3Width in
V3Inst::dearrayAll, which is removed.

Background: next to every interface instance 'intf ifs()', V3LinkCells
creates a companion variable 'ifs__Viftop' of type IfaceRefDType
referring to the instance, so the instantiating module can use the
interface as a value (in pin connections, virtual interface assignments,
arguments, ...) just like a module referring to it through an interface
port. For an array of instances 'intf ifs[N]()', this variable is an
unpacked array of IfaceRefDType, but an IfaceRefDType can only refer to
a single instance, so it must be split into a variable for each element,
and every use of the whole array replaced.

V3Param expands interface instance arrays like module instance arrays,
also splitting the __Viftop variable referencing the whole array into a
variable for each element cell ('ifs__BRA__i__KET____Viftop', the
companion of element cell 'ifs__BRA__i__KET__'), and splits each
interface array port into a variable for each element. The whole array
variables remain until all references to them are replaced, so V3LinkDot
can link hierarchical references to the correct specialization.

In V3Width, every reference to a whole interface array, including
hierarchical ones, is replaced by an AstInitArray of references to its
element variables, typed as the whole array, e.g. 'ifs' becomes
'{ifs[0], ifs[1], ...}. The AstInitArray keeps its own type, so its uses
are checked as those of the whole array. The whole array variables are
removed at the end of V3Width.

V3Width then treats a whole interface array replaced by an AstInitArray
as an ordinary unpacked array value:
- A constant select yields the element, a slice the selected elements.
- A pin of an element of a module instance array selects its part of an
  interface array connection like any other connection.
- A pin of an interface array port is split into a pin for each element
  port, connected left index to left index.
- A member of an element is referenced through the interface, as for
  any other interface.

This supports slices of interface arrays, and interface ports of
multi-dimensional module instance arrays connected to interface arrays.
2026-09-24 19:10:33 +01:00
Marco Bartoli 1aa5ab2e3a Support weight in coverage (#8472) 2026-09-24 14:01:45 -04:00
David Harris 88082a4e96 Support automatic bins for enum coverpoints (#8462) (#8464) 2026-09-24 09:58:22 -04:00
Geza Lore 976ec63531 Support multi dimensional module instance arrays (#2675) (#8476)
Arrays of module instances are now expanded into their element cells
during elaboration in V3Param, instead of after V3Width in
V3Inst::dearrayAll. Element cells are named as before
(name__BRA__i__KET__...), are ordered from the left index to the right
index, and hierarchical references to them resolve in linkDotParamed.

Arrays of interface instances are still expanded by V3Inst. They will
move in a follow up patch.

Algorithmically:
- V3Praram replaces an arrayed AstCell, with a scalar Cell for each
  element. linkDotParamed can resolve against these as normal.
- V3Width then fixes up the AstPins of each expanded Cell according to
  the LRM rules. Either leaving the alone to connect to all instances,
  or inserting ArraySel/Sel to connect the relevant part to the relevant
  instance.

Partial #2675
2026-09-24 10:59:41 +01:00
Marco Bartoli 26dd04c020 Fix ##0 synchronous drive overriding later drives (#8482) 2026-09-23 21:32:14 -04:00
Wilson Snyder 3d386f8fa5 Internals: Add VL_DO_DANGLING in some missing places. No functional change intended. 2026-09-23 18:27:40 -04:00
Bartłomiej Chmiel 7fd68b58ca Fix VPI discoverability of forceable unpacked struct members (#8445) 2026-09-23 14:54:55 -04:00
David Harris 729a51e26e Fix unsized condition not reduced to one bit (#8465) (#8466) 2026-09-23 14:50:16 -04:00
em2machine f82cdbeaa7 Fix typedef through a parameterized sub-interface (#7943 repair) (#8124) (#8128) 2026-09-23 14:32:23 -04:00
David Harris e6ecf3a014 Fix embedded covergroup calling an enclosing class method (#8461) (#8463) 2026-09-23 14:26:03 -04:00
Artur Bieniek e9f60f3282 Fix model failing when host has fewer cores than --threads (#8475)
Signed-off-by: Artur Bieniek <[email protected]>
2026-09-23 13:52:47 -04:00
Geza Lore f458e40060 Move module inlining after V3Scope (#8453)
This moves V3Inline after V3Scope. Not doing #2226 yet as it has some
fallout. The inlining heuristic is identical to before, but the node
counts might have shifted, so output can be perturbed.

There is a wart needing to be fixed up with how Fsm coverage is
collected, which inserts declarations into the MODULE for each instance
of that module, but we can fix it up.

Otherwise it's fairly straight forward translation of the old algorithm,
there are some quirks due to V3Scope, but nothing drastic. Moving it far
later might be hard though, because of the Fsm-like rewrites, but that's
not something we want to do anyway.

Fixes #1539
2026-09-23 18:15:46 +01:00
Noam Gallmann ceb7dde938 Fix V3OutJsonFile comma emission for nested JSON scopes (#8469) (#8474) 2026-09-23 13:03:45 -04:00
David Harris a99ced0ed4 Fix covergroup '0/'1 bin values not filling to coverpoint width (#8458) (#8460) 2026-09-23 12:50:39 -04:00
Marco Bartoli 39e2d8e853 Support dynamic cross layouts and fix covergroup bin exclusions priority (#8424) 2026-09-22 20:44:25 -04:00
David Harris 525d1fade3 Fix internal error on covergroup in a specialized parameterized class (#8450) (#8452) 2026-09-22 19:00:20 -04:00
Geza Lore 6eced23e84 Optimize instance port connections by aliasing rather than by assignment (#8427)
Use AstAlias instead of AstAssignW in V3Inst port connection lowering,
the same way as V3Inline would do if the instance is inlined. This
closes some of the gap between -finline and -fno-inline behaviour, and
is also required for moving V3Inline post scope, where it could not
create aliases anymore (hence required for future patch to maintain
current behaviour).

This is also a partial fix to #4698 (only when the connected expression
is a plain VarRef)
2026-09-22 20:27:21 +01:00
Tynan McAuley 0ab3915de6 Fix data race in AstTypeTable by serializing V3VariableOrder (#8451) 2026-09-22 12:49:23 -04:00
Patrick Creighton d637b665ce Synthesize successive whole-element array assignments (#8316)
Preserve previous whole-element drivers when synthesizing successive
constant-index assignments to unpacked arrays. Retain earlier values
through their assignment temporaries and keep the default while some
elements remain uncovered.

Complete the array-default tracing path exposed by this representation.
Keep public-write checks, control-flow restrictions, and scheduling
unchanged, and cover propagation and conservative fallbacks in the
existing DFG regressions.

Part of #7964; array-only follow-up to #7966.
2026-09-22 17:46:38 +01:00
Artur Bieniek f04eb8de81 Fix compound types in anonymous structs (#8449)
Signed-off-by: Artur Bieniek <[email protected]>
2026-09-22 12:41:11 -04:00
Artur Bieniek 08c9032927 Fix internal error when task without CFunc is left in the tree (#8437)
Signed-off-by: Artur Bieniek <[email protected]>
2026-09-22 11:36:20 -04:00
Wilson Snyder 5dab8ab576 Commentary 2026-09-22 09:13:31 -04:00
Wilson Snyder f883b1c858 Commentary. No functional change 2026-09-22 07:20:46 -04:00
Kornel Uriasz a1e6252e77 Internals: V3Randomize cleanup. No functional change intended (#8443)
Signed-off-by: Kornel Uriasz <[email protected]>
2026-09-22 06:34:32 -04:00
Jonathan Drolet e71d4e7fe5 Fix force read update sensitivity quadratic (#8431) (#8433) 2026-09-21 23:17:39 -04:00
Artur Bieniek 9e6af08c84 Fix false MULTIDRIVEN for writes in tasks never executed (#8401) 2026-09-21 20:57:40 -04:00
Kristof Marien 9ca90f414c Fix nested random dynamic arrays internal error (#8438) (#8439) 2026-09-21 20:50:37 -04:00
Kornel Uriasz ba1961c70b Fix unique constraint with multiple arrays (#8378)
Signed-off-by: Kornel Uriasz <[email protected]>
2026-09-21 17:47:18 -04:00
Wilson Snyder d321a5fa5d Update IEEE references 2026-09-21 08:46:58 -04:00
Kamil Danecki f954f4fd1d Support nested array element member access in constraint (#8243) 2026-09-21 08:10:53 -04:00
Geza Lore 46774fded9 Optimize away dead ports (#8426) 2026-09-21 02:02:59 +01:00
Geza Lore 3c05eef216 Fix losing coverage declarations if first in a module body (#8425) 2026-09-21 00:47:04 +01:00
Geza Lore 652495a932 Fix interface modport resolution against non-scope symbol tables (#8420)
LinkDotFindVisitor queued an AstIface into m_ifaceModSyms once for every
symbol table entry it was reached through. When creating scopes,
LinkDotIfaceVisitor resolves the modport items against the AstVarScopes,
which LinkDotScopeVisitor only inserts under the entry of an AstScope. A
hierarchical block wrapper builds a second copy of the instance tree in
the symbol table, and an interface reached through that copy has no
AstVarScopes to resolve against.

Resolving is destructive (the AstModportVarRef is deleted once resolved),
so this only worked when a resolvable entry happened to be processed
first, and failed with "Modport item not found" otherwise. When creating
scopes, register from the AstScopes instead, as those are exactly the
entries that hold the AstVarScopes.

Reproduces on t_hier_block with -fno-inline, added as a test.
2026-09-20 20:52:17 +01:00
Kaleb Barrett c4957ef206 Fix MSYS header include search to be after toolchain headers (#8422) 2026-09-20 15:14:11 -04:00
Shriyans Sahoo e71f6f3b7a Fix cache of boundary vertices in Dfg cycle breaking (#8308) 2026-09-20 17:05:56 +01:00
Geza Lore c545552cc1 Fix FSM coverage hierarchy being emitted as an absolute path (#8421)
AstNodeCoverDecl::hier() is relative to the scope the declaration is
emitted from, as V3EmitCImp builds the reported path as 'vlNamep + hierp',
and that is how V3Coverage uses it. V3FsmDetect instead set it to the
absolute scope name, so the instance path was counted twice.

This was masked whenever the owning module was inlined, as the declaration
then ended up in the top scope. With inlining disabled, an FSM in an
instance reported 'top.t.forced_wide_u.t.forced_wide_u'. In the inlined
case it reported 'top.TOP', leaking the internal top wrapper name into
user visible coverage output, rather than plain 'top'.
2026-09-20 16:21:40 +01:00