Commit Graph

4682 Commits

Author SHA1 Message Date
github action
33af14eba8 Apply 'make format' 2021-07-25 01:07:07 +00:00
Steven Hugg
18b0f6387d
Add XML ccall, constpool, initarray, and if/while begins (#3080)
* EmitXml: Added <ccall>, <constpool>, <initarray>/<inititem>, wrapped children of <if> and <while> with <begin> elements to prevent ambiguity
* EmitXml: added signed="true" to signed basicdtypes
2021-07-24 21:06:06 -04:00
Wilson Snyder
43ecaec9a0 Internal C++11 flex cleanups. No functional change intended. 2021-07-24 12:49:07 -04:00
Wilson Snyder
275885a797 Internals: Fix some long UNSUP lines. No functional change. 2021-07-24 12:21:04 -04:00
Wilson Snyder
68aa731ce9 Fix missing null on blackbox parse. 2021-07-24 12:13:19 -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
44173b40a1 Internals: Remove dead code. No functional change. 2021-07-24 09:18:49 -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
19875d2e85 Increase split count of ChangeDet (#3072). 2021-07-23 19:24:25 -04:00
Geza Lore
1de33b9fb7 Support localparams in tasks/functions 2021-07-23 20:34:49 +01:00
Geza Lore
90c917ee83 Enable now supported tests for string array initializers
Fixes #2895.
2021-07-23 17:21:15 +01:00
Geza Lore
4ab4c0c8ba Emit parameter values as 'static constexpr' instead of enum
All parameters that are required in the output are now emitted as
'static constexpr, except for string or array of strings parameters,
which  are still emitted as 'static const' (required as std::string is
not a literal type, so cannot be constexpr).  This simplifies handling
of parameters and supports 'real' parameters.
2021-07-23 17:20:26 +01: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
13933743ad Suppress creating change_request if not needed. 2021-07-22 20:50:03 -04:00
Wilson Snyder
fc25721e55 Increase instruction count of ChangeDet (#3072) 2021-07-22 20:13:45 -04:00
Wilson Snyder
fa64f8fb32 Internals: C++11 cleanup. No functional change intended. 2021-07-22 20:05:54 -04:00
Geza Lore
ab4063f098 Emit implementations into separate files based on required headers.
This patch partitions AstCFuncs under an AstNodeModule based on which
header files they require for their implementation, and emits them
into separate files based on the distinct dependency sets. This helps
with incremental recompilation of the output C++.
2021-07-22 18:01:07 +01:00
Geza Lore
8bb77f86ec Emit: Factor out parent module access via user4
No functional change.
2021-07-22 16:31:46 +01:00
Geza Lore
42d918c163 Internals: Omit selfPointer from ConstPool references
AstVarRefs to constant pool values are special and they have no use for
the selfPointer. Removing it simplifies future downstream code.
2021-07-22 13:35:22 +01:00
Geza Lore
e3dd70c373 Internals: Simplify V3CUse
No functional change intended.
2021-07-20 19:52:15 +01:00
Geza Lore
9273fafbbf Internals: Split parts of V3CUse into V3Common
Apart from adding required AstCUse, V3CUse also used to create some
standard methods for classes. This is now done in a separate pass
V3Common. Note that this is not a performance issue, as V3Common just
iterates through each module, which are stored in a simple linked list
under the netlist, and does not need to traverse the whole netlist.
2021-07-20 17:18:52 +01:00
Geza Lore
d9c893af11 Internals: Add VString::startsWith predicate function 2021-07-20 14:29:43 +01:00
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