Commit Graph

379 Commits

Author SHA1 Message Date
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 4452a9b10f Internals: Fix some VL_MT metacomments. 2022-11-28 07:08:34 -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 66d85b3381 Internals: Fix cppcheck warnings. No functional change intended. 2022-11-21 21:40:49 -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
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 218dd4322b Fix C++11 warnings 2022-11-12 16:03:13 -05: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
Kamil Rakoczy ed93a111c2
Fix deadlock in ``timeprecision`` when using systemC (#3707) 2022-10-26 04:50:28 -07:00
Wilson Snyder e7068369fe Fix $display of fixed-width numbers (#3565). 2022-10-18 21:10:35 -04:00
Wilson Snyder 6f9c585452 Spelling (#3664) 2022-10-09 14:18:14 -04:00
Wilson Snyder 4367e03e46 Internals: Make VL_UNREACHABLE similar to std::unreachable() 2022-10-02 16:35:45 -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
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 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
Wilson Snyder a2d26b45bb Internals: Fix some clang-tidy issues. No functional change intended. 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 b9d7819faa Internals: Fix some cppcheck issues. Some dump functions fixed. 2022-07-30 10:01:39 -04:00
Gustav Svensk eeef5ab4de
Fix sformat string incorrectly cleared (#3515) (#3519). 2022-07-25 17:36:34 +02: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 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
Wilson Snyder 5aa12e9b51 Add assert when VerilatedContext is mis-deleted (#3121). 2022-05-15 10:51:03 -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
Geza Lore c7440b250f Validate integer run-time arguments 2022-03-26 22:58:47 +00:00
Wilson Snyder ef87d057fc Fix $fscanf etc to return -1 on EOF (#3113). 2022-03-07 17:43:33 -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 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
Wilson Snyder 7526151670 Fix bad ending address on $readmem (#3205). 2021-12-21 19:55:04 -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 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 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 9029da5ab8 Add profile-guided optmization of mtasks (#3150). 2021-09-26 22:51:11 -04:00
Wilson Snyder 959793cde3 Internals: Cleanup VL_VALUE_STRING_MAX widths (#3050). 2021-08-23 21:13:33 -04: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
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
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
Yutetsu TAKATSUKASA 1e4839e5d1
Fix casting to integer not to cause integer overflow. (#2930) 2021-05-07 12:00:36 -04:00
Àlex Torregrosa 2b2680770b
Improve scope types in FST and VCD traces (#2805). 2021-04-07 09:55:11 -04:00
Wilson Snyder 8992e2ec02 Commentary 2021-03-28 11:50:05 -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 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 3a55600913 Internals: Restyle with C++11 using replacing typedef 2021-03-12 18:10:45 -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 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 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 6ada513fa5 Internal: Don't serialize debug, turn on each run. 2021-02-22 22:39:57 -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 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 b7a533109d Fix cppcheck warnings. No functional change intended. 2020-12-23 15:22:02 -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 d5d6598d75 Internals: spacing 2020-12-16 19:08:10 -05: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
Wilson Snyder c54360485e Fix over-iterating dpi dimensions (#2703). 2020-12-15 22:09:24 -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 b684995292 Support $random and $urandom seeds. 2020-11-19 21:32:33 -05:00
Wilson Snyder c0888c1b0f Internals: Use newline instead of endl to avoid unneeded flush. 2020-11-18 21:03:23 -05:00
Wilson Snyder 82b2af3b83 Commentary 2020-11-17 22:48:37 -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 44eb362a18 clang-tidy cleanups. No functional change intended. 2020-11-10 21:40:14 -05: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
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 3ad3944f2c Fix Travis/GCC warnings. For VPI/DPI still avoid C++11. 2020-08-24 18:49:36 -04:00
Wilson Snyder f4a72946eb Support $urandom, $urandom_range without stability. 2020-08-23 08:42:50 -04:00
Wilson Snyder 6013b54f7b clang-tidy cleanups. No functional change intended. 2020-08-16 14:55:46 -04:00
Wilson Snyder ee9d6dd63f C++11: Favor auto, range for. No functional change intended. 2020-08-16 11:44:06 -04:00
Wilson Snyder 72d2cff0a1 C++11: Use member declaration initalizations. No functional change intended. 2020-08-16 11:44:06 -04:00