Commit Graph

4660 Commits

Author SHA1 Message Date
Geza Lore
a9c4a96c0f Internals: const pointer argument 2021-07-20 14:29:36 +01:00
Geza Lore
32e99ba0d9 Emit: Attach VL_ATTR_COLD to definitions as well as declarations.
This is required by clang if the definition precedes the declaration
(which can happen when building via __ALL.cpp), otherwise we get a
warning.
2021-07-20 13:52:53 +01:00
Wilson Snyder
da8930a57a Fix multitop to go to stderr (#3070) 2021-07-20 08:00:14 -04:00
Geza Lore
1166728a8d Tests: make t_trace_*two* tests less sensitive to file names
No functional change intended
2021-07-19 17:48:41 +01:00
Geza Lore
30fa5e41be Don't emit trace files with --lint-only 2021-07-19 17:48:38 +01:00
Geza Lore
cf39331d1f Emit: Factor out visitor that can emit constant initializers
This is needed both by the V3EmitCConstPool emitter and the
V3EmitCHeaders emitter.
2021-07-14 13:56:04 +01:00
Geza Lore
bac84726e1 Emit: Clean up some code coverage holes 2021-07-14 12:27:33 +01:00
Geza Lore
ddef61d62e Internals: Move AstNodeCCall::m_selfPointer to AstCCall
Other sub-classes of AstNodeCCall do not need the self pointer. Moving
it into the specific sub-class that needs it clarifies V3Descope and
Emit. No functional change intended.
2021-07-13 17:47:42 +01:00
Geza Lore
4081a1a539 Internals: Separate emitting of C++ headers and implementation
Internal AstNodeModule headers (.h) and implementation (.cpp) files are
now emitted separately in V3EmitC::emitcHeaders() and
V3EmitC::emitcImp() respectively. No functional change intended
2021-07-13 17:43:44 +01:00
Geza Lore
1691bbfe25 Remove unnecesasry and incorrect trace class CUse. 2021-07-13 14:20:57 +01:00
Geza Lore
17cc452f79 Add V3VariableOrder pass
A separate V3VariableOrder pass is now used to order module variables
before Emit. All variables are now ordered together, without
consideration for whether they are ports, signals form the design, or
additional internal variables added by Verilator (which used to be
ordered and emitted as separate groups in Emit). For single threaded
models, this is performance neutral. For multi-threaded models, the
MTask affinity based sorting was slightly modified, so variables with no
MTask affinity are emitted last, otherwise the MTask affinity sets are
sorted using the TSP sorter as before, but again, ports, signals, and
internal variables are not differentiated. This yields a 2%+ speedup for
the multithreaded model on OpenTitan.
2021-07-12 14:53:40 +01:00
Wilson Snyder
8ecdc85cf7 Internals: C++11 style cleanups. No functional change. 2021-07-11 18:42:01 -04:00
Geza Lore
5ad3c4e499 Internals: Speed up and improve V3Broken
This patch makes OpenTitan verilation with --debug-check 22% faster, and
the same with --debug --no-dump-tree 91% faster. Functionality is the
same (including when VL_LEAK_CHECKS is defined), except V3Broken can now
always find duplicate references via child/next pointers if the target
node is not `maybePointedTo()` (previously this only happened when
compiled with VL_LEAK_CHECKS). The main change relates to storing the
v3Broken traversal state in the AstNode by stealing a byte from what
used to be unused flags. We retain an unordered_set only for marking
pointers as valid to be referenced via a non-child/non-next member
pointer.
2021-07-11 21:03:17 +01:00
Geza Lore
8073e8bb46 Fix typo 2021-07-11 16:52:02 +01:00
Geza Lore
8a9d6d225b Internals: Add source file/line info to BROKEN_RTN messages 2021-07-11 16:50:05 +01:00
Wilson Snyder
c7499133b2 Internals: C++11 for bool. No functional change. 2021-07-11 10:42:32 -04:00
Wilson Snyder
687dd440a9 Removed deprecated Verilator tarball generation makefile rules. 2021-07-11 10:25:24 -04:00
Wilson Snyder
f1bb0bb725 Tests: Whitespace check all git files 2021-07-11 10:25:13 -04:00
Wilson Snyder
a8168d5d62 Commentary 2021-07-11 09:46:00 -04:00
Geza Lore
896b18e024 Emit function locals in the place they appear in the tree
Do not sort and hoist function local variables to the top of the
function definition. The stack layout of automatic variables is not
defined by C so the compilers can lay these out optimally. Simplifies
internals for follow on work. Effect on model performance is neutral to
very slight improvement, so we do not seem to be loosing anything.
2021-07-10 15:20:19 +01:00
Geza Lore
766ad14ae0 Check function locals are referenced only when in scope
V3Broken now checks that AstVar nodes referenced in an AstCFunc are
either external, or appear in the tree before the reference, and are in
scope.

Fix V3Begin to move lifted AstVars to beginning of FTask, rather than
end, which trips the above check.
2021-07-10 15:20:19 +01:00
Geza Lore
add3811f46 Internals: Fix debug prints racing with option parsing.
debug() declared by VL_DEGUB_FUNC used to cache the result of the debug
level lookup (which depends on options) in a static. This meant that if
the debug() function was called before option parsing, the default debug
level of 0 would be used for the rest of the program, even if a --debug
option was given. Fixed by not caching the debug level until after
option parsing is complete.
2021-07-10 12:57:40 +01:00
Wilson Snyder
f55177a49f Tests: Fix coverage holes. No functional change. 2021-07-10 07:11:50 -04:00
Wilson Snyder
bdceb08963 Internals: Fix off-by-one #line. 2021-07-10 07:11:34 -04:00
Geza Lore
825d6b87a8 Internals: Put AstNode flags in padding gap, initialize spare bits
The bool AstNode flags fit in a padding gap after m_type. This reduces
memory consumption by about 2% on OpenTitan. Initializing the unused
bits in the flags then avoids a read-modify-write in the constructor
(replacing it with a store constant). Overall verilation speed is about
1% faster.
2021-07-10 08:56:05 +01:00
Wilson Snyder
61e2e55ba5 Internals: Fix coverage holes. No functional change. 2021-07-09 18:11:59 -04:00
Wilson Snyder
e6b75f752b Commentary 2021-07-09 17:46:11 -04:00
Geza Lore
a4f5d95648 Fix -G to treat simple integer literals as signed (#3060)
The -G option now correctly parses simple integer literals as signed
numbers, which is in line with the standard and is significant when
overriding parameters without a type specifier.

Fixes #3060
2021-07-08 13:42:25 +01:00
Geza Lore
686baaf2cf Internals: Streamline trace function generation
Remove magic code fragments form EmitCTrace, so Emit need not be aware
that a function is tracing related or not (apart from the purpose of
file name generation). All necessary code is now generated via text
nodes in V3TraceDecl and V3Trace. No functional change intended.
2021-07-08 02:08:09 +01:00
Geza Lore
76b3776fa3 Change generated tracing routines to use snake_case
For consistency with the rest of the generated code, generated methods
related to tracing now use snake_case instead of camelCase. No
functional change intended.
2021-07-08 02:08:09 +01:00
Wilson Snyder
3ed2af638b devel release 2021-07-07 20:50:11 -04:00
Wilson Snyder
8e2ba6a003 Version bump 2021-07-07 20:43:07 -04:00
Wilson Snyder
3aa6332f25 Fix Codacy warnings. No functional change. 2021-07-07 19:42:49 -04:00
Wilson Snyder
36599133bf Add --prof-c to pass profiling to compiler (#3059). 2021-07-07 19:12:52 -04:00
Wilson Snyder
941f96c913 Commentary 2021-07-07 17:59:22 -04:00
Wilson Snyder
93578d64d2 Internals: Remove old needHeavy code. 2021-07-07 17:56:34 -04:00
Dan Petrisko
8c705ee145
Support middle-of-design nested topmodules (#3026) 2021-07-07 15:00:29 -04:00
Dan Petrisko
c5c5f11e16
Tests: Adding failing test case for source synchronous signals (#3038) 2021-07-07 14:00:17 -04:00
Morten Borup Petersen
fd0446f481
Internals: Add .dot graph visualization of ThreadSchedule (#3048)
* Move MTaskState to ThreadSchedule

MTaskState does not concern itself with sandbagging, and thus solely contains information related to the finalized schedule, i.e., completion time, thread ID and next MTask on thread.

* Add .dot graph visualization of ThreadSchedule

Follow-up to #2779.

This commit adds the creation of .dot files - used by GraphViz - to visualize how mtasks are statically scheduled across the set of specified threads.
We visualize each thread as a row, with nodes of a row being the mtasks scheduled for the given thread. The width of the mtask nodes are proportional to their cost. MTask dependencies are shown using an edge between the source and sink mtasks.
2021-07-06 07:06:00 -04:00
Geza Lore
2ebed755e6 V3Simulate: Avoid copying while managing free list.
V3Simulate reuses allocated AstConst nodes for efficiency, however this
used to be implemented in a way that required a deep copy of a
std::unorderd_map<_, std::deque<_>>, which was quite inefficient when it
grew large. The free list is now managed without any copying. This takes
the V3Table pass from taking 12s to 0.2s on SweRV EH1.
2021-07-05 17:07:33 +01:00
Geza Lore
2a7aa28b20 V3Simulate/V3Table: change deques to vectors for performance
We can get away with only push_back and back on sequence containers, in
which case std::vector is significantly faster than std::deque.
2021-07-05 15:53:56 +01:00
Geza Lore
fb56f4f880 Tests: make t_prot_lib*.pl name mangling deterministic
This is to facilitate diffing generated files in tests.
2021-07-02 00:21:24 +01:00
Geza Lore
d4e73e215e Tests: fail test if vcddiff aborts, fix failing tests
Tests used to silently pass when vcddiff aborted. Now fixed. Updated
large array trace reference files for FST, added same reference files
for VCD.

Developers need to update their local vcddiff.
2021-07-01 23:22:25 +01:00
Geza Lore
d5c9369103
Internals: Fix suspicious dtype clone relinking. (#3056) 2021-07-01 14:33:44 -04:00
Geza Lore
af27702188 Fix type parameter resolution with hash collision.
We incorrectly treated two different struct types the same when passed
as an actual parameter to a `parameter type` parameter in an instance,
if the actual parameter expression both hash to the same value and the
structs have the same struct name. This is now corrected.

Fixes #3055.
2021-07-01 16:52:29 +01:00
Morten Borup Petersen
2c813488f4
Tests: Add simulator benchmarking data option for regression tests (#3054)
This commit adds the '--simbenchmark' option to the regression test compile command.
The option is not intended as a fully-fledged benchmarking infrastructure, but rather a
utility for easily generating cycle- and execution time information when executing a verilated test.

As an example use case, the included test file shows how optimization level is varied across
three different builds+simulations, with the statistics for each run output to the same file in
the output directory.

Future work:
- 'sim_time' in the generated top-level main file should be a parameter.
- Given the above, the test execution script from verilog-sim-benchmark can be integrated
to generate better estimates of cycles/second through varying 'sim_time' over multiple executions.
2021-07-01 11:17:55 -04:00
Geza Lore
708abe0dd1 Introduce model interface class, make $root part or Syms (#3036)
This patch implements #3032. Verilator creates a module representing the
SystemVerilog $root scope (V3LinkLevel::wrapTop). Until now, this was
called the "TOP" module, which also acted as the user instantiated model
class. Syms used to hold a pointer to this root module, but hold
instances of any submodule. This patch renames this root scope module
from "TOP" to "$root", and introduces a separate model class which is
now an interface class. As the root module is no longer the user
interface class, it can now be made an instance of Syms, just like any
other submodule. This allows absolute references into the root module to
avoid an additional pointer indirection resulting in a potential speedup
(about 1.5% on OpenTitan). The model class now also contains all non
design specific generated code (e.g.: eval loops, trace config, etc),
which additionally simplifies Verilator internals.

Please see the updated documentation for the model interface changes.
2021-06-30 16:35:40 +01:00
Yutetsu TAKATSUKASA
22e0f3edbe
Introduce small object optimization to V3Number (#3034) 2021-06-30 21:20:56 +09:00
Felix Yan
2cdf0aae72
Commentary: Correct a typo in configure.ac (#3045) 2021-06-28 23:18:14 -04:00
Wilson Snyder
ee4a601c9e Internals: Use interface initialization for cleaner code. No functional change. 2021-06-28 22:40:39 -04:00