Commit Graph

5868 Commits

Author SHA1 Message Date
em2machine 2995748d46
Fix parameterized class function (#6659) (#6802) 2025-12-12 04:17:08 -08:00
Yilou Wang f097e8a34e
Fix write variable placement for global constraints (#6740) (#6750) (#6797) 2025-12-11 14:16:34 -05:00
Geza Lore af1be26b96
Fix O(n*2) analysis in const-bit-op-tree (#6791)
Note this might miss some cases where a sub-tree within an And/Or/Xor
tree is optimizeable, but not the whole tree, but in practice this seems
to work better than the alternative of keeping a set of failed nodes and
bail early.
2025-12-11 14:32:25 +00:00
em2machine afc4bed0f8
Fix generate function(s) inside of generate blocks (#1011) (#6789) 2025-12-10 20:53:19 -05:00
Wilson Snyder 5d768a4a20 Internals: Fix rand dump text 2025-12-10 19:07:51 -05:00
Pawel Kojma 37318ab2bd
Fix input sampling of clocking block signals (#6788) 2025-12-10 10:59:08 -05:00
Wilson Snyder 075d624b29 Add SUPERNFIRST error on super.new on non-first statement (#6784). 2025-12-09 19:22:59 -05:00
Ryszard Rozak 0f355c717e
Fix `disable iff` in simple properties (#6783) 2025-12-09 07:18:32 -05:00
Wilson Snyder ec38fb723d Internals: Remove added debug to avoid false leak warning 2025-12-08 21:33:21 -05:00
Wilson Snyder a3f913c5b1 Fix randomize call in parameterized class 2025-12-08 20:26:53 -05:00
Wilson Snyder 0f46f6eb40 Internals: Fix missing override 2025-12-08 20:17:40 -05:00
Wilson Snyder 29ae520e69 Fix class param static not found again error (#6768). 2025-12-08 20:11:28 -05:00
Wilson Snyder bd87dfc579 Internals: Add --debug-exit-elab; remove --debug-exit-uvm* 2025-12-08 18:02:46 -05:00
em2machine d0a5da2445
Fix typedef derived from type defined inside interface (#3441) (#6776) 2025-12-08 15:36:21 -05:00
Geza Lore 7e55c62cac
Improve combinational cycle fixup in Dfg (#6744) (#6746)
Now that we have an efficient algorithm to analyse which bits in a
combinational cycle are not dependent on the cycle, can simplify the
cycle fixup algorithms. Remove FixUpSelDrivers: this was a heuristic
to save on the expensive independent bits analysis, but itself can
cause a performance problem on certain inputs that result in a large
number of attempted fixups. Doing this simplifies the driver tracing
algorithm, and because we now only attempt to trace drivers that are
known to be independent of the cycles, it should always succeed...
Unless of course there is a mismatch between the independent bit
analysis ant the driver tracing algorithm. In such case (when we managed
to prove independence, but then fail to trace a driver), we will crash,
which is still easier to sv-bugpoint than a performance bug.

Fixes #6744
2025-12-08 18:43:21 +00:00
Geza Lore 1baa832efc
Fix reordering of function body inlined on RHS of <= NBA (#6780) 2025-12-08 18:42:52 +00:00
Christian Hecken 9a23711ff9
Fix stale pointers in VerilatedImpData::m_hierMap (#6726) 2025-12-07 15:42:29 -05:00
Wilson Snyder ae480c5f76 Fix enum item references in class extends with parameters. 2025-12-07 15:26:52 -05:00
Wilson Snyder 8130fed777 Fix pre/post_randomize on extended classes (#6467). 2025-12-07 14:14:48 -05:00
Wilson Snyder ba9d6df20c Fix class-in-class extends with parameters (#6773). 2025-12-07 13:38:25 -05:00
Wilson Snyder 4b02e32314 Fix DPI under param class (#6733 partial) 2025-12-07 13:30:54 -05:00
Wilson Snyder 7946e9d197 Internals: Add some missing cfunc attribute dumps 2025-12-07 13:25:37 -05:00
Wilson Snyder 35a794687b Internals: Add some additional dangling checks. No functional change intended 2025-12-07 13:25:37 -05:00
Matthew Ballance 0e03ab2a57
Fix crash when super.new() called without a base class (#6772) 2025-12-06 18:08:51 -05:00
Wilson Snyder 040484cc3f Fix extern function that returns parametrized class (#4924). 2025-12-06 16:16:06 -05:00
Geza Lore 5278f42025 Fix Dfg assertion on out of bounds selects 2025-12-06 15:31:27 +00:00
em2machine c2cba8bfc6
Fix localparam type assignment from interface type parameters (#6637) (#6732) 2025-12-06 09:42:59 -05:00
github action ba3794a495 Apply 'make format' 2025-12-06 14:12:22 +00:00
Dan Ruelas-Petrisko 8c252952db
Support `config` instance clauses (#5891 partial) (#6745) 2025-12-06 09:11:20 -05:00
Geza Lore 18dd44e970
Fix --lib-create with multi-bit clocks (#6759) 2025-12-05 15:21:35 +00:00
Geza Lore e2c05ae15e
Fix select assignment expansion (#6757) 2025-12-05 10:07:53 -05:00
Geza Lore df7726c40d Fix Dfg reusing volatile variables
Forceable/externally written variables cannot be used as the canonical
result variable for a Dfg value as the variables value can be
inconsistent with its Dfg drivers (e.g. when forced).
2025-12-05 14:12:36 +00:00
Wilson Snyder cfada791e6 Internals: Fix leak in covergroup, last commit 2025-12-05 04:14:24 -05:00
Wilson Snyder 2f4b178957 Support parsing only of covergroup.option.option_name 2025-12-04 21:55:55 -05:00
Ryszard Rozak f2c2daa017
Throw UNSUPPORTED on force / release statements with complex select expressions (#6755) 2025-12-04 14:06:47 +01:00
Yilou Wang 1fc86fd2f1
Fix randomize called within func/task (#6144) (#6753)
Co-authored-by: Udaya Raj Subedi <075bei047.udaya@pcampus.edu.np>
2025-12-04 07:18:07 -05:00
Yilou Wang 22cd9bcadc
Support rand_mode in global constraint gathering (#6740) (#6752) 2025-12-04 07:16:03 -05:00
Wilson Snyder 4426aff3d3 Internals: Fix coredump when dump with bad null enum itemp() 2025-12-03 21:35:59 -05:00
Wilson Snyder 7957701db8 Suppress unsupported for unused constant sequences 2025-12-03 21:23:48 -05:00
Matthew Ballance 3fc70b61d0
Fix internal fault when cross-class calling with DPI (#6735) (#6742)
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
2025-12-02 22:05:59 -05:00
Wilson Snyder 9a1dba357e Fix `randsequence return` inside function 2025-12-02 17:54:40 -05:00
Geza Lore 60fe2c873c
Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
Yilou Wang e25c66de07
Support complex std::randomize patterns (#6736) (#6737) 2025-12-01 16:26:16 -05:00
Wilson Snyder b9b6eb61d9 Support randsequence (#6131) 2025-11-30 09:04:42 -05:00
Geza Lore 35615c268b
Fix Dfg independent bits analysis performance (#6731) (#6743)
This removes a factor N from DfgBreakCycles, by doing the necessary data
flow analysis for the entire graph up front, and resulting the result for
all subsequent cycle fixups in the current iteration.

Fixes #6731
2025-11-29 19:01:22 +00:00
Wilson Snyder 287d8aef9e Fix duplicate member on interface always 2025-11-29 10:24:37 -05:00
Wilson Snyder 1583c79a8a Add assert (#6740 partial) 2025-11-28 09:55:19 -05:00
Jonathan Drolet f2e05bc0b7
Support unpacked struct in localparam (#6053 partial) (#6708) 2025-11-27 23:17:18 +04: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
Yilou Wang f4654a451b
Support array reference arguments into 'std::randomize()' (#6384) (#6719) 2025-11-26 15:50:24 +03:00
Wilson Snyder 8293a8d035 Fix multitop cross references (#6699). 2025-11-26 06:09:29 -05:00
Wilson Snyder 9155e2529b Internals: Add AstLoop statement constructor. No functional change. 2025-11-25 09:05:42 -05:00
Geza Lore 7cfe9b5356 Fix --prof-exec using --lib-create 2025-11-25 10:08:03 +00:00
Geza Lore d2ce5e62e7 Internals: Factor out --prof-exec section handling, add debug code 2025-11-25 10:08:03 +00:00
Wilson Snyder 840c8f5782 Internals: Auto-set useRandimizeMethods if new a AstRandCase. No functional change 2025-11-23 17:14:19 -05:00
Geza Lore 6ab8d56993
Optimize combinational loops through sign extension (#6724) 2025-11-23 19:26:51 +00:00
github action 28c78d3f9a Apply 'make format' 2025-11-23 01:21:13 +00:00
Dan Ruelas-Petrisko 9346b98cb6
Support `config` cell clauses (#6717) 2025-11-22 20:17:17 -05:00
Michael Bikovitsky 9632c614be
Fix X handling in UDPs (#6723) 2025-11-22 20:09:49 -05:00
Wilson Snyder 087ca15138 Support clocking output delay `1step` (#6681). 2025-11-22 17:40:40 -05:00
Wilson Snyder 6bba9f6c40 Internals: Defer interface typedefs, and add more tests (#3441 tests) 2025-11-21 19:42:22 -05:00
Igor Zaworski 98d0eac149
Fix of deleting linked node in V3Randomize (#6718)
Signed-off-by: Igor Zaworski <izaworski@internships.antmicro.com>
2025-11-21 07:07:50 -05:00
Jakub Wasilewski 0b8c369740
Add `sc_biguint` pragma (#6712) 2025-11-20 17:08:59 -05:00
github action 0703159dbc Apply 'make format' 2025-11-20 11:39:49 +00:00
Dan Ruelas-Petrisko a4e901135b
Support `config` default liblist (#6714) 2025-11-20 06:38:46 -05:00
Dan Ruelas-Petrisko 7edf6d4749
Support `--top` specifying `config` name (#6710) 2025-11-19 20:23:02 -05:00
Yilou Wang 00988aed70
Support General Global Constraints (#6709) (#6711) 2025-11-19 11:08:42 -05:00
Wilson Snyder e61012e30d Improve class extends error format 2025-11-16 21:00:13 -05:00
Wilson Snyder 84173048d2 Internals: Fix hasing node informational on AstCaseItem 2025-11-16 18:37:58 -05:00
github action 59bc4cf66b Apply 'make format' 2025-11-16 03:53:48 +00:00
Jean-Nicolas Strauss 6454a8802e
Fix stream operator widening (#6693) (#6697) 2025-11-15 22:52:52 -05:00
Yilou Wang 048c97f0ae
Support `std::randomize(){...}` (#4706) (#6573) 2025-11-14 14:32:01 -05:00
Ryszard Rozak f32095dd17
Support constexpr cycle delay in sequences (#6691) 2025-11-14 13:48:46 +01:00
Pawel Kojma 0dce8feead
Support parsing of dotted bins_expression (#6683) 2025-11-14 06:41:46 -05:00
Geza Lore 43975bcbdd
Optimize $past delayed variable reuse (#6689)
As the TODO in the original code suggested, we can re-use delayed values
of expressions if they appear in multiple $past calls.
2025-11-13 17:04:50 +00:00
Geza Lore a1056c6ae9
Add `-param`/`-port` options to `public_flat*` control directives (#6685) 2025-11-13 06:59:02 -05:00
Wilson Snyder 5c0ad5bd1f
Internals: cppcheck fixes. No functional change. (#6687) 2025-11-12 18:54:22 -05:00
Geza Lore 158f51fb54
Optimize functions reading external parameters as pure (#6684) 2025-11-12 08:27:42 -05:00
Geza Lore 0dc9f779f8
Add `-fno-inline-funcs-eager` option to disable excessive inlining (#6682) 2025-11-11 21:46:19 +00:00
Geza Lore c5f8656aa0
Fix bounds checking in non-inlined function (#6677) 2025-11-11 06:47:49 -05:00
Todd Strader 34f63396cb
Fix `free` collision (#6675) 2025-11-10 16:44:41 -05:00
Geza Lore 8e35c81399
Fix --expand-limit not respected for expressions (#6670) 2025-11-10 17:18:33 +00:00
Pawel Kojma 0062a422a4
Support `#1step` delay as statement (#6671) 2025-11-10 09:39:33 -05:00
Artur Bieniek 19bbeb24a6
Fix large array initialization (#6669) 2025-11-10 09:19:08 -05:00
Geza Lore c7ff73a083
Add --unroll-limit option (#6654) (#6668) 2025-11-09 12:46:25 -05:00
Geza Lore f4086496cb
Internals: Refactor file handling in EmitC* (#6667)
Combined the 3 various APIs used in EmitC* passes to handle file
opening/splitting into a single one. This removes a lot of copy paste
and makes everything consistent.

All C++ file handling goes through `EmitCBaseVisitor` using the
`openNewOutputHeaderFile`, `openNewOutputSourceFile` and
`closOutputFile` methods.

To emit a new kind of file, always derive a new class from
`EmitCBaseVisitor`, and use the above APIs, they will take care of
everything else in a consistent matter.

Subsequently also removed V3OutSCFile, and instead included
verilated_sc.h (which included the systemc header itself) in the two
files that need it (the primary model header, and the root module
header).

Functional changes:
- The PCH header did not use to have a corresponding AstCFile. Now it
  does, though this makes no difference in the output
- All 'slow' sources now have '__Slow' in the name automatically (the
  only one missing was for the ConstPool files)

Rest of the output is identical except for the header line now being
present in all generated C++ files.
2025-11-09 17:41:13 +00:00
Paul Swirhun aaafa6e8df
Fix local interface parameter hierarchical access (#6661) (#6666)
Co-authored-by: Paul Swirhun <paulswirhun@gmail.com>
2025-11-09 10:48:55 -05:00
Geza Lore 107776f324
Optimize repeated function call during symbol table init (#6665) 2025-11-08 16:48:00 -05:00
Wilson Snyder c493982511 Spelling fixes 2025-11-08 16:09:45 -05:00
github action c3cd379fd5 Apply 'make format' 2025-11-08 15:57:16 +00:00
Geza Lore 8ad8d4f807
Fix long C++ compilation due to VerilatedScope constructors (#6664)
The Syms class can contain a very large number of VeriltedScope
instances if `--vpi` is used, all of which need a call to the default
constructor in the constructor of the Syms class. This can lead to very
long compilation times, even without optimization on some compilers.

To avoid the constructor calls, hold VeriltedScope via pointers in the
Syms class, and explicitly new and delete them in the Syms
constructor/destructor. These explicit new/delte can then be
automatically split up into sub functions when the Syms
constructor/destructor become large.

Regarding run-time performance, this should have no significant effect,
most interactions are either during construction/destruction of the Syms
object, or are via pointers already. The one place where we used to
refer to VerilatedScope instances is when emitting an AstScopeName for
things like $display %m. For those there will be an extra load
instruction at run-time, which should not make a big difference.

Patch 3 of 3 to fix long compile times of the Syms module in some
scenarios.
2025-11-08 15:56:15 +00:00
Geza Lore ec3c9832de Fix crash on Dfg driver lookup
Fixes #6649
2025-11-08 13:55:56 +00:00
Geza Lore 3b7ddce207
Optimize run-time symbol table construction of public variables (#6663)
Follow up from #6662 `VerilatedScope::varInsert` can do its work in one
pass, no need to emit it twice.
2025-11-08 13:29:44 +00:00
Geza Lore 71dcf30c1f Do not include redundant headers in Syms implementation files
These are all available through the PCH
2025-11-08 10:36:41 +00:00
Geza Lore 0f96bd0f4d
Fix splitting of Syms constructor/destructor bodies (#6662)
Splitting of the Syms constructor/destructor were a bit arbitrarily
enforced with some parts splitable, while others not. There was also an
issue that even if the constructor and destructor bodies were split, we
would still end up with both in the same file that was double the size of
the intended split limit.

To fix, first all statements required in the Syms constructor and
destructor are gathered into a vector, then if the total number of
statements required for both is bigger than the split limit, the
implementations are split into sub-functions, one per file, as before,
ensuring that none of the functions are bigger than the split limit.

Also add __Slow suffix to the names of the files.

Patch 2 of 3 to fix long compile times of the Syms module in some
scenarios.
2025-11-08 10:36:12 +00:00
Geza Lore 2fabf50801
Use explicit ctor/dtor functions for VerilatedModules (#6660)
In order to avoid long compile times of the Syms constructor due to
having a very large number of member constructor sto call, move to using
explicit ctor/dtor functions for all but the root VerilatedModule. The
root module needs a constructor as it has non-default-constructible
members. The other modules don't.

This is only part of the fix, as in order to avoid having a default
constructor call the VerilatedModule needs to be default constructible.
I think this is now true for modules that do not contain strings or
other non trivially constructible/destructible variables.

Patch 1 of 3 to fix long compile times of the Syms module in some
scenarios.
2025-11-07 19:57:10 +00:00
Geza Lore 9d74984163 Fix non-deterministic output when splitting Syms file 2025-11-06 15:46:14 +00:00
Bartłomiej Chmiel 5adecb9fa3
Support multi-expression sequences (#6639) 2025-11-06 08:42:27 -05:00
Geza Lore f7e12e9219
Fix slow compilation of generated sampled value code (#6652)
For handling $past and similar functions, we used to collect sampled
values of variables at the beginning of the main _eval function. If we
have many of these, this can grow _eval very large which can make C++
compilation very slow. Apply usual fix of emitting the necessary code in
a separate function and then splitting it based on size.
2025-11-06 13:31:40 +00:00
Todd Strader 47b52800bf
Fix expression coverage of system calls (#6592) 2025-11-06 08:23:35 -05:00