Commit Graph

170 Commits

Author SHA1 Message Date
Wilson Snyder 9bde98e912 Commentary 2024-11-14 21:07:45 -05:00
Wilson Snyder 3ffea76e11 Add `--no-std-waiver` and default reading of standard lint waivers file (#5607). 2024-11-12 22:11:19 -05:00
Wilson Snyder 0bf413b260 Add `lint_off --contents` in configuration files. (#5606) 2024-11-12 20:21:16 -05:00
Wilson Snyder a5b2cb6ddf Commentary: Changes update 2024-11-12 17:19:42 -05:00
Wilson Snyder 779cf9248a Cleanup/standardize configuration file string handling 2024-11-12 11:29:27 -05:00
Wilson Snyder 4d95f6f7b8 Add `--waiver-multiline` for context-sensitive `--waiver-output`. 2024-11-11 20:00:26 -05:00
Wilson Snyder 7c8ff1d19c Add `--no-std-package` as subset-alias of `--no-std`. 2024-11-11 08:30:07 -05:00
Geza Lore 03bd1bfc63
Move Concat balancing from DFG to FuncOpt (#5602)
This means it applies more widely, e.g. inside sequential logic.
2024-11-10 17:23:11 +00:00
Geza Lore 77ef2cd487
Split up assignments to wides with Concat on the RHS (#5599)
Add a new pass to split up (recursively):

foo = {l, r};

into the following, with the right indices, iff the concatenation
straddles a wide word boundary.

foo[_:_] = r;
foo[_:_] = l;

This eliminates more wide temporaries.

Another 23% speedup on VeeR EH2 high_perf. Also brings the predicted
stack size from 8M to 40k.
2024-11-10 15:51:59 +00:00
Wilson Snyder 2c445e4bfd Commentary: Changes update 2024-10-07 21:44:07 -04:00
Mariusz Glebocki 0547108e3f
Add `-output-groups` to build with concatenated .cpp files (#5257)
Signed-off-by: Bartłomiej Chmiel <bchmiel@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Co-authored-by: Mariusz Glebocki <mglebocki@antmicro.com>
Co-authored-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Co-authored-by: Bartłomiej Chmiel <bachm44@gmail.com>
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
Co-authored-by: Ryszard Rozak <rrozak@antmicro.com>
2024-09-30 21:42:36 -04:00
Wilson Snyder e566b5a4f5 Change .vlt config files to be read before .v files (#5185). 2024-09-09 20:18:54 -04:00
Wilson Snyder 8db9c1d227 Commentary: Changes update 2024-08-21 08:40:14 -04:00
Bartłomiej Chmiel a730daabef
Support 'parameter type' in hierarchical blocks (#5309) (#5333) 2024-08-21 05:30:59 -04:00
Ryan Ziegler 947b6fd23f
Add `--emit-accessors` (#5182) (#5227) 2024-07-06 13:12:53 +01:00
Bartłomiej Chmiel 864a852bca
Add `--compiler-include` for additional C++ includes (#5139) (#5202) 2024-06-27 18:53:44 -04:00
Bartłomiej Chmiel 9e2c8aefc8
Add `--pins-sc-uint-bool` to force SystemC uint type (#5192) 2024-06-25 05:27:09 -04:00
Wilson Snyder f84592af49 Fix x-valued parameters with `--x-assign unique` (#5129). 2024-05-21 08:07:57 -04:00
Wilson Snyder 8fd038f88e Add `--localize-max-size` option and optimization (#5072). 2024-04-30 19:46:54 -04:00
Paul Wright a8b5738b44
Support __en/__out signals on top level inout ports (#4812) (#4856) 2024-04-11 09:02:58 -04:00
Szymon Gizler 8301fdc6d3
Add JSON AST dumps (#5020) 2024-03-28 07:32:18 -04:00
Wilson Snyder 4df9e2e0e5
Add printing summary reports (#4909) (#5018) 2024-03-25 07:03:17 -04:00
Wilson Snyder 91dd3c5fac Support 1800-2023 keywords. 2024-03-02 10:15:19 -05:00
Wilson Snyder e60f652a64 Commentary (#4936) 2024-03-01 17:32:26 -05:00
Yutetsu TAKATSUKASA 51ae8e13fb
Add --assert-case option (#4919) 2024-02-23 23:05:53 +09:00
Yutetsu TAKATSUKASA a951446f9b
Add --[no]-stop-fail option (#4904)
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
2024-02-19 21:26:58 +09:00
Wilson Snyder a187a16e56 Commentary: Changes update 2024-02-13 21:47:09 -05:00
Geza Lore cbc76a7816
Dump DFG patterns with --stats (#4889)
With --stats, we will print DFG pattern combinations, one per line, as
S-expressions to new stat files, together with their frequency, to aid
discovery of new peephole patterns.
2024-02-11 15:41:10 +00:00
Szymon Gizler d667b73e8d Add --json-only and related JSON dumping (#4715) (#4831). 2024-02-09 17:50:09 -05:00
Szymon Gizler c715cfc254
Add --valgrind switch (#4828) 2024-01-29 07:50:05 -05:00
Wilson Snyder d6f8ccd20b Add `unroll_disable` and `unroll_full` loop control metacomments (#3260). 2024-01-26 07:49:07 -05:00
Wilson Snyder d4c8a15407 Add --runtime-debug for Verilated executable runtime debugging. 2024-01-25 07:34:30 -05:00
Wilson Snyder 354a534d68 Add '--decorations node' for inserting debug comments into emitted code. 2024-01-24 21:51:47 -05:00
Wilson Snyder e76f29e5ba Copyright year update 2024-01-01 03:19:59 -05:00
Wilson Snyder 25ca965938 Commentary 2023-11-21 19:17:39 -05:00
Geza Lore dc346b7ffa
Remove deprecated options (#4663) 2023-11-04 17:28:36 +00:00
Wilson Snyder 6cdf8da3f7 Fix documentation line wrap (#4456) 2023-09-05 07:25:33 -04:00
Ethan Sifferman 8d1570db28
Add check for conflicting options e.g. binary+lintonly (#4409) 2023-08-29 19:55:37 -04:00
Frans Skarman e9cc2786b7
Add --no-trace-top option (#4422) 2023-08-19 04:51:29 -04:00
Wilson Snyder 3c964147be Add MISINDENT lint warning for misleading indentation. 2023-07-01 10:45:25 -04:00
Wilson Snyder cff37f0775 Add GENUNNAMED lint warning.
Also fix generate-for blocks with empty statements getting lost.
2023-07-01 08:31:53 -04:00
Don Williamson df2746de71
Add --main-top-name option for C main TOP name (#4235) (#4249) 2023-05-31 09:02:26 -07:00
Wilson Snyder c2a524d80b Commentary (#4175) 2023-05-07 08:36:03 -04:00
Iztok Jeras 2aa6a229ca
Change range order warning from LITENDIAN to ASCRANGE (#4010) 2023-03-20 20:44:11 -04:00
Ryszard Rozak 1ac721af8f
Add STATICVAR warning and convert to automatic (#4027) (#4030)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-03-17 07:48:41 -04:00
Andrew Nolte fc17ab280a
Add --public-depth to force public to a certain instance depth (#3952) 2023-03-09 21:48:05 -05:00
Andrew Nolte 13c9877099
Add --public-params flag (#3990) 2023-03-08 19:38:26 -05:00
Wilson Snyder adf1de45de With -Wpedantic change ASSIGNIN to a warning 2023-02-21 16:45:35 -05:00
Wilson Snyder 026bbc306b Removed deprecated --cdc option. 2023-02-13 22:49:51 -05:00
Aleksander Kiryk 31130c4b4a
Fix std:: to be parsed first (#3864) (#3928) 2023-02-03 09:04:16 -05:00
Kamil Rakoczy 6ea725f479
Add --verilate-jobs option (#3889)
Currently this option isn't used, but in the future it will be used to specify parallelization of Verilation step.
2023-01-22 21:52:52 -05:00
Ryszard Rozak 4784daa7dc
Add IMPLICITSTATIC warning when a ftask/function is implicitly static (#3839) 2023-01-05 17:42:05 -05:00
Wilson Snyder b24d7c83d3 Copyright year update 2023-01-01 10:18:39 -05:00
Aleksander Kiryk c2b09e35f8
Support unpacked structs (#3802) 2022-12-20 19:22:42 -05:00
Wilson Snyder afc66f6a85 Fix make jobserver with submakes (#3758). 2022-12-11 14:19:40 -05:00
Wilson Snyder b6cdae30f6 docs: Fix grammar. 2022-12-10 20:09:47 -05:00
Wilson Snyder d61ad04f32 docs: Fix and test for AsciiDoc breaks (#3728) 2022-12-09 21:01:33 -05:00
Wilson Snyder fc2654f1f6 msg 2022-12-09 20:17:19 -05:00
Mariusz Glebocki d0e7177d8e
Disable stack size limit (#3706) (#3751) 2022-11-19 14:44:54 -05:00
Wilson Snyder 0a045a7bf6 Change ENDLABEL from warning into an error. 2022-11-12 12:09:48 -05:00
Kamil Rakoczy d6126c4b32
Remove --no-threads; require --threads 1 for single threaded (#3703). 2022-11-05 08:47:34 -04:00
Wilson Snyder 7e1b92fa75 Add --get-supported to determine what features are in Verilator (#3688). 2022-10-20 21:42:30 -04:00
Krzysztof Bieganski bec0b7d4d0
Disallow delays with `--lib-create` (#3691) 2022-10-19 20:52:29 -04:00
Topa Topino 46c5764383
Split UNUSED warning into genvar, param, and signal warnings (#3607) 2022-10-17 19:51:13 -04:00
Wilson Snyder cb7b024e8f Commentary: Spelling, and add upgrade notes (#3462) 2022-10-16 11:10:41 -04:00
Geza Lore f87fe4c3b4 DfgPeephole: add constant folding for all integer types
Also added a testing only -fno-const-before-dfg option, as otherwise
V3Const eats up a lot of the simple inputs. A lot of the things V3Const
swallows in the simple cases can make it to DFG in complex cases, or DFG
itself can create them during optimization. In any case to save
complexity of testing DFG constant folding, we use this option to turn
off V3Const prior to the DFG passes in the relevant test.
2022-10-05 12:05:40 +01:00
Wilson Snyder 90009b9ec7 Commentary: Fix sphinx doc warnings 2022-10-02 16:47:32 -04:00
Wilson Snyder 880cac2fdd Merge branch 'master' into develop-v5 2022-10-01 11:24:55 -04:00
Marcel Chang 526e6b9fc7
Add --dump-tree-dot to enable dumping Ast Tree .dot files (#3636) 2022-10-01 11:05:33 -04:00
Wilson Snyder cd2a5771b8 Add --timing to --binary (#3625). 2022-09-28 19:02:23 -04:00
Wilson Snyder b92173bf3d Add --binary option as alias of --main --exe --build (#3625). 2022-09-28 09:04:33 -04:00
Geza Lore 47bce4157d
Introduce DFG based combinational logic optimizer (#3527)
Added a new data-flow graph (DFG) based combinational logic optimizer.
The capabilities of this covers a combination of V3Const and V3Gate, but
is also more capable of transforming combinational logic into simplified
forms and more.

This entail adding a new internal representation, `DfgGraph`, and
appropriate `astToDfg` and `dfgToAst` conversion functions. The graph
represents some of the combinational equations (~continuous assignments)
in a module, and for the duration of the DFG passes, it takes over the
role of AstModule. A bulk of the Dfg vertices represent expressions.
These vertex classes, and the corresponding conversions to/from AST are
mostly auto-generated by astgen, together with a DfgVVisitor that can be
used for dynamic dispatch based on vertex (operation) types.

The resulting combinational logic graph (a `DfgGraph`) is then optimized
in various ways. Currently we perform common sub-expression elimination,
variable inlining, and some specific peephole optimizations, but there
is scope for more optimizations in the future using the same
representation. The optimizer is run directly before and after inlining.
The pre inline pass can operate on smaller graphs and hence converges
faster, but still has a chance of substantially reducing the size of the
logic on some designs, making inlining both faster and less memory
intensive. The post inline pass can then optimize across the inlined
module boundaries. No optimization is performed across a module
boundary.

For debugging purposes, each peephole optimization can be disabled
individually via the -fno-dfg-peepnole-<OPT> option, where <OPT> is one
of the optimizations listed in V3DfgPeephole.h, for example
-fno-dfg-peephole-remove-not-not.

The peephole patterns currently implemented were mostly picked based on
the design that inspired this work, and on that design the optimizations
yields ~30% single threaded speedup, and ~50% speedup on 4 threads. As
you can imagine not having to haul around redundant combinational
networks in the rest of the compilation pipeline also helps with memory
consumption, and up to 30% peak memory usage of Verilator was observed
on the same design.

Gains on other arbitrary designs are smaller (and can be improved by
analyzing those designs). For example OpenTitan gains between 1-15%
speedup depending on build type.
2022-09-23 16:46:22 +01:00
Geza Lore ddb678cc5b Merge branch 'master' into develop-v5 2022-09-22 17:33:36 +01:00
Geza Lore 63c694f65f Streamline dump control options
- Rename `--dump-treei` option to `--dumpi-tree`, which itself is now a
  special case of `--dumpi-<tag>` where tag can be a magic word, or a
  filename
- Control dumping via static `dump*()` functions, analogous to `debug()`
- Make dumping independent of the value of `debug()` (so dumping always
  works even without the debug flag)
- Add separate `--dumpi-graph` for dumping V3Graphs, which is again a
  special case of `--dumpi-<tag>`
- Alias `--dump-<tag>` to `--dumpi-<tag> 3` as before
2022-09-22 17:24:41 +01:00
Wilson Snyder 550a5111b7 Commentary 2022-09-20 20:28:43 -04:00
Wilson Snyder d162619bd3 Merge branch 'master' into develop-v5 2022-09-20 20:06:21 -04:00
Wilson Snyder fc4ffd454e Rename --bin to --build-dep-bin. 2022-09-18 10:32:43 -04:00
Geza Lore af305bf280 Merge branch 'master' into develop-v5 2022-09-16 16:24:36 +01:00
Wilson Snyder ab6e1c2399 Commentary on --main 2022-09-15 20:26:08 -04:00
Kamil Rakoczy da20da264b
Add --build-jobs, and rework arguments for -j (#3623) 2022-09-15 08:28:58 -04:00
Geza Lore 27031ed688 Merge branch 'master' into develop-v5 2022-09-15 10:28:35 +01:00
Wilson Snyder 75fd71d7e5 Add --main to generate main() C++ (previously was experimental only) (#3265). 2022-09-14 20:18:40 -04:00
Krzysztof Bieganski 39af5d020e
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.

Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).

The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.

There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
  with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
  them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
  resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
  blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
  for suspending a stack of coroutines (normally, C++ coroutines are
  stackless).

There is a new visitor in `V3Timing.cpp` which:
  * scales delays according to the timescale,
  * simplifies intra-assignment timing controls and net delays into
    regular timing controls and assignments,
  * simplifies wait statements into loops with event controls,
  * marks processes and tasks with timing controls in them as
    suspendable,
  * creates delay, trigger scheduler, and fork sync variables,
  * transforms timing controls and fork joins into C++ awaits

There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.

There is also a function that transforms forked processes into separate
functions.

See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 13:26:32 +01:00
Wilson Snyder ebb37b0156 Merge branch 'master' into develop-v5 2022-08-20 14:02:09 -04:00
Wilson Snyder 90dc04cf93 Add --future0 and --future1 options. 2022-08-20 14:01:13 -04:00
Wilson Snyder b25b798dbe Merge branch 'master' into develop-v5 2022-07-04 13:20:03 -04:00
Wilson Snyder fa99cbbc73 Commentary: Fix mis-sorted option names. No functional change. 2022-06-21 19:28:26 -04:00
Wilson Snyder e7ca4a69e3 Merge branch 'master' into develop-v5 2022-06-19 15:22:09 -04:00
Geza Lore 0c2c097377 Add -fno-merge-cond-motion option
This disables code motion during V3MergeCond, for debugging.
2022-06-13 14:16:11 +01:00
Wilson Snyder 0f324c8309 Merge branch 'master' into develop-v5 2022-06-04 11:59:49 -04:00
Wilson Snyder 67f7432dd7 Commentary (#3436). 2022-06-04 08:37:42 -04:00
Wilson Snyder ada58465b2 Add -f<optimization> options to replace -O<letter> options (#3436). 2022-06-03 20:43:16 -04:00
Wilson Snyder 173f57c636 Changed --no-merge-const-pool to -fno-merge-const-pool (#3436). 2022-06-03 19:41:59 -04:00
Geza Lore b51f887567
Perform VCD tracing in parallel when using --threads (#3449)
VCD tracing is now parallelized using the same thread pool as the model.
We achieve this by breaking the top level trace functions into multiple
top level functions (as many as --threads), and after emitting the time
stamp to the VCD file on the main thread, we execute the tracing
functions in parallel on the same thread pool as the model (which we
pass to the trace file during registration), tracing into a secondary
per thread buffer. The main thread will then stitch (memcpy) the buffers
together into the output file.

This makes the `--trace-threads` option redundant with `--trace`, which
now only affects `--trace-fst`. FST tracing uses the previous offloading
scheme.

This obviously helps a lot in VCD tracing performance, and I have seen
better than Amdahl speedup, namely I get 3.9x on XiangShan 4T (2.7x on
OpenTitan 4T).
2022-05-29 19:08:39 +01:00
Geza Lore 599d23697d
IEEE compliant scheduler (#3384)
This is a major re-design of the way code is scheduled in Verilator,
with the goal of properly supporting the Active and NBA regions of the
SystemVerilog scheduling model, as defined in IEEE 1800-2017 chapter 4.

With this change, all internally generated clocks should simulate
correctly, and there should be no more need for the `clock_enable` and
`clocker` attributes for correctness in the absence of Verilator
generated library models (`--lib-create`).

Details of the new scheduling model and algorithm are provided in
docs/internals.rst.

Implements #3278
2022-05-15 16:03:32 +01:00
Wilson Snyder c2328ef46a Spelling fixes. 2022-05-14 16:12:57 -04:00
Wilson Snyder 71dedccbbe Support compile time trace signal selection with tracing_on/off (#3323). 2022-05-12 22:28:08 -04:00
Wilson Snyder 33105f017c Commentary 2022-03-30 20:17:59 -04:00
Wilson Snyder e02f97854c Deprecate 'vluint64_t' and similar types (#3255). 2022-03-27 15:27:40 -04:00
Geza Lore b1b5b5dfe2 Improve run-time profiling
The --prof-threads option has been split into two independent options:
1. --prof-exec, for collecting verilator_gantt and other execution
related profiling data, and
2. --prof-pgo, for collecting data needed for PGO

The implementation of execution profiling is extricated from
VlThreadPool and is now a separate class VlExecutionProfiler. This means
--prof-exec can now be used for single-threaded models (though it does
not measure a lot of things just yet). For consistency VerilatedProfiler
is renamed VlPgoProfiler. Both VlExecutionProfiler and VlPgoProfiler are
in verilated_profiler.{h/cpp}, but can be used completely independently.

Also re-worked the execution profile format so it now only emits events
without holding onto any temporaries. This is in preparation for some
future optimizations that would be hindered by the introduction of function
locals via AstText.

Also removed the Barrier event. Clearing the profile buffers is not
notably more expensive as the profiling records are trivially
destructible.
2022-03-27 15:57:30 +02:00