Commit Graph

533 Commits

Author SHA1 Message Date
Wilson Snyder c801237ce8 Add `--preproc-defines`. 2025-11-01 23:27:43 -04:00
Wilson Snyder d4aa00dbeb Change `--preproc-comments` to be new name of `--pp-comments` option. 2025-11-01 21:59:16 -04:00
Geza Lore 2a0b331ee3 Fix -G and -pvalue with --hierarchical.
Properly strip these from the hier_block builds, but not from the top
level wrapper. Improve existing test to cover.
2025-10-30 12:04:12 +00:00
Geza Lore ffbb3229a8
Change default thread pool sizes to respect processor affinity (#6604)
Instead of using the number of processors in the host, use the number of
processors available to the process, respecting cpu affinity
assignments. Without pthreads, fall back and use the number of
processors in the host as before.

This is now applied everywhere so runing `nuamctl -C 0-3 verilator` or
`numactl -C 0-3 Vsim` should behave as if the host has 4 cores (e.g.
like in CI jobs)
2025-10-28 18:10:40 +00:00
Geza Lore 766514bdcf
Fix --hierarchical with --binary (#6602)
Used to fail with "can't use --exe with --lib-create", and we didn't
have any tests for it before. (The equivalent --main --exe --build
--timing works)
2025-10-28 17:02:21 +00:00
Wilson Snyder b652009235 Internals: Fix name of some static and thread variables. No functional change. 2025-10-27 20:49:41 -04:00
Wilson Snyder dd76a5b8ba Add t_dist_docs_options checks, and fix related docs and coverage issues 2025-10-25 10:53:24 -04:00
Wilson Snyder 61de46cea2 Add `--aslr` and `--no-aslr` options. 2025-10-20 19:41:32 -04:00
Wilson Snyder eae1e5bdf2 Internals/Tests: Cleanup some missing dev coverage items 2025-10-11 20:58:03 -04:00
Wilson Snyder 8785086bc8 Internals/Tests: Add `--debug-preproc-passthru` to cleanup some missing dev coverage items 2025-10-11 14:15:04 -04:00
Geza Lore 49c51af841
Deprecate '--make cmake' option (#6540) 2025-10-08 09:40:17 -04:00
Wilson Snyder 1a8f9f0483 Improve `lint_off` to allow multiple messages and comments (#2755 partial). 2025-10-07 22:49:42 -04:00
Geza Lore ce0a05691b
Internals: Improve coverage flow (#6526)
See addes "Code coverage" section in docs/internals.rst
2025-10-03 17:18:24 +01:00
Geza Lore 62dbbbba85 Internals: Rename --enable-asan to --enable-dev-asan and related 2025-10-03 12:26:48 +01:00
Wilson Snyder a7e6efb4c0 Internals: Some prep from branch towards multitrace (#5813 prep) 2025-09-27 20:54:26 -04:00
Wilson Snyder 8c7c6c594a Internals: Rename VStringSet/VStringList. No functional change. 2025-09-27 20:51:37 -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
Geza Lore 57d8bb5d1f
Internals: Always attempt to release resources on termination (#6416)
Replace std::exit with v3Global.exit, and make V3Error::vlAbort call
v3Global.shutdown. This gives us an opportunity to release resources to
facilitate leak checking even when exiting early on an error.

Note we still don't release most resources by default without
VL_LEAK_CHECKS, so there is no behaviour change there.
2025-09-10 13:20:19 -04:00
Geza Lore 056c3ee331
Testing: Add --enable-asan configure option to compile with AddressSanitizer (#6404) 2025-09-09 08:55:49 +01:00
Wilson Snyder 37c79532fe Add VERILATOR_SOLVER to `verilator -V` 2025-09-01 08:45:01 -04:00
Wilson Snyder ac2859bf24
Internals: Upgrade to clang-format-18 (#6333) 2025-08-25 20:47:48 -04:00
Geza Lore 327d55d13d
Internals: Fix remaining cppcheck errors (#6319)
Fixed the non const-related issue and added suppressions for the const
ones. With that `make cppcheck` should be clean.
2025-08-21 09:43:37 +01:00
Geza Lore 636a6b8cd2
Optimize complex combinational logic in DFG (#6298)
This patch adds DfgLogic, which is a vertex that represents a whole,
arbitrarily complex combinational AstAlways or AstAssignW in the
DfgGraph.

Implementing this requires computing the variables live at entry to the
AstAlways (variables read by the block), so there is a new
ControlFlowGraph data structure and a classical data-flow analysis based
live variable analysis to do that at the variable level (as opposed to
bit/element level).

The actual CFG construction and live variable analysis is best effort,
and might fail for currently unhandled constructs or data types. This
can be extended later.

V3DfgAstToDfg is changed to convert the Ast into an initial DfgGraph
containing only DfgLogic, DfgVertexSplice and DfgVertexVar vertices.

The DfgLogic are then subsequently synthesized into primitive operations
by the new V3DfgSynthesize pass, which is a combination of the old
V3DfgAstToDfg conversion and new code to handle AstAlways blocks with
complex flow control.

V3DfgSynthesize by default will synthesize roughly the same constructs
as V3DfgAstToDfg used to handle before, plus any logic that is part of a
combinational cycle within the DfgGraph. This enables breaking up these
cycles, for which there are extensions to V3DfgBreakCycles in this patch
as well. V3DfgSynthesize will then delete all non synthesized or non
synthesizable DfgLogic vertices and the rest of the Dfg pipeline is
identical, with minor changes to adjust for the changed representation.

Because with this change we can now eliminate many more UNOPTFLAT, DFG
has been disabled in all the tests that specifically target testing the
scheduling and reporting of circular combinational logic.
2025-08-19 15:06:38 +01:00
Wilson Snyder 050e5ddb5b Fix internal error after bad method 2025-07-23 17:17:35 -04:00
Wilson Snyder 7d43a935bd Add SPECIFYIGN warning for specify constructs that were previously silently ignored. 2025-07-18 19:32:34 -04:00
Geza Lore ce77bac99a
Break some combinational cycles in DFG (#6168)
Added an algorithm that can break some combinational cycles in DFG, by
attempting to trace driver logic until we escape the cycle. This can
eliminate a decent portion of UNOPTFLAT warnings. E.g. due to this code:

```systemverilog
assign a[0] = .....;
assign a[1] = ~a[0];
```
2025-07-10 18:46:45 +01:00
Wilson Snyder f77af4e6f6 Important: Change `--assert` to be the default; use `--no-assert` for legacy behavior and faster runtimes. 2025-07-03 19:36:28 -04:00
Geza Lore 7a3f1f16ca
Optimize DFG before V3Gate (#6141) 2025-07-01 17:55:08 -04:00
Wilson Snyder 916a89761e Add `--work` library-selection option (#5891 partial). 2025-06-29 20:17:27 -04:00
Geza Lore 2daa09a255
Optimize constify within Expand and Subst (#6111)
These passes blow up the Ast size on some designs, so delaying running V3Const
until after the whole pass can notably increase peak memory usage. In this
patch we apply V3Const per CFunc within these passes, which saves on memory.
Added -fno-const-eager to disable the intra-pass V3Const application, for
debugging.
2025-06-23 17:58:26 -04:00
Todd Strader 4b041c636f
Fix --x-initial and --x-assign random stability (#2662) (#5958) (#6018) (#6025) 2025-05-27 09:31:55 -04:00
Bartłomiej Chmiel 9cc4cc0efd
Add `--hierarchical-threads` (#6037) 2025-05-26 09:37:35 -04:00
Wilson Snyder 46c7b69c64 Internals: UINFO now includes newline itself. No functional change. 2025-05-22 20:29:32 -04:00
Wilson Snyder 640339ec36 Revert 'Fix --x-initial and --x-assign random stability (#2662) (#5958).' See (#6018).
Reverts 4581023805 plus line in Changes file
2025-05-17 20:27:03 -04:00
Wilson Snyder 66667b6172
Support SARIF JSON diagnostic output with `--diagnostics-sarif`. (#6017) 2025-05-17 15:46:15 -04:00
Todd Strader 4581023805
Fix --x-initial and --x-assign random stability (#2662) (#5958) 2025-05-16 13:54:51 -04:00
Wilson Snyder 680236b03e Internals: Redo post-error additional information to be part of error calls. 2025-05-10 16:20:12 -04:00
Wilson Snyder 0984fd045f Change `--trace` to `--trace-vcd`. 2025-04-05 10:46:39 -04:00
Wilson Snyder 7521c2c644 Standardize some error messages. 2025-03-23 19:51:54 -04:00
Wilson Snyder 48effad448 Add DEPRECATED warning on `--xml-only` and `--xml-output`. 2025-03-21 21:32:05 -04:00
Wilson Snyder c508fd5d24 Internals: Remove single-statement braces. No functional change. 2025-03-19 22:55:11 -04:00
Andrew Voznytsa 6a48d3bb83
Add `--make json` to enable integration with non-make/cmake build systems (#5799) 2025-03-11 19:57:21 -04:00
Wilson Snyder a2e91f3cf2 Internals: Add some const. No functional change. 2025-03-09 13:13:57 -04:00
Geza Lore d9701e6406
Automatically split some packed variables (#5843)
This patch adds a heuristic to V3SplitVar, and it attempts to split up
packed variables that are only referenced via constant index,
non-overlapping bit/range selects. This can eliminate some UNOPTFLAT cases.
2025-03-09 10:31:01 -04:00
Mateusz Gancarz 9b4509f7d9
Add `--trace-saif` for SAIF power traces (#5812) 2025-03-07 10:41:29 -05:00
Wilson Snyder d232923051 Change `--output-groups` to default to value of `--build-jobs`.
Those using build farms may need to now use `--output-groups 0` or otherwise.
2025-02-24 20:38:08 -05:00
Kamil Rakoczy 2e1fa8f338
Add `--preproc-resolve` for modules in preprocessor output (#5789)
Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2025-02-22 04:47:54 +10:00
Todd Strader 34ced254c0
Support expression coverage (#5719) 2025-02-19 16:42:23 -05:00
Krzysztof Bieganski 283f6c7433
Add `--preproc-token-limit` (#5768) 2025-02-07 10:32:12 -05:00
Wilson Snyder 6281385ee8 Commentary/Internals: Sort option names. No functional change. 2025-01-24 21:31:57 -05:00