Commit Graph

1332 Commits

Author SHA1 Message Date
Marlon James e430ea13f4
Fix `vpi_get()` and `vpi_get64()` to return vpiUndefined on errors (#4795)
See IEEE 1800-2017 section 38.6 and 38.7.
2024-01-02 16:25:14 -05:00
Paul Wright 3adb31f53b
Fix $time not rounding up (#4790) (#4792) 2024-01-01 20:11:46 -05:00
Wilson Snyder 3eaed3b6f5
Remove deprecated 32-bit pointer mode (#4791). 2024-01-01 10:16:48 -05:00
Wilson Snyder e76f29e5ba Copyright year update 2024-01-01 03:19:59 -05:00
Wilson Snyder 4655ee014b Fix max multiply width. (#4781) 2023-12-31 11:42:06 -05:00
Wilson Snyder ca3b5fbe99 Add verilated asserts that VL_MULS_MAX_WORDS does not overflow (#4781). No functional change intended. 2023-12-30 15:31:58 -05:00
Wilson Snyder 9de6612cde Avoid shift by 32 even if later masked, to avoid sanitizer warning (#4781). No functional change intended. 2023-12-30 14:46:57 -05:00
Rasfunk 2d7e8b58e4
Require C++14 or newer (#4784) (#4786) 2023-12-29 10:39:00 -05:00
Wilson Snyder 1a43afe6f7 Fix $finish twice to no longer exit (#4757). 2023-12-24 11:02:52 -05:00
Wilson Snyder 69b779b4a8 Internals: Cleanup cpp-check warnings. No functional change. 2023-12-20 07:49:03 -05:00
Todd Strader 5ec9bfc47d
Support packages in vpi_handle_by_name() (#4768) 2023-12-15 17:32:23 -05:00
Todd Strader 1066f06ec1
Support VPI parameter iteration (#4765) 2023-12-15 13:53:13 -05:00
Todd Strader fced4d6e57
Support vpiConstType in vpi_get() (#4761) 2023-12-14 20:37:47 -05:00
Ryszard Rozak a811f2e17d
Support inside operator on unpacked arrays and queues (#4751) 2023-12-12 09:20:22 +01:00
Geza Lore 5d99534d54
Improve W primitive operations with -Oz (#4733) 2023-12-02 22:59:30 +00:00
Geza Lore f048cff093
Add inline for VL_ATTR_ALWINLINE, even on non GNU-C platforms (#4734)
This is required to avoid multiple definition errors at link time for
functions defined in headers and marked VL_ATTR_ALWINLINE.
2023-12-02 21:51:59 +00:00
Krzysztof Boroński bd38c8fe3c
Fix # 0 delays for process resumption, etc. (#4697) 2023-12-01 13:08:58 -05:00
Todd Strader 9a0748d8ed
vpi_iterate packages with vpiInstance (#4726) 2023-12-01 07:34:09 -05:00
Wilson Snyder a022b672a0 Fix 0**0 with wide numbers (#4721). 2023-11-26 17:11:22 -05:00
Wilson Snyder 58d9a5ebac Use newline instead of endl, for fewer stream flushes 2023-11-24 11:45:52 -05:00
Wilson Snyder c8063e5732 Internals: Misc cleanups in V3Graph and V3Dead. No functional change. 2023-11-12 22:08:08 -05:00
Wilson Snyder 30a0d62436 Fix assignment of class reference to itself causing double free.
Test in next commit.
2023-11-12 07:30:56 -05:00
Wilson Snyder 91d0f25442 Internals: Fix style of iterator. No functional change. 2023-11-11 20:52:23 -05:00
Wilson Snyder 4a10c9ef6f Internals: Rename. No functional change. 2023-11-11 20:47:10 -05:00
Wilson Snyder 9a0254a118
Optimize timing-delayed queue (#4584). (#4669) 2023-11-11 10:04:10 -05:00
Wilson Snyder f3ae4b8786 Fix spelling 2023-11-10 23:25:53 -05:00
Anthony Donlon ab06ace1f6
Fix trace when using SystemC with certain configurations (#4676) 2023-11-09 07:48:23 -05:00
Marlon James 5ba7084815
Fix VPI TOP level variable iteration (#3919) (#4618) 2023-11-07 07:47:55 -05:00
Wilson Snyder dc10118d3b
Fix C++20 compilation errors (#4670) 2023-11-06 07:13:31 -05:00
Geza Lore dc346b7ffa
Remove deprecated options (#4663) 2023-11-04 17:28:36 +00:00
Geza Lore 30318a6654 C++11 cleanup 2023-10-28 11:26:48 +01:00
Ryszard Rozak e6135981a5
Fix dynamic casts of null values (#4631) 2023-10-27 15:58:40 +02:00
Chih-Mao Chen 98252634fc
Include systemc instead of systemc.h in model header files (#4622) (#4623)
This may require that SystemC programs add:
using namespace sc_core;
using namespace sc_dt;
2023-10-26 14:36:18 -04:00
Krzysztof Boroński a87fb57656
Allow assigning events (#4403)
Signed-off-by: Krzysztof Boronski <kboronski@antmicro.com>
2023-10-26 16:38:47 +02:00
Krzysztof Boroński f91259f46d
Fix insertion at queue's end (#4619)
Signed-off-by: Krzysztof Boronski <kboronski@antmicro.com>
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
2023-10-25 17:41:28 +02:00
Marlon James cf6e362972
Support VPI variables of real and string data types (#4594) 2023-10-24 20:46:20 -04:00
Geza Lore 95c4ade718
Unify code generation for trace declarations in both trace formats (#4612)
This patch adds some abstract enums to pass to the trace decl* APIs, so
the VCD/FST specific code can be kept in verilated_{vcd,fst}_*.cc, and
removed from V3Emit*. It also reworks the generation of the trace init
functions (those that call 'decl*' for the signals) such that the scope
hierarchy is traversed precisely once during initialization, which
simplifies the FST writer. This later change also has the side effect of
fixing tracing of nested interfaces when traced via an interface
reference - see the change in the expected t_interface_ref_trace - which
previously were missed.
2023-10-24 16:33:29 +01:00
Geza Lore d1b6224c2b
Associate trace codes with function indices (#4610)
For each traced variable, also register the trace function index that
will write it.
2023-10-23 16:01:55 +01:00
Geza Lore 165a2ef1b8 Separate tracing of const values from non-const values
Some values emitted to the trace files are constant (e.g.: actual
parameter values), and never change. Previously we used to trace these
in the 'full' dumps, which also included all other truly variable
signals. This patch introduces a new generated trace function 'const',
to complement the 'full' and 'chg' flavour, and 'const' now only
contains the constant signals, while 'full' and 'chg' contain only the
truly variable signals. The generate 'full' and 'chg' trace functions
now have exactly the same shape. Note that 'const' signals are still
traced using the 'full*' dump methods of the trace buffers, so there is
no need for a third flavour of those.
2023-10-23 14:07:52 +01:00
Ryszard Rozak 774c10396c
Fix try_put method of unbounded mailbox (#4608) 2023-10-23 14:33:22 +02:00
Marlon James 33c5b5feb8
Add sv_vpi_user.h from IEEE 1800-2017 Annex M (#4606) 2023-10-22 20:41:40 -04:00
Geza Lore 4c0edd2efb Improve --prof-exec infrastructure and report
Again --prof-exec have bit-rotted a little with all the recent changes
to the structure of the generated code. This patch contains a few
improvements:
- Repalce the eval/evl_loop begin/end events with generic
  section_push/section_pop events, that can be arbitrarily sprinkled
  into the generate code (so long as they are matched correctly) to
  measure various sections. The report then contains a nested profile
  of the sections, and the VCD trace shows the section names.
- Better handling of exec graphs
- Clearer overall statistics
2023-10-21 21:09:03 +01:00
Geza Lore a09506a0ad Trivial simplification of V3EmitCModel
Still some remains of the --threads 0 mode. Remove unnecessary complexity
from V3EmitCModel. (Also don't pretend there is an MTask in single
threaded mode, when there really isn't.)
2023-10-21 20:41:46 +01:00
Geza Lore b78ea06829 Make VL_LOCK_SPINS configurable
It's unlikely one value fits all use case, so making VL_LOCK_SPINS
configurable at model build time.

For testing, we reduce the value as we expect high contention.
2023-10-21 18:05:53 +01:00
Mariusz Glebocki c7a0613c57
Support Clang 16 (#4592) 2023-10-20 15:47:09 -04:00
Aleksander Kiryk 83a0085c4d
Support `wait fork` (#4586) 2023-10-20 07:13:57 -04:00
Wilson Snyder a773a52559 Cleanup some IEEE references 2023-10-19 19:26:36 -04:00
Wilson Snyder 263697e491 Commentary (#4580) 2023-10-18 08:15:55 -04:00
Wilson Snyder 8b44a54bb2
Support Verilated precompiled header compilations (#4580) 2023-10-18 08:08:15 -04:00
Ryszard Rozak 3bb9c7ee92
Fix dictionaries with keys of class types (#4576) 2023-10-17 17:15:24 +02:00
Krzysztof Bieganski 99ea16d7fd
Fix dynamic triggers for named events (#4571) 2023-10-16 11:06:41 -04:00
Aleksander Kiryk ad3bcbb1bb
Support `disable fork` (#4125) (#4569) 2023-10-16 14:02:29 +02:00
Wilson Snyder 46f8a659b3 Fix shift to remove operation side effects (#4563). 2023-10-14 22:34:37 -04:00
Wilson Snyder 3940a214d0 Internals: Reorder some shift functions for next commit. No functional change. 2023-10-14 22:23:58 -04:00
Varun Koyyalagunta edfd3d7206
Fix large constant buffer overflow (#4556) 2023-10-13 07:08:58 +09:00
Wilson Snyder d699caf255 Revert fix Verilated Makefile to get CXX etc. from environment (#4549) (#4554). 2023-10-12 04:22:58 -04:00
Gus Smith a4b7c39a9a
Fix Verilated Makefile to get CXX etc. from enviorment (#4549) (#4554) 2023-10-10 17:53:02 -04:00
Ryszard Rozak 1c738c6b83
Fix object destruction after a copy constructor (#4540) (#4541) 2023-10-05 07:21:33 -04:00
Wilson Snyder 537650a2cd Fix stream of 32 bit (#4536). 2023-10-03 22:10:50 -04:00
Ryszard Rozak a3c154dcd3
Fix this in a constructor (#4533) 2023-10-03 14:32:18 +02:00
Wilson Snyder 84ccb23098 Fix C++11 compiler constexpr return error 2023-09-26 22:43:17 -04:00
Anthony Donlon be45a9b7d5
Style: Update clang-format config to make formatted code consistent between versions. No functional change (#4520) 2023-09-26 15:05:57 -04:00
Wilson Snyder 470f480bc1 Fix -m32 compile issue 2023-09-19 07:23:35 -04:00
Wilson Snyder 24ff3155ae Support randc (#4349). 2023-09-18 21:17:21 -04:00
Kamil Rakoczy 8bd6d7c5b1
Internals: Add V3ThreadSafety (#4477) 2023-09-13 07:57:48 -04:00
Ryszard Rozak c40e34b134
Support assignments of stream expressions on queues to packed values (#4458) 2023-09-06 15:25:48 +02:00
Wilson Snyder 36932d31c4 Fix C++11 missing C++14's std::make_unique. 2023-09-01 18:07:15 -04:00
Wilson Snyder ed25aaaad9 Internals: Fix g++ std11 warning. No functional change. 2023-09-01 17:59:30 -04:00
Wilson Snyder 147aa41ba5 Internals: Fix virt call in constructor warning. No functional change. 2023-09-01 17:58:17 -04:00
Wilson Snyder 8c480fd39e Internals: Fix cppcheck warnings 2023-08-31 18:29:58 -04:00
Yinan Xu b4b74d72f0
Add prepareClone and atClone APIs for Verilated models (#3503) (#4444)
This API is used if the user copies the process using `fork`
and similar OS-level mechanisms. The `at_clone` member function
ensures that all model-allocated resources are re-allocated, such
that the copied child process/model can simulate correctly.

A typical allocated resource is the thread pool, which every model
has its own pool.
2023-08-30 07:02:55 -04:00
Ryszard Rozak 2daa32b98b
Support assignments of packed values to stream expressions on queues (#4401) 2023-08-25 11:24:12 +02:00
Aleksander Kiryk 7c7c92d2dd
Fix coroutine handle movement during queue manipulation (#4431) 2023-08-21 10:22:09 -04:00
Wilson Snyder 436f72582b Update GTKWave from upstream. 2023-08-19 06:57:43 -04:00
Anthony Donlon cbdee5a804
Fix Windows filename format, etc. (#3873) (#4421)
* Ignore CLion project files and CMake outputs
* Supporting stripping file path that contains backslash
* Set /bigobj flag and increase stack size for windows platform
* Fix MSVC warnings
2023-08-16 07:34:57 -04:00
Wilson Snyder 446f21d2a0 Tests: Fix more missing internal code coverage 2023-07-27 06:53:43 -04:00
Aleksander Kiryk f7d09c671a
Fix VlProcess not found (#4368) 2023-07-17 09:52:07 -04:00
Wilson Snyder 5be0813893 Explicity reference std:: in header files (#4338). No functional change intended. 2023-07-08 13:20:40 -04:00
Ryszard Rozak da043ca16d
Fix comparison of class objects (#4346) 2023-07-07 16:20:23 +05:00
Ryszard Rozak 97feba6898
Support locator methods with "with" on assoc arrays (#4335) 2023-07-04 18:11:15 +05:00
Ryszard Rozak 3d30527860
Fix unique..with method on queues of class objects (#4328) 2023-06-30 17:04:09 +02:00
Mariusz Glebocki 85b7f828b3
Internals: Use `std::packaged_task` as a job wrapper; add and use `V3ThreadPool::ScopedExclusiveAccess` (#4310).
* Add VL_ASSERT_CAPABILITY; add assumeLocked and pretendUnlock to V3Mutex.

* Pass jobs as template-arguments and use std::packaged_task.

* Add and use V3ThreadPool::ScopedExclusiveAccess.
2023-06-23 18:25:12 -04:00
Wilson Snyder 5bee8ef15b Remove long deprecated verilated_heavy.h 2023-06-17 08:45:13 -04:00
Wilson Snyder d45deccc0a Internals: Favot std::array. No functional change intended. 2023-06-16 19:44:40 -04:00
Ryszard Rozak b517fb5ee3
Support some stream operations on queues (#4292) 2023-06-13 22:46:42 -04:00
Wilson Snyder a06f260f42 Fix C++11 compiler error with C++14 rbegin 2023-06-12 21:46:32 -04:00
John Wehle 5094e94df1
Fix tracing undefined alignment (#4201) (#4288) 2023-06-12 07:13:00 -04:00
Àlex Torregrosa 4b7b185d05
Fix VCD scope types (#4227) (#4282) 2023-06-08 11:43:04 -04:00
Aleksander Kiryk 6cb0335d28
Support array max (#4275) 2023-06-07 07:44:21 -04:00
Wilson Snyder 191d30cf1c Update gtkwave from upstream (#4141) 2023-06-03 12:10:07 -04:00
Aleksander Kiryk db7935faf3
Add std::process class (#4212) 2023-06-01 10:02:08 -04:00
Risto Pejašinović 7f471d862e
Fix operator == for unpacked struct, if elements are VlUnpacked arrays (#4247) 2023-05-31 08:34:34 -04:00
Krzysztof Bieganski 519792d02b
Fix to commit coroutines immediately on `wait` statements (#4229)
Event-triggered coroutines live in two stages: 'uncommitted' and 'ready'. First
they land in 'uncommitted', meaning they can't be resumed yet. Only after
coroutines from the 'ready' queue are resumed, the 'uncommitted' ones are moved
to the 'ready' queue, and can be resumed. This is to avoid self-triggering in
situations like waiting for an event immediately after triggering it.

However, there is an issue with `wait` statements. If you have a `wait(b)`, it's
being translated into a loop that awaits a change in `b` as long as `b` is
false. If `b` is false at first, the coroutine is put into the `uncommitted`
queue. If `b` is set to true before it's committed, the coroutine won't get
resumed.

This patch fixes that by immediately committing event controls created from
`wait` statements. That means the coroutine from the example above will get
resumed from now on.
2023-05-25 20:20:44 -04:00
Mariusz Glebocki 8303938d0e
Internals: Make mutex classes uncopyable. (#4223) 2023-05-25 07:35:14 -04:00
Wilson Snyder 426069a4dd Configure for faster C++ linking using 'mold', if it is installed. 2023-05-23 21:26:29 -04:00
Mariusz Glebocki 949be301de
Internals: Fix unbalanced V3LockGuard locking (#4193) 2023-05-13 10:32:33 -04:00
Mariusz Glebocki be429a5800
Internals: Lock the same mutex reference as specified in VL_ACQUIRE. (#4194) 2023-05-13 10:28:34 -04:00
Mariusz Glebocki e7714e0902
Internals: Add additional clang's thread safety analysis annotations (#4195)
* Simplify some Clang-specific attribute defines.

* Add `VL_RETURN_CAPABILITY` and `VL_PT_GUARDED_BY`.
2023-05-12 09:06:36 -04:00
Wilson Snyder befb415f27 Fix mod/div/round argument side effects 2023-05-07 22:31:31 -04:00
Wilson Snyder e6f5a0495f Fix $fscanf of decimals overflowing variables (#4174). 2023-05-07 08:25:10 -04:00
Wilson Snyder c6052830e1 Fix C++17 requirement on previous commit. 2023-05-06 20:23:35 -04:00
Wilson Snyder a3640c1767 Support get_randstate/set_randstate class method function. 2023-05-06 19:09:19 -04:00
Wilson Snyder dc25be536c Internals: Deprecate VL_ATTR_ALIGNED, use alignas instead. 2023-05-02 21:21:10 -04:00
github action 128186ea68 Apply 'make format' 2023-05-02 11:29:45 +00:00
Hennadii Chernyshchyk 949be9d0a1
Optimize VPI callValueCbs (#4155)
Co-authored-by: Oleh Maks <olehmaksa@gmail.com>
2023-05-02 07:28:56 -04:00
Geza Lore 0e769d42a1 Optimize trigger evaluation
Pack the elements of VlTriggerVec as dense bits (instead of a 1 byte
bool per bit), and check whether they are set on a word granularity.
This effectively transforms conditions of the form `if (trig.at(0) |
trig.at(2) | trig.at(64))` into `if (trig.word(0) & 0x5 | trig.word(1) &
0x1)`. This improves OpenTitan ST by about 1%, worth more on some other
designs.
2023-04-24 09:09:36 +02:00
Wilson Snyder cbeb9d39ff Fix -CFLAGS to allow overriding optimization levels (#4140). 2023-04-23 10:18:48 -04:00
Kamil Rakoczy 65a484e00b
Internal: Update clang_check_annotations conditions (#4134) 2023-04-20 07:02:31 -04:00
Eyck Jentzsch df86e39845
Fix systemc namespace issues (#4126) (#4127)
* replaces use of "systemc.h" with <systemc> to avoid default namespace import
2023-04-17 06:57:29 -03:00
Kamil Rakoczy b6dcec2710
Internals: Split Mutex class used in verilated code and verilator (#4048) 2023-04-11 07:23:24 -04:00
Wilson Snyder fff0eb5d88 Internals: Use standard 'result' name for return variable. No functional change. 2023-04-08 22:11:28 -04:00
Wilson Snyder 7ae0c5d546 Internals: cppcheck fixes. No functional change intended 2023-04-08 21:36:32 -04:00
Wilson Snyder 13a87e5514 Parse process class, and report runtime errors (#3612) 2023-04-08 15:04:42 -04:00
Wilson Snyder 6c21b21ecc Internals: Indent verilated_std.sv with Verilog-mode. No functional change. 2023-04-06 21:27:16 -04:00
Krzysztof Bieganski cdb61842d6
Internals: Remove `VlNow` (#4089)
`VlNow{}` is completely unnecessary, as coroutines are always on the
heap (unless optimized out). Also fix access of var ref passed to forked processes.
2023-04-06 10:31:52 -04:00
Wilson Snyder 9ffd0a4e70 Support queue[$-1] selects. 2023-04-01 15:23:39 -04:00
Wilson Snyder 90e049c674 Internals: Remove unneeded variable. No functional change. 2023-04-01 11:46:43 -04:00
Wilson Snyder 69121633cf Support class srandom and class random stability. 2023-04-01 10:50:27 -04:00
Wilson Snyder 28eadded87 Update include/gtkwave from upstream 2023-04-01 10:38:47 -04:00
Krzysztof Bieganski c55df02b1a
Fix C++ compile errors when passing class refs as task arg (#4063)
1. Fixes passing a null reference as a task argument. Before this patch it would
   cause a C++ compile error like `cannot convert ‘VlNull’ to ‘VlClassRef<...>’`.

2. Fixes passing a class reference as a task argument when the argument is a
   reference to a base class. Before the patch it would cause a C++ compile
   error like `cannot convert ‘VlClassRef<{DERIVED_CLASS}>’ to ‘VlClassRef<{BASE_CLASS}>`.
2023-03-24 13:18:59 -04:00
Wilson Snyder 9b869edd90 Internals: Fix cppcheck warnings. No functional change. 2023-03-18 19:28:48 -04:00
Kamil Rakoczy bbf53bd5af
Add VL_MT_SAFE attribute to several functions. (#3729) 2023-03-16 19:48:56 -04:00
Wilson Snyder 8e55580cde Update include/gtkwave from upstream 2023-03-15 22:11:06 -04:00
Wilson Snyder ab502c5196 Fix coverage of class methods (#3998). 2023-03-03 19:26:15 -05:00
Kamil Rakoczy 0130c2bceb
Internals: update clang attributes check report conditions (#3997) 2023-03-02 18:37:07 -05:00
Wilson Snyder b1a95f642f Support cast to numbers from strings. 2023-02-28 23:34:33 -05:00
Larry Doolittle aff3f7c4f6
Fix build on hppa (#3954)
As supplied by John David Anglin in Debian bug #1030913
2023-02-11 04:23:26 -05:00
Kamil Rakoczy 93d50c4499
Internals: Add mutex to V3Error (#3680) 2023-02-09 22:15:37 -05:00
Wilson Snyder eb5aad94f1 Support to packed array 2023-02-05 10:18:03 -05:00
Wilson Snyder 6908e471e7 Revert: e3558d9e: Support vpiDefName (#3906) (#3931) 2023-02-03 21:26:21 -05:00
Andrew Nolte e3558d9e1b
Support vpiDefName (#3906) (#3931) 2023-02-03 19:14:41 -05:00
Aleksander Kiryk 31130c4b4a
Fix std:: to be parsed first (#3864) (#3928) 2023-02-03 09:04:16 -05:00
Larry Doolittle 9f9c84aa64
Internals: Avoid using <tab> in the middle of lines (#3913) 2023-01-29 22:39:22 -05:00
Wilson Snyder 7855a78a0f Support %p of union with real 2023-01-28 21:41:50 -05:00
Wilson Snyder 53835355b0 Add CFG_CXXFLAGS_STD so CFG_CXXFLAGS_STD_NEWEST can still exist (#3881) 2023-01-22 09:44:50 -05:00
Wilson Snyder bc7048e8d1 Convert verilator_includer to python3 2023-01-21 14:40:22 -05:00
Wilson Snyder c2bdd06fcc Fix VPI one-time timed callbacks (#2778). 2023-01-21 13:43:27 -05:00
Ilya Barkov 8918f17c17
Support class queue equality (#3895) 2023-01-21 13:20:02 -05:00
Wilson Snyder 317fe7a787 Fix VL_CPU_RELAX on MIPS/Armel/s390/sparc (#3891) 2023-01-19 17:22:28 -05:00
Wilson Snyder 6a60ace2c7 Commentary (#3887) 2023-01-18 18:21:53 -05:00
Andrew Nolte e5eb7d8930
Add VL_VALUE_STRING_MAX_WORDS override (#3869)
Co-authored-by: Andrew Nolte <anolte@hudson-trading.com>
2023-01-13 15:23:15 -05:00
Sören Tempel 78fe77db0f Fix compatibility with musl libc / Alpine Linux (#3845) 2023-01-05 15:50:25 -05:00
Larry Doolittle 2ab70ba452
Internals: Cleanup .txt file whitespace (#3842) 2023-01-05 05:00:54 -05:00
Wilson Snyder b24d7c83d3 Copyright year update 2023-01-01 10:18:39 -05:00
Larry Doolittle 80a144797d
Commentary: Fix more spelling (#3828) 2022-12-26 10:30:41 +01:00
Wilson Snyder c0499da28b Spelling fixes 2022-12-23 11:32:38 -05:00
Wilson Snyder 3ccb2e0f2d Fix initiation of function variables (#3815). 2022-12-23 10:51:52 -05:00
Krzysztof Bieganski bb44d4e4f2
Support clocking blocks (#3674) 2022-12-23 07:34:49 -05:00
Wilson Snyder d64971ba35 Fix some MSVC warnings. 2022-12-22 12:19:09 -05:00
Jevin Sweval 3340f7b0b4
Fix macOS weak symbols with -U linker flag (#3823) 2022-12-20 11:17:43 -05:00
Kamil Rakoczy 982fa3d7bb
Fix signed/unsigned comparison compile warning (#3822) 2022-12-19 10:52:19 -05:00
Kamil Rakoczy 7a15457511
Tests: Add multithreading attribute checks (#3748) 2022-12-16 11:19:27 -05:00
Kamil Rakoczy 4f7df4a915
Internals: Mark more VL_MT_SAFE functions (#3816). 2022-12-16 10:14:02 -05:00
Wilson Snyder 073af8e1f2 Fix to zero possibly uninitialized bits in replications (#3815) 2022-12-15 22:00:21 -05:00
Wilson Snyder 2eafd82696 Internals: Mark more VL_MT_SAFE functions (#3748). No functional change 2022-12-15 21:32:34 -05:00
Kamil Rakoczy 925fb921a2 Fix missing VL_REQUIRES in definition (#3804) 2022-12-14 21:16:16 -05:00
Kritik Bhimani 9d2f1c607a
Fix MSVCC issues (#3813) 2022-12-14 07:07:25 -05:00
Kritik Bhimani 7b073fec7d
Fix MSVC++ portability issues (#3812) 2022-12-12 18:45:32 -05:00
Wilson Snyder 424faa883e Internals: Mark more VL_MT_SAFE functions. No functional change 2022-12-11 23:10:59 -05:00
Wilson Snyder 61d6546400 Internals: Mark more VL_MT_SAFE functions. No functional change 2022-12-11 23:03:27 -05:00
Wilson Snyder a0e7930036 docs: Fix spelling 2022-12-09 22:39:41 -05:00
Kamil Rakoczy 5aa935d170
Internals: Add annotations for check attributes (#3803) 2022-12-09 07:12:26 -05:00
Wilson Snyder bcf58defe0 Update include/gtkwave from upstream 2022-12-08 07:30:23 -05:00
Wilson Snyder ea1b141d13 Support probablity distribution functions. 2022-12-04 17:30:51 -05:00
Wilson Snyder 84c7368621 Rename std.sv and add to install. 2022-12-03 11:31:26 -05:00
Larry Doolittle f27cf4c804
Commentary: Fix spelling in C++ comments (#3797) (#3798) 2022-12-02 18:46:38 -05:00
Wilson Snyder 338e875b70 Internals: Mark more VL_MT_SAFE functions. No functional change 2022-12-01 19:32:09 -05:00
Wilson Snyder 468a33b61c Move SystemC requirement out of .cpp files (#3507) 2022-11-29 22:44:37 -05:00
Wilson Snyder 8ff607f679 Deprecate verilated_fst_sc.cpp and verilated_vcd_sc.cpp (#3507) 2022-11-29 22:17:50 -05:00
Wilson Snyder 6143892619 Internals: Add some VL_UNLIKELY. No functional change. 2022-11-29 20:36:56 -05:00
Wilson Snyder 7d807a7e0e Commentary 2022-11-29 07:33:12 -05:00
Krzysztof Bieganski 68e1b473e2
Support `std::semaphore` and typed `std::mailbox` (#3708)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-11-28 16:53:55 +01:00
Wilson Snyder 4452a9b10f Internals: Fix some VL_MT metacomments. 2022-11-28 07:08:34 -05:00
Larry Doolittle 6349e76abd
Remove $date from .vcd files (#3779) 2022-11-27 20:24:22 -05:00
Wilson Snyder f4be3d5d2b Fix empty string literals converting to string types (#3774). 2022-11-27 13:28:57 -05:00
Wilson Snyder 833780fac1 Internal: cppcheck fixes. No functional change intended. 2022-11-27 05:52:40 -05:00
Wilson Snyder a83ed6b06f Internals: Fix destructor calling virtual. No functional change intended. 2022-11-23 07:04:22 -05:00
github action 821dd070bf Apply 'make format' 2022-11-23 09:08:02 +00:00
Yves Mathieu 06fdf7be58
Add support of Events for VCD/FST traces (#3759) 2022-11-23 04:07:14 -05:00
Ryszard Rozak 57975c82b7
Support 'with' in unique, unique_index, min, max in queues (#3772) 2022-11-22 09:10:25 -05:00
Wilson Snyder 66d85b3381 Internals: Fix cppcheck warnings. No functional change intended. 2022-11-21 21:40:49 -05:00
Wilson Snyder 352d0b4582 Internals: Fix constructor style. 2022-11-20 13:11:01 -05:00
github action cd8528e83b Apply 'make format' 2022-11-18 00:14:05 +00:00
Wilson Snyder e8a1e4745c Support $stacktrace 2022-11-17 19:12:54 -05:00
Miodrag Milanović f782496092
Fix for mingw cross-compile, arm and riscv (#3752) 2022-11-16 05:34:25 -08:00
Wilson Snyder e6da59eecd Internals: Mark some VL_PURE functions. No functional change. 2022-11-15 09:18:47 -05:00
Wilson Snyder 04f68cbd99 Internals: Spacing 2022-11-13 21:58:18 -05:00
Wilson Snyder 8c6d1e53ca Internals: Fix some 'p' names, and make new base class for VlDeleter. No functional change intended. 2022-11-13 17:40:50 -05:00
Wilson Snyder 818347f99b Internals: Fix some unnecessary member paddings. No functional change intended. 2022-11-13 09:26:46 -05:00
Wilson Snyder 218dd4322b Fix C++11 warnings 2022-11-12 16:03:13 -05:00
Kamil Rakoczy 207bc2b18a Fix comment annotation
Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2022-11-10 13:36:14 +00:00
Kamil Rakoczy d6126c4b32
Remove --no-threads; require --threads 1 for single threaded (#3703). 2022-11-05 08:47:34 -04:00
Geza Lore 65e08f4dbf Make all expressions derive from AstNodeExpr (#3721).
Apart from the representational changes below, this patch renames
AstNodeMath to AstNodeExpr, and AstCMath to AstCExpr.

Now every expression (i.e.: those AstNodes that represent a [possibly
void] value, with value being interpreted in a very general sense) has
AstNodeExpr as a super class. This necessitates the introduction of an
AstStmtExpr, which represents an expression in statement position, e.g :
'foo();' would be represented as AstStmtExpr(AstCCall(foo)). In exchange
we can get rid of isStatement() in AstNodeStmt, which now really always
represent a statement

Peak memory consumption and verilation speed are not measurably changed.

Partial step towards #3420
2022-11-03 16:02:16 +00:00
Wilson Snyder 0ed7aaeabd Update include/gtkwave/fstapi.c from upstream. 2022-10-27 21:37:09 -04:00
Kamil Rakoczy ed93a111c2
Fix deadlock in ``timeprecision`` when using systemC (#3707) 2022-10-26 04:50:28 -07:00
Krzysztof Bieganski fcf0d03cd4
Dynamic triggers for non-static contexts (#3599)
In non-static contexts like class objects or stack frames, the use of
global trigger evaluation is not feasible. The concept of dynamic
triggers allows for trigger evaluation in such cases. These triggers are
simply local variables, and coroutines are themselves responsible for
evaluating them. They await the global dynamic trigger scheduler object,
which is responsible for resuming them during the trigger evaluation
step in the 'act' eval region. Once the trigger is set, they await the
dynamic trigger scheduler once again, and then get resumed during the
resumption step in the 'act' eval region.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-22 14:05:39 +00:00
Wilson Snyder 9d02082801 Internals: Avoid VM_COVERAGE ifdef in library to get closer to libverilated.a 2022-10-21 17:09:06 -04:00
Krzysztof Bieganski 785c51dd0b
Fix emitting timing debug info with `--protect-ids` (#3689) (#3701) 2022-10-21 16:56:44 -04:00
Krzysztof Bieganski 444a4a760c
Support timing with more Clang and libc++ versions (#3669) (#3698) 2022-10-20 19:54:22 -04:00
Krzysztof Bieganski 8c3ca30c91
Fix print format warning on some platforms (#3699) 2022-10-20 10:15:29 -04:00
Wilson Snyder e7068369fe Fix $display of fixed-width numbers (#3565). 2022-10-18 21:10:35 -04:00
Kamil Rakoczy b6c116d4bf
Internals: Add VL_MT_SAFE annotations to const functions (#3681) 2022-10-18 17:07:09 -04:00
Kamil Rakoczy 54e3f15dce
Internals: Add attribute when using clang to VL_MT_SAFE and VL_MT_UNSAFE (#3685) 2022-10-18 05:15:33 -04:00
Krzysztof Bieganski 68927d4fd3
Make class ref typing stricter (#3671)
Prevents the possibility of assigning an integer to a class reference,
both at the SystemVerilog and the emitted C++ levels.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-13 14:33:15 +02:00
Wilson Snyder 6f9c585452 Spelling (#3664) 2022-10-09 14:18:14 -04:00
Krzysztof Bieganski 56ac054fb2
Internals: Refactor verilated_timing.* (#3653).
* Put suspended coroutine source location in a separate struct,
* Have `dump()` always print, wrap calls in `VL_DEBUG_IF`,
* Improve const correctness.
2022-10-03 11:40:30 -04:00
Wilson Snyder ced82cbac4 Internals: Add some internal coverage exclusions etc. No functional change. 2022-10-03 10:57:37 -04:00
Geza Lore 2fc1746ef5 Tracing: Clear offload buffer pointers when no longer needed
These are also used as a marker (when non-nullptr) when creating a
buffer. Reset them when they are not valid to avoid invalid write if a
buffer is created after a close (due to a subsequent re-open).

Fixes #3651.
2022-10-03 10:50:47 +01:00
Wilson Snyder 10fc1f757c Internals: cppcheck cleanups. No functional change intended. 2022-10-02 23:04:55 -04:00
Wilson Snyder 4367e03e46 Internals: Make VL_UNREACHABLE similar to std::unreachable() 2022-10-02 16:35:45 -04:00
Wilson Snyder c9634695a7 Fix std::exchange for C++11 compilers 2022-10-02 16:25:11 -04:00
Wilson Snyder 880cac2fdd Merge branch 'master' into develop-v5 2022-10-01 11:24:55 -04:00
Wilson Snyder 5ed882faf2 Fix unused compiler warning when not VL_THREADED. 2022-09-30 23:41:35 -04:00
Krzysztof Bieganski 9c2ead90d5
Add custom memory management for verilated classes (#3595)
This change introduces a custom reference-counting pointer class that
allows creating such pointers from 'this'. This lets us keep the
receiver object around even if all references to it outside of a class
method no longer exist. Useful for coroutine methods, which may outlive
all external references to the object.

The deletion of objects is deferred until the next time slot. This is to
make clearing the triggered flag on named events in classes safe
(otherwise freed memory could be accessed).
2022-09-28 18:54:18 -04:00
github action 91823c41c5 Apply 'make format' 2022-09-28 02:22:05 +00:00
Wilson Snyder c6bce636ee Merge branch 'master' into develop-v5 2022-09-27 22:19:04 -04:00
Wilson Snyder 75a70bee6d Update to clang-format-14 on Ubuntu22.04 2022-09-27 21:47:45 -04:00
Wilson Snyder d162619bd3 Merge branch 'master' into develop-v5 2022-09-20 20:06:21 -04:00
Mariusz Glebocki fc3ce29845
Improve Verilation memory by reducing V3Number size (#3521) 2022-09-20 16:46:47 -04:00
Geza Lore af305bf280 Merge branch 'master' into develop-v5 2022-09-16 16:24:36 +01:00
Geza Lore 38a8d7fb2e Remove redundant 'inline' keywords from definitions
Also add checks to t/t_dist_cppstyle
2022-09-16 15:52:25 +01:00
Geza Lore 0c70a0dcbf Remove redundant 'virtual' keywords from overridden methods
'virtual' is redundant when 'override' is present, so keep only
'override'.

Add t/t_dist_cppstyle.pl to check for this.
2022-09-16 15:19:38 +01:00
Geza Lore 27031ed688 Merge branch 'master' into develop-v5 2022-09-15 10:28:35 +01:00
github action e94cdcf29c Apply 'make format' 2022-09-05 22:43:09 +00:00
Mladen Slijepcevic 1af046986d
Fix thread saftey in SystemC VL_ASSIGN_SBW/WSB (#3494) (#3513). 2022-09-05 18:42:12 -04:00
Krzysztof Bieganski da7ad35577
Fix fork debug output (#3593)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-09-05 11:27:24 +01:00
Wilson Snyder 819e8741cc Merge branch 'master' into develop-v5 2022-08-30 00:20:21 -04:00
Wilson Snyder 6a5f77b278 Internals: Cleanup some string/model constructors. No functional change. 2022-08-29 23:50:32 -04:00
Wilson Snyder 2358ced061 Rename tracing rolloverSize and add test (#3570). 2022-08-28 08:25:02 -04:00
Geza Lore 5c356a4680 Merge branch 'master' into develop-v5 2022-08-22 14:32:06 +01: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
Geza Lore 9ac64d0b92 Improve performance of MTask coarsening
Various optimizations to speed up MTasks coarsening (which is the long
pole in the multi-threaded scheduling of very large designs).

The biggest impact ones:
- Use efficient hand written Pairing Heaps for implementing priority
  queues and the scoreboard, instead of the old SortByValueMap. This
  helps us avoid having to sort a lot of merge candidates that we will
  never actually consider and helps a lot in performance.
- Remove unnecessary associative containers and store data structures
  (the heap nodes in particular) directly in the object they relate to.
  This eliminates a huge amount of lookups and helps a lot in
  performance.
- Distribute storage for SiblingMC instances into the LogicMTask
  instances, and combine with the sibling maps. This again eliminates
  hash table lookups and makes storage structures smaller.
- Remove some now bidirectional edge maps, keep only the forward map.

There are also some other smaller optimizations:
- Replaced more unnecessary dynamic_casts with static_casts
- Templated some functions/classes to reduce the number of static
  branches in loops.
- Improves sorting of edges for sibling candidate creation
- Various micro-optimizations here and there

This speeds up MTask coarsening by 3.8x on a large design, which
translates to a 2.5x speedup of the ordering pass in multi-threaded
mode. (Combined with the earlier optimizations, ordering is now 3x
faster.)

Due to the elimination of a lot of the auxiliary data structures, and
ensuring a minimal size for the necessary ones, memory consumption of
the MTask coarsening is also reduced (measured up to 4.4x reduction
though the accuracy of this is low).

The algorithm is identical except for minor alterations of the order
some candidates are added or removed, this can cause perturbation in the
output due to tied scores being broken based on IDs.
2022-08-20 21:18:50 +01:00
Geza Lore 1404319b28 Merge branch 'master' into develop-v5 2022-08-19 13:39:44 +01:00
Wilson Snyder 1e2219347e Internals: Cleanup ifdef, move up not under compilver version ifdef 2022-08-11 17:41:43 -04:00
Geza Lore a4fd6d38fb Add operator != to VlWide
This is required by VlUnpacked::neq
2022-08-07 13:13:28 +01:00
Geza Lore c266739e9f Merge branch 'master' into develop-v5 2022-08-05 12:17:57 +01:00
Geza Lore 96a4b3e5a5 Update clang-format config and apply
- Regroup and sort #include directives (like we used to, but automatic)
- Set AlwaysBreakTemplateDeclarations to true
2022-08-05 12:00:24 +01:00
Geza Lore 39d1a62f9e Fix change detection on unpacked arrays
Expand array assignment when creating the trigger, as V3Expand might
mangle it otherwise.
2022-08-02 13:01:41 +01:00
Wilson Snyder 3c54d5df70 Merge branch 'master' into develop-v5 2022-07-30 14:42:51 -04:00
Wilson Snyder f91793e931 Revert - SC overrides cause non-override clang error. 2022-07-30 13:53:54 -04:00
Wilson Snyder daac7cb90d Merge branch 'master' into develop-v5 2022-07-30 12:09:05 -04:00
Wilson Snyder a2d26b45bb Internals: Fix some clang-tidy issues. No functional change intended. 2022-07-30 11:54:28 -04:00
Wilson Snyder dce8f3d25d Internals: Spacing from develop-v5. No functional change. 2022-07-30 11:54:28 -04:00
Geza Lore 38e5b6c1ad Replace __gcov_flush with __gcov_dump
__gcov_flush was a private function and was removed from later GCC
versions (at least from 11.2.0, possibly earlier). Replace with the
documented public __gcov_dump.
2022-07-30 16:02:03 +01:00
Wilson Snyder 4859f5e1fa Merge branch 'master' into develop-v5 2022-07-30 10:26:16 -04:00
Wilson Snyder b9d7819faa Internals: Fix some cppcheck issues. Some dump functions fixed. 2022-07-30 10:01:39 -04:00
Geza Lore ad2fbfe62d Merge branch 'master' into develop-v5 2022-07-29 12:04:24 +01:00
Gustav Svensk eeef5ab4de
Fix sformat string incorrectly cleared (#3515) (#3519). 2022-07-25 17:36:34 +02:00
Geza Lore 386401da60 Merge branch 'master' into develop-v5 2022-07-22 15:09:20 +01:00
Geza Lore e0b61ceabd Remove legacy #ifdef SYSTEMC_64BIT_PATCHES
These days this is always false, see #3505
2022-07-21 15:01:17 +01:00
Geza Lore f9ecbdc70b Merge branch 'master' into develop-v5 2022-07-21 09:56:14 +01:00
Geza Lore 30e3edb81d Remove deprecated and unused timescale override defines
These have been 'deprecated' for 2 years and are otherwise unused except
for using a temporary placeholder value, which I have inlined with the
default value.

Also remove the now VL_TIME_STR_CONVERT utility function (and
corresponding unit tests), which have no references in any project on
GitHub.
2022-07-20 14:06:09 +01:00
Geza Lore 1d400dd98c
Configure tracing at run-time, instead of compile time (#3504)
All remaining use of conditional compilation in the tracing
implementation of the run-time library are replaced with the use of
VerilatedModel::traceConfig, and is now done at run-time.
2022-07-20 11:27:10 +01:00
Geza Lore a4ed3c2086 Make parallel tracing switchable at run-time 2022-07-19 17:13:13 +01:00
Geza Lore efb5caad22 Improve robustness of trace configuration
Always fail if adding a model to a trace file that has already executed
a dump. We used to do this before as well, though in a less robust way.
We will be relying on this property more in the future, so improve the
check.
2022-07-19 14:16:08 +01:00
Geza Lore 3a002b6cf2 Remove VerilatedVcd::m_evcd and related dead code.
The legacy code that was using this was removed earlier, and m_evcd was
constant false, so removed.
2022-07-19 13:58:18 +01:00
Geza Lore f8b7981be4 Make use of FST writer thread switchable at run-time.
Always build the FST libray with -DFST_WRITER_PARALLEL, iff VL_THREADED.
This supports run-time enablement of the FST writer thread, and has no
measurable performance impact on single threaded tracing but simplifies
the library build.

Note: the actual choice of using the fst writer thread is still compile
time, but can now be made run-time easily.
2022-07-19 13:48:03 +01:00
Geza Lore b55ee79d86 Fix typo 2022-07-19 12:36:21 +01:00
Geza Lore db59c07f27 Implement trace offloading with fewer ifdefs
Step towards a proper run-time library. Reduce the amount of ifdefs in
the implementation of offloaded tracing. There are still a very small
number of ifdefs left, which will need more careful changes in order to
keep user API compatibility.
2022-07-19 11:31:35 +01:00
Geza Lore 9085e34d70 Pass VerilatedModel at trace registration time 2022-07-19 11:00:09 +01:00
Geza Lore c28bf9ce24 Fix change detection over unpacked arrays. 2022-07-18 12:25:22 +01:00
Geza Lore c9ac9a75a6 Merge branch 'master' into develop-v5 2022-07-12 17:29:45 +01:00
Geza Lore 79c901c220 Tighten signatures/implementaion of VerilatedModel abstract methods. 2022-07-12 16:06:08 +01:00
Geza Lore b61d819fcb Move contextp() under VerilatedModel 2022-07-12 16:06:08 +01:00
Geza Lore f4038e3674
Move thread pool and execution profiler into the context. (#3477)
Fixes #3454
2022-07-12 11:41:15 +01:00
Arkadiusz Kozdra 8377514127
Add support for $test$plusargs(expr) (#3489) 2022-07-11 06:21:35 -04:00
Geza Lore 0de1bbc85b Add and use VL_CONSTEXPR_CXX17 2022-07-05 14:21:28 +01:00
Geza Lore 42b711b862 Don't use 'assert' in profiler initialization 2022-07-05 12:18:54 +01:00
Wilson Snyder b25b798dbe Merge branch 'master' into develop-v5 2022-07-04 13:20:03 -04:00
Geza Lore 1bb6433649 Improve worker thread shutdown.
Always ensure worker thread task queue is drained before shutting down.
2022-06-27 15:03:36 +01:00
Wilson Snyder fc4d6a62af Remove VL_PROFILER ifdef. Partial (#3454). 2022-06-22 20:06:23 -04:00
Wilson Snyder 49455721a3 Commentary 2022-06-21 19:28:23 -04:00
Wilson Snyder 0f324c8309 Merge branch 'master' into develop-v5 2022-06-04 11:59:49 -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 c4b8675d77 Always inline some small, hot trace routines 2022-05-28 12:47:09 +01:00
Geza Lore a7cd7a1ed9 Initialize VerilatedTrace members in class 2022-05-28 12:47:07 +01:00
Geza Lore a48c779367 Rename verilated_trace_imp.cpp -> verilated_trace_imp.h
Also fix file header to describe purpose of this file.
2022-05-28 12:20:35 +01:00
Geza Lore cf1eccc24f Make local function 'static' in verilated_profiler.h 2022-05-28 12:17:39 +01:00
Geza Lore d45caca011 Remove legacy VCD tracing API
This has not been used by Verilator for a while, but was kept for
compatibility with some external code. Now removed.
2022-05-28 12:07:24 +01:00
Krzysztof Bieganski 3a310f19f0 Adjust loop conditions in VlTriggerVec functions
This change is not a functional one; it is only meant to appease the
compiler with respect to warnings such as GCC's `-Wtype-limits`.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-05-25 18:45:59 +01:00
Krzysztof Bieganski d7a75dc026 Merge branch 'master' into develop-v5 2022-05-25 11:06:38 +02:00
Geza Lore b130a8cfeb Add -DVM_TRACE_VCD in model builds with Make with --trace 2022-05-20 16:44:38 +01:00
Geza Lore 551bd284dd Rename some internals related to multi-threaded tracing
Rename the implementation internals of current multi-threaded tracing to
be "offload mode". No functional change, nor user interface change
intended.
2022-05-20 16:44:35 +01:00
Wilson Snyder 99bdc27be3 Internals: Cleanup some statics, trivial part towards (#3419) 2022-05-15 14:26:55 -04:00
Wilson Snyder c3c46967dc Tests: Appease sanitizer (#3121). 2022-05-15 11:50:52 -04: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 5aa12e9b51 Add assert when VerilatedContext is mis-deleted (#3121). 2022-05-15 10:51:03 -04:00
Wilson Snyder f6035447ae Internals: Use mutable for mutexes. No functional change. 2022-05-13 07:21:39 -04:00
Wilson Snyder 38438b3373 Internals: Cleanup some defaults. No functional change. 2022-05-12 23:30:39 -04:00
HungMingWu 880a9be3b1
Internal: Add C++20ish reverse_view for range loops. No functional change (#3388).
Signed-off-by: HungMingWu <u9089000@gmail.com>
2022-04-18 13:03:56 -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
Wilson Snyder 3f7bf3d2dc Fix MSVC localtime_s (#3124). 2022-03-27 13:59:18 -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
Geza Lore c7440b250f Validate integer run-time arguments 2022-03-26 22:58:47 +00:00
Geza Lore bab8462789 Rebuild run-time library if generated makefile changes
The generated makefile contains compiler options that are passed when
building the run-time library, so re-build if it changes.
2022-03-26 21:29:03 +00:00
Xi Zhang 14d24213a8
Support LoongArch ISA multithreading (#3353) (#3354) 2022-03-17 09:04:47 -04:00
Wilson Snyder b5ce7d5982 Add VERILATOR_VERSION_INTEGER for determining API (#3343). 2022-03-12 11:17:39 -05:00
Wilson Snyder ef87d057fc Fix $fscanf etc to return -1 on EOF (#3113). 2022-03-07 17:43:33 -05:00
Wilson Snyder 321880f5a6 Add trace dumpvars() call for selective runtime tracing (#3322). 2022-03-05 15:44:32 -05:00