Commit Graph

1036 Commits

Author SHA1 Message Date
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
Wilson Snyder 956f64c6ba Fix compile error with --trace-fst --sc (#3332). 2022-03-02 07:26:26 -05:00
Jamie Iles b6ca2a42f2
Fix FST traces to include vector range (#3296) (#3297) 2022-02-26 12:52:24 -05:00
Wilson Snyder e52a4ac74f Fix $readmem file not found to be warning not error (#3310). 2022-02-19 10:04:12 -05:00
Wilson Snyder 3b7ad1820d GTKWave header updates from upstream. 2022-02-09 21:56:22 -05:00
Guokai Chen 818aaa8b89
Fix macOS arm64 build by excluding x86 only cpuid header (#3285) (#3291)
Signed-off-by: Guokai Chen <chenguokai17@mails.ucas.ac.cn>
2022-01-23 09:15:09 -05:00
Julie Schwartz f5b1a5cd58 Fix make support for BSD ar (#2999) (#3256). [Julie Schwartz]
While GNU 'ar' supports '@' to specify a file, BSD 'ar' does not.
The max line length can be handled by 'xargs' instead, which will know
to break up the command.  In case there are multiple calls, only build
the index (specified with '-s') once in a later call.
2022-01-17 14:04:43 -05:00
Wilson Snyder 50094ca296 Internals: Add cpplint control file and related cleanups 2022-01-09 16:49:38 -05:00
Wilson Snyder 15b32dc140 Internals: cpplint cleanups. No functional change. 2022-01-08 12:01:39 -05:00
Wilson Snyder 9bda91b3bf Fix clang compile warning 2022-01-01 19:33:12 -05:00
Wilson Snyder d679d50eca Fix $random not updating seed (#3238). [Julie Schwartz] 2022-01-01 16:43:06 -05:00
Wilson Snyder 4cd56b1fb9 Use C++11 standard types for MacOS portability (#3254) (#3257). 2022-01-01 16:04:20 -05:00
Wilson Snyder ca42be982c Copyright year update. 2022-01-01 08:26:40 -05:00
Yutetsu TAKATSUKASA 0658a7654f
Add tests of tracing SystemC model verilated with --hierarchical (#3252)
* Tests: Add t_hier_block_sc_trace(fst|vcd) that tests tracing hierarchical block on SystemC.

* Add a check that elaboration is done before a trace file is opened.

* Add a check that elaboration is done before trace() is called to verilated SystemC model.

* Tests: call sc_core::sc_start(sc_core::SC_ZERO_TIME) before opening a trace file

* Tests: Fix t_trace_two_sc to call sc_start before opening trace

* Use vl_fatal as suggested in PR review.
2021-12-23 08:41:11 +09:00
Wilson Snyder 7526151670 Fix bad ending address on $readmem (#3205). 2021-12-21 19:55:04 -05:00
Wilson Snyder 560b59f97f Use C++11 standard types for MacOS portability (#3254). 2021-12-21 13:18:05 -05:00
Geza Lore ff425369ac
Reduce .rodata footprint of trace initialization (#3250)
Trace initialization (tracep->decl* functions) used to explicitly pass
the complete hierarchical names of signals as string constants. This
contains a lot of redundancy (path prefixes), does not scale well with
large designs and resulted in .rodata sections (the string constants) in
ELF executables being extremely large.

This patch changes the API of trace initialization that allows pushing
and popping name prefixes as we walk the hierarchy tree, which are
prepended to declared signal names at run-time during trace
initialization. This in turn allows us to emit repeat path/name
components only once, effectively removing all duplicate path prefixes.
On SweRV EH1 this reduces the .rodata section in a --trace build by 94%.

Additionally, trace declarations are now emitted in lexical order by
hierarchical signal names, and the top level trace initialization
function respects --output-split-ctrace.
2021-12-19 15:15:07 +00:00
Wilson Snyder 8696e38e6f Primary inputs and outputs (VL_INW/VL_OUTW) now use VlWide type (#3236). 2021-12-09 19:41:33 -05:00
Adrien Le Masle c3f17ce2c4
Fix VL_STREAML_FAST_QQI with 64 bit left-hand-side (#3232) (#3235) 2021-12-09 17:30:04 -05:00
Wilson Snyder b7d20b102b Internals: Remove unused and cleanup VL_ASSIGNSEL. 2021-12-05 11:59:49 -05:00
Wilson Snyder 293a5f402b Fix timescale portability on Arm64 (#3222). 2021-11-28 15:47:19 -05:00
Wilson Snyder 692306ef44 Optimize $random concatenates/selects (#3114). 2021-11-28 14:17:28 -05:00
Wilson Snyder 98037cad56 Internals: Optimize VL_RANDOM to have unclean output 2021-11-28 14:00:19 -05:00
Wilson Snyder 61e3536163 Internals: Remove some unused arguments. 2021-11-28 13:44:16 -05:00
Wilson Snyder a1a186a86c Internals: Remove some unused arguments. 2021-11-28 13:07:37 -05:00
Wilson Snyder cd737065f2 Internals: More const. No functional change intended. 2021-11-26 17:55:36 -05:00
Wilson Snyder 393b9e435d Internals: Revert previous commit const for clang. 2021-11-25 09:47:06 -05:00
Wilson Snyder e87a726989 Internals: More const. No functional change intended. 2021-11-25 09:05:50 -05:00
Wilson Snyder 0abc856be9 Fix %0 format on $value$plusargs. 2021-11-17 17:54:07 -05:00
Wilson Snyder 899de9a282 Add --lib-create, similar to --protect-lib but without protections (#3200). 2021-11-14 09:39:31 -05:00
Wilson Snyder 90102d9867 Commentary 2021-10-25 21:02:02 -04:00
Iru Cai 9731ec76e3
Fix $urandom_range when the range is 0 ... UINT_MAX (#3161) 2021-10-11 06:45:19 -06:00
Wilson Snyder 4739956cfe Internals: Add missing const. No functional change. 2021-10-05 21:20:22 -04:00
Wilson Snyder 55da66164b Fix verilator_gantt time on Arm. 2021-10-04 22:13:34 -04:00
Wilson Snyder 9029da5ab8 Add profile-guided optmization of mtasks (#3150). 2021-09-26 22:51:11 -04:00
Wilson Snyder 44809f1843 Remove unused CFG_CXXFLAGS_STD_OLDEST 2021-09-26 16:01:25 -04:00
Wilson Snyder c2819923c5 Verilator_gantt now shows the predicted mtask times, eval times, and additional statistics. 2021-09-23 22:59:36 -04:00
Wilson Snyder 68f1432a68 Gantt: Subtract common start in slowpath to reduce collection measurement error. 2021-09-23 19:43:20 -04:00
Wilson Snyder d09b6a7d2c Include processor information in verilator_gantt data file. 2021-09-05 11:56:28 -04:00
Wilson Snyder cd56dfee1c Update GTKwave from upstream. 2021-09-01 20:45:41 -04:00
Wilson Snyder 959793cde3 Internals: Cleanup VL_VALUE_STRING_MAX widths (#3050). 2021-08-23 21:13:33 -04:00
Pieter Kapsenberg d1836b7b6f
Traces show array instances using brackets instead of parens (#3092) (#3095) 2021-08-12 20:40:44 +03:00
Wilson Snyder b8e804f05b Internals: Some clang-tidy cleanups. No functional change intended. 2021-07-25 13:38:27 -04:00
Wilson Snyder b90fce55f4 Includes: Refactor verilated.h and deprecate verilated_heavy.h (#2701). 2021-07-24 10:00:33 -04:00
Wilson Snyder ab13a2ebdc Internals: Use C++11 const and initializers. No functional change intended. 2021-07-24 08:36:11 -04:00
Geza Lore 9907d211ff Make VlWide and VlUnpacked C++20 compatible aggregates.
C++20 requires that aggregate types do not have a user declared
constructor, not even an explicitly defaulted one. We need these types
to be aggregates for static initialization.

Fixes #3076.
2021-07-23 12:57:45 +01:00
Wilson Snyder 36599133bf Add --prof-c to pass profiling to compiler (#3059). 2021-07-07 19:12:52 -04:00
Geza Lore 19398efc4c Remove no-op VL_CELL. No functional change intended. 2021-06-19 20:42:38 +01:00
Wilson Snyder 8d737271ca Allow configure override of AR program (#2999). 2021-06-19 10:00:31 -04:00
Wilson Snyder 52cde49a6f Internals: Add more const. No functional change. 2021-06-18 22:24:08 -04:00
Wilson Snyder 5fddf51e8c Internals: Favor VlWide over WData arrays. No functional change intended. 2021-06-17 21:17:25 -04:00
Geza Lore c75a686081
Internals: Update to clang-format-11 (#3021) 2021-06-14 14:50:40 -04:00
Geza Lore 6016e74b55 Drop ambiguous overloads in VlWide
The 32-bit build fails with the ambiguous overload present.
2021-06-14 00:37:33 +01:00
Geza Lore c207e98306
Implement a distinct constant pool (#3013)
What previously used to be per module static constants created in
V3Table and V3Prelim are now merged globally within the whole model and
emitted as part of a separate constant pool. Members of the constant
pool are global variables which are declared lazily when used (similar to
loose methods).
2021-06-13 15:05:55 +01:00
Geza Lore 60d5f0e86b
Emit model implementation as loose methods. (#3006)
This patch introduces the concept of 'loose' methods, which semantically
are methods, but are declared as global functions, and are passed an
explicit 'self' pointer. This enables these methods to be declared
outside the class, only when they are needed, therefore removing the
header dependency. The bulk of the emitted model implementation now uses
loose methods.
2021-06-13 14:33:11 +01:00
Geza Lore 5555f20bd2 Improve ccache-report 2021-06-09 19:14:11 +01:00
Geza Lore 809701d7c6 Add missing 'inline' to function in verilated.h
Otherwise we get a separate copy of this function in every
compilation unit including this header.
2021-06-08 23:46:07 +01:00
Geza Lore 0edf1f0c94
Add ccache-report target to standard Makefile (#3011)
Using the standard model Makefile, when in addition to an explicit
target, the target 'ccache-report' is also given, a summary of ccache
hits/misses during this invocation of 'make' will be prited at the end
of the build.
2021-06-07 00:56:30 +01:00
Wilson Snyder 31bb73e3de Fix MCD close also closing stdout (#2931). 2021-06-06 19:32:48 -04:00
Pieter Kapsenberg e4dcbb22e3
Fix unused variable warnings (#2991) 2021-05-30 20:19:35 -04:00
Wilson Snyder 0f7ec6c9ba Fix missing array include (#2966) 2021-05-17 18:24:18 -04:00
Wilson Snyder bdc162db87 Fix 16.04 gcc warning 2021-05-16 18:38:43 -04:00
Yutetsu TAKATSUKASA 31779b8b8b
Format time string using integer (#2940)
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
2021-05-16 19:01:03 +09:00
Wilson Snyder 88fed4bc2f Commentary on traces (#2925) 2021-05-13 18:57:39 -04:00
Wilson Snyder 3718fe1ca1 Commentary (trigger rebuild) 2021-05-13 18:34:20 -04:00
Yutetsu TAKATSUKASA e3b20a3ea2
Internals: Mark VerilatedContextImp::timeFormatSuffix() const (#2947) 2021-05-11 11:45:43 -04:00
Yutetsu TAKATSUKASA 39ce2f77f4
Internals: Remove VerilatedVcd::m_suffixesp. No functional change is intended. (#2933)
Reasons are:
- it's error prone to keep updating whennever m_suffixes is resized
- invalid pointer may be set when there is not signal to trace as in t_trace_dumporder_bad
2021-05-07 20:45:58 -04:00
Yutetsu TAKATSUKASA 9797af0ad4
Introduce a macro VL_ATTR_NO_SANITIZE_ALIGN to suppress unaligned access check in ubsan (#2929)
* Add VL_ATTR_NO_SANITIZE_ALIGN macro to disable alignment check of ubsan

* Mark a function VL_ATTR_NO_SANITIZE_ALIGN because the function is intentionally using unaligned access for the sake of performance.

Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
2021-05-08 07:16:40 +09:00
Yutetsu TAKATSUKASA 1e4839e5d1
Fix casting to integer not to cause integer overflow. (#2930) 2021-05-07 12:00:36 -04:00
Philipp Wagner 44fd205e12
Fix make support for gmake 3.x (#2920) (#2921)
The "file" make function is only available in gmake 4.x, which isn't
available on RHEL/CentOS 7. Use alternative syntax to support older
gmake versions.

Fixes #2920
2021-05-06 12:07:15 -04:00
Krzysztof Bieganski 5290062549
Fix bounds check in VL_SEL_IWII (#2910) 2021-05-03 17:59:41 -04:00
Wilson Snyder 2022ec43cf Update gtkwave from upstream. 2021-04-24 11:00:35 -04:00
Todd Strader f446295274
Public interface params (#2901) 2021-04-21 13:46:13 -04:00
Todd Strader a1cd55225c
more vpi_get_str() (#2894) 2021-04-21 08:09:19 -04:00
David Metz f5ad5cf034
Fix dumping waveforms to multiple FST files (#2889) 2021-04-14 16:52:14 -04:00
HyungKi Jeong 0d6099b2b7
Fix MinGW not supportting 'localtime_r'. (#2882) 2021-04-09 10:40:41 -04:00
github action 52fc134272 Apply clang-format 2021-04-07 13:56:12 +00:00
Àlex Torregrosa 2b2680770b
Improve scope types in FST and VCD traces (#2805). 2021-04-07 09:55:11 -04:00
Àlex Torregrosa a29ac44af9
Add FST SystemC tracing (#2806) 2021-04-06 16:18:58 -04:00
Wilson Snyder e9c7f40bb4 Internals: Prefer using over typedef. No functional change. 2021-03-29 21:28:08 -04:00
Wilson Snyder 8992e2ec02 Commentary 2021-03-28 11:50:05 -04:00
Wilson Snyder e9b5721fb0 Internals: Remove VL_FUNC as __func__ part of C++11 2021-03-28 11:14:51 -04:00
Wilson Snyder ca01d6f18d Internals: Add some std::'s. No functional change intended. 2021-03-26 21:23:18 -04:00
Wilson Snyder 2e158d88c1 Commentary. Remove dox comments from private members, 2021-03-20 21:11:53 -04:00
Wilson Snyder a1ab295b74 Commentary: Cleanup all include/* header comments. 2021-03-20 17:46:00 -04:00
Wilson Snyder b6c393e9f0 Add VerilatedCovContext::forcePerInstance (#2793). 2021-03-19 22:24:00 -04:00
Wilson Snyder 82710a55a4 Quieter archive (broke few commits ago) 2021-03-19 20:58:42 -04:00
Wilson Snyder c20bced485 Fix --output-split with class extends (#2839). 2021-03-17 18:25:54 -04:00
Wilson Snyder e6b19d557e Fix false $dumpfile warning on model save (#2834). 2021-03-14 09:08:17 -04:00
Wilson Snyder 4261f72bd2 Fix exceeding command-line ar limit (#2834). 2021-03-13 15:10:56 -05:00
Wilson Snyder 6a189a1f81 Fix exceeding command-line ar limit (#2834). 2021-03-13 15:09:10 -05:00
Wilson Snyder ce79c4ebf9 Fix class unpacked-array compile error (#2774). 2021-03-13 12:47:19 -05:00
Wilson Snyder abcb9cc91b Add VlWide to WDataInP. Part of coming commit. 2021-03-12 21:16:07 -05:00
Wilson Snyder 689d5b5090 Internals: Add std:: to make_pair. No functional change. 2021-03-12 18:17:49 -05:00
Wilson Snyder 3a55600913 Internals: Restyle with C++11 using replacing typedef 2021-03-12 18:10:45 -05:00
Wilson Snyder 404b323f8c Internals: Remove some unnecessary typedefs. No functional change. 2021-03-12 17:26:53 -05:00
Drew Taussig 3651321679
Fix for MSVC++ compile error (#2831) (#2833) 2021-03-11 13:30:23 -05:00
Wilson Snyder 9483ebefae Internal code coverage cleanups. 2021-03-07 21:05:15 -05:00
Wilson Snyder 2cad22a22a
Add simulation context (VerilatedContext) (#2660). (#2813)
**   Add simulation context (VerilatedContext) to allow multiple fully independent
      models to be in the same process.  Please see the updated examples.
**   Add context->time() and context->timeInc() API calls, to set simulation time.
      These now are recommended in place of the legacy sc_time_stamp().
2021-03-07 11:01:54 -05:00
Wilson Snyder caa9c99837 Commentary 2021-03-07 08:28:13 -05:00
Wilson Snyder 8c3ad591ae Internals: Add additional mutex exclusion checks. No functional change. 2021-03-06 18:29:11 -05:00
Wilson Snyder 47dcbd4b8a Internal: Remove deprecated/insecure functions. No functional change intended. 2021-03-06 10:34:03 -05:00
Wilson Snyder 018d994781 Convert VPI to singleton, part of (#2660). 2021-03-04 19:23:40 -05:00
Wilson Snyder ed2f8dc097 Internals: Rename some internal functions etc to avoid _V 2021-03-03 22:53:50 -05:00
Wilson Snyder be31fdcfe4 Use Google-style-guide header guard naming, to avoid __ prefix. 2021-03-03 21:57:07 -05:00
Wilson Snyder 90773f4980 Internals: Avoid coverage base class. No functional change. 2021-03-03 18:58:54 -05:00
David Turner e81abdb616
Fix slice-assign overflow bug (#2803) (#2811) 2021-03-01 18:20:56 -05:00
Wilson Snyder 5489bbcc41 Fix deadlock when error in flush routines 2021-02-27 14:43:52 -05:00
Wilson Snyder 206bd416aa Internals: Cleanup some RANDOM functions. 2021-02-24 22:13:24 -05:00
Wilson Snyder 30c34e4975 Internals: Avoid extra typedef. No functional change. 2021-02-24 21:13:00 -05:00
Wilson Snyder a886f28c85 Internals: Use static_assert 2021-02-23 19:02:04 -05:00
Wilson Snyder 8c2ee6c5ab With -DVL_NO_LEGACY hide all outdated API routines 2021-02-22 22:59:23 -05:00
Wilson Snyder 6ada513fa5 Internal: Don't serialize debug, turn on each run. 2021-02-22 22:39:57 -05:00
Wilson Snyder 9f381f7617 Remove old SP_AUTO_COVER3 define 2021-02-22 22:27:33 -05:00
Wilson Snyder 48986ccdeb Remove VL_TIME_I, rarely/never used and too little precision. 2021-02-21 21:56:43 -05:00
Wilson Snyder 0f8e494c76 Tests: Add t_verilated_legacy 2021-02-21 21:49:55 -05:00
Wilson Snyder 9650aefa42 Internals: Cleanup unneeded {}. No functional change 2021-02-21 21:25:21 -05:00
Wilson Snyder 3ae75926e4 Inline old VL_CTOR macros. 2021-02-21 12:12:11 -05:00
Wilson Snyder e44563fddc Tests: Use vl_time_stamp64 where reasonable 2021-02-16 20:14:30 -05:00
Wilson Snyder 43cf5693d1 Fix shifts by > 32 bit values (#2785). 2021-02-14 11:15:12 -05:00
github action af5fc4f1ad Apply clang-format 2021-02-03 19:41:25 +00:00
Àlex Torregrosa e77e4e1fe6
Improve struct scopes when dumping structs to VCD (#2776) 2021-02-03 14:40:21 -05:00
Yutetsu TAKATSUKASA b82085fbc6
Internals: Use size_t to compare with vector::capacity(). No functional change intended. (#2758) 2021-01-16 09:47:27 -05:00
Wilson Snyder 3bb8fbe73b Internal coverage improvements 2021-01-13 20:01:10 -05:00
Philipp Wagner b7c26dbea9
Fix to include limits header for std::numeric_limits (#2747)
Code using `std::numeric_limits` wasn't including the limits header,
leading to a compilation error in Fedora Rawhide (GCC 11.0).
2021-01-11 11:23:54 -05:00
Wilson Snyder bd602d0e2d Copyright year update 2021-01-01 10:29:54 -05:00
Wilson Snyder 93476a7372 Internals: Convert vlcovgen to python3. No functional change. 2020-12-23 16:54:05 -05:00
Wilson Snyder b7a533109d Fix cppcheck warnings. No functional change intended. 2020-12-23 15:22:02 -05:00
Wilson Snyder 941e5c659a Fix cppcheck parse error 2020-12-23 15:22:02 -05:00
Nandu Raj 1124829500
Fix $urandom_range maximum value (#2723) 2020-12-22 07:52:38 -05:00
Yutetsu TAKATSUKASA 4096dee598
Use files from gtkwave3-gtk3, not from gtkwave3 (#2718) 2020-12-21 07:06:03 +09:00
HyungKi Jeong 36f41e08a5
Fix to allow inheriting 'VerilatedVcdFile' class. (#2720) 2020-12-20 12:18:09 -05:00
Yutetsu TAKATSUKASA cb4ddd3213
Update files from GTKWave f119b35816e605e753fc1a24ae121a3787615b26 (#2716) 2020-12-19 09:13:18 -05:00
Wilson Snyder 1e34ae31d2 Fix vpi_release_handle to be called implicitly per IEEE (#2706). 2020-12-18 21:16:57 -05:00
Wilson Snyder 43811821d6 Backout GTKwave update 7deac509c6 2020-12-18 21:03:02 -05:00
Wilson Snyder 3797b5bca1 Check for vpi_release_handle even when no VL_DEBUG 2020-12-18 20:46:43 -05:00
Wilson Snyder 7deac509c6 GTKwave updates from upstream. 2020-12-18 19:33:57 -05:00
Wilson Snyder c39a8b439a Internals: Use emplace instead of insert(make_pair(...)). No functional change intended. 2020-12-18 18:24:47 -05:00
Todd Strader a88965a124
Fix scope map for multiple construction (#2710) 2020-12-17 12:21:40 -05:00
Wilson Snyder ff702174d8 Report double calls to vpi_release_handle when using VL_DEBUG 2020-12-16 19:10:17 -05:00
Wilson Snyder d5d6598d75 Internals: spacing 2020-12-16 19:08:10 -05:00
Yutetsu TAKATSUKASA ce9293fcb3
Fix memory leaks found in trace related tests (#2708)
* Fix memory leak of t_trace_cat and t_trace_cat_renew

* Fix memory leak of t_trace_c_api

* Fix memory leak in t_trace_public_func and t_trace_public_func_vlt

* Fix memory leaks in t_flat_build (and probably more).

* Use unique_ptr in testcases
2020-12-17 08:31:47 +09:00
Yutetsu TAKATSUKASA 738ee3d4eb
Fix memory leaks when using shared protect-lib (#2707)
* Guarantee mechanism to initialize just once is now in VerilatedInitializer. No functional change is intended.

* Make sure to initialize Verilated::NonInitialized just once. Fixes
memory leak in t_prot_lib_shared and t_hier_block_prot_lib_shared.

* Call setup() and teardown() of Verilated::NonSerialized.
2020-12-16 12:30:58 -05:00
Yutetsu TAKATSUKASA f98782c061
Tests: Fix use-after-free in fst testcases (#2709) 2020-12-16 10:00:13 -05:00
Wilson Snyder c54360485e Fix over-iterating dpi dimensions (#2703). 2020-12-15 22:09:24 -05:00
Wilson Snyder 3590f7e206 Remove unused VL_DISABLE_INTRINSICS, use VL_PORTABLE_ONLY instead 2020-12-13 19:14:09 -05:00
Marlon James 457d1a66f2
Fix VPI memory word indexing (#2695)
* Test that indexing into memory word fails

* VPI: don't index into memory word

Memory and memory words share a VerilatedVar, so check for memory word before attempting to index.
2020-12-12 22:47:47 -05:00
Wilson Snyder 517fdb7587 Support queue of arrays 2020-12-12 19:19:32 -05:00
Wilson Snyder 93304f3b82 Internals: Reorder library code. No functional change. 2020-12-12 08:58:03 -05:00
Marlon James 30546afdab
Fix VPI range iterator null return (#2691)
* Test that range iterator exhausts after 1 dimension

* Separate range iterator from range object

Range iterators should return NULL after all ranges have been returned
2020-12-12 08:11:08 -05:00
Wilson Snyder 82d8fe0c27 Internal coverage fixes 2020-12-10 22:01:56 -05:00
Wilson Snyder af0e535015 Internals: Remove Xnor node type.
Convert to Not(Xor(x)) up front, to help code coverage and optimize out extra nots sooner.
2020-12-10 00:04:10 -05:00
Wilson Snyder ab4ad9965c Fix DPI open array handling issues, and do internal coverage (#2350). 2020-12-09 22:15:34 -05:00
Wilson Snyder 7d05be802d Misc internal coverage hole and related bug fixes 2020-12-09 19:18:12 -05:00
Wilson Snyder 74ef35d3b3 Support $cast and new CASTCONST warning. 2020-12-05 22:58:36 -05:00
Wilson Snyder e3c32adad4 Rename static/thread misnamed variables. No functional change. 2020-12-01 19:32:01 -05:00
Wilson Snyder b054d937cb Rename static/thread misnamed variables. No functional change. 2020-12-01 19:01:20 -05:00
Wilson Snyder 212e8fb14b Internals: Cleanup some inlines, use constexpr. No functional change intended. 2020-12-01 18:49:03 -05:00
Wilson Snyder 014e43f0ef Reset index counts on clearing verilated_cov (static removal) 2020-12-01 18:30:25 -05:00
Wilson Snyder 9a9931fb9d Support complex function arguments. 2020-11-28 13:46:14 -05:00
Wilson Snyder f2d8e45d72 For performance, use unordered_set/map where possible. No functional change intended. 2020-11-25 20:57:30 -05:00
Wilson Snyder e85a2e860e Support 'with item.index'. 2020-11-23 23:18:58 -05:00
Wilson Snyder b684995292 Support $random and $urandom seeds. 2020-11-19 21:32:33 -05:00
Wilson Snyder b6ded59c2b Internals: Use and enforce class final for ~5% performance boost. 2020-11-18 21:32:16 -05:00
Wilson Snyder c0888c1b0f Internals: Use newline instead of endl to avoid unneeded flush. 2020-11-18 21:03:23 -05:00
Yutetsu TAKATSUKASA b500e57991
Add an overload of VL_CVT_PACK_STR_NN for lvalue (#2651) 2020-11-19 06:52:03 +09:00
Yutetsu TAKATSUKASA 19e4013ab5
Allow conversion from const void * to QData (#2650) 2020-11-18 23:44:45 +09:00
Wilson Snyder 82b2af3b83 Commentary 2020-11-17 22:48:37 -05:00
Marlon James 899e7bacb2
Fix VPI callback list iteration (#2644)
The end iterator always points to an element past the end of the list.
When new elements are added to the back of the list, they are inserted
before the end iterator.
Instead, track the last element in the list at the start of processing
and stop after it's been processed.
2020-11-17 17:19:51 -05:00
Wilson Snyder 1b0a48ea02 Internals: Use C++11 = default where obvious. No functional change intended. 2020-11-16 19:56:16 -05:00
Wilson Snyder f6f7684ccd Internal member initialization. No functional change intended. 2020-11-15 15:40:35 -05:00
Wilson Snyder 44eb362a18 clang-tidy cleanups. No functional change intended. 2020-11-10 21:40:14 -05:00
Kaleb Barrett 1c2384cb3d
Fix iteration over mutating list bug in VPI impl (#2588)
Previously, in any given VPI callback, if the callback body registered
the same callback, that registering would be processed in the currently
executing call to the call*Cbs function. In the worse case, this could
lead to an infinite loop.
2020-11-06 17:56:15 -05:00
Wilson Snyder 0505816d31 Fix C++14 deprecated random_shuffle. 2020-11-03 08:52:47 -05:00
Wilson Snyder 48bcf66ac7 Fix C++14 deprecated random_shuffle. 2020-11-02 20:07:58 -05:00
Wilson Snyder 0145d9d514 Fix C++14 deprecated random_shuffle. 2020-11-02 19:55:01 -05:00
Wilson Snyder 2aedc91151 Support queue and associative array 'with' statements. (#2616) 2020-11-01 10:56:07 -05:00
Wilson Snyder 3a53b32a32 Move queue code before assoc, as assoc will eventually use queues. No functional change. 2020-10-30 22:49:55 -04:00
Wilson Snyder 51b0963e61 Internals: Favor const for map keys. No functional change intended. 2020-10-30 18:00:40 -04:00
Yutetsu TAKATSUKASA 05ff96bea3
Fix SEGV when $fgets, $sscanf, or $fscanf is used with string (#2604)
* Add a test to use string for $fgets

* Use dedicated function for $fgets to std::string

* share the implementation of $fgets

* Pass -1 for bitwidth of std::string to distinguish from POD

* add checks for scanf with string

* apply clang-format
2020-10-28 08:37:12 +09:00
Marlon James 34b8ed4cf0
Return bool from callValueCbs() (#2589) (#2605)
* Return bool from callValueCbs()

Returns true if any registered callback was called, else false.

* Add test for callCbs() and callValueCbs()
2020-10-26 21:55:27 -04:00
Wilson Snyder 95d1272269 Support associative array pattern assignments and defaults. 2020-10-25 21:05:22 -04:00
Wilson Snyder 046c0a7aa1 Fix queue assignment with different limits, negative indicies 2020-10-24 22:08:11 -04:00
Wilson Snyder 51d1235cda Shorter stringify of empty queues, and better queue tests 2020-10-24 18:00:40 -04:00
Wilson Snyder 5d3dd52f13 Support queue slicing (#2326). 2020-10-18 13:23:39 -04:00
Wilson Snyder 4576644591 Prep for future queue slicing. 2020-10-17 21:09:10 -04:00
Wilson Snyder 8750352495 Internal coverage: Cleanup some savable errors and coverage. 2020-10-13 19:26:16 -04:00
Markus Krause 0a9ae154be
introduce define for FST tracing (#2592)
This is to allow C++ verilator toplevel to support
multiple modes of waveform tracing
VM_TRACE_FST can be used inside a #if VM_TRACE
section to switch between classic .vcd tracing and the
more compact .fst format supported by GTKWAVE
2020-10-10 21:17:39 -04:00
Rafal Kapuscik 7be343fd7c Support 'this' (#2585). 2020-10-08 07:54:01 -04:00
Wilson Snyder efbcb094ca Fix flushCall for backward compatibility (#2580). 2020-10-04 07:47:25 -04:00
Wilson Snyder 5033c906fd Commentary (#2577) 2020-09-30 16:55:26 -04:00
Wilson Snyder 87e4a86fbb Internal coverage improvements 2020-09-18 21:27:36 -04:00
Yutetsu TAKATSUKASA 70eb99b050
Fix double-free on shared protect-lib (#2526)
* Add a test to use shared object of protect-lib
* Add a guard to call ctor/dtor just once even when a protec-lib is shared object.
* Pass .a to linker in leaf-last order for older ld.
* Add -flat_namespace for mac
2020-08-31 08:22:31 -04:00
Wilson Snyder ba5779c69e Fix queues as class members (#2525). 2020-08-29 12:56:43 -04:00
Wilson Snyder 069eb97eca SystemC 2.3.0 or newer (SYSTEMC_VERSION >= 20111121) is now required. 2020-08-29 10:45:47 -04:00
Wilson Snyder 687edba969 Make: less verbose archive 2020-08-27 18:47:12 -04:00
Wilson Snyder 02e83da2fa Fix Travis/GCC warnings. 2020-08-27 08:47:34 -04:00