Commit Graph

2166 Commits

Author SHA1 Message Date
Wilson Snyder
f937e3282f Tests: Ignore DepSet hash numbers. (#3083) 2021-07-25 11:20:19 -04: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
b90fce55f4 Includes: Refactor verilated.h and deprecate verilated_heavy.h (#2701). 2021-07-24 10:00:33 -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
Wilson Snyder
13933743ad Suppress creating change_request if not needed. 2021-07-22 20:50:03 -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
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
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
Geza Lore
8a9d6d225b Internals: Add source file/line info to BROKEN_RTN messages 2021-07-11 16:50:05 +01: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
f55177a49f Tests: Fix coverage holes. No functional change. 2021-07-10 07:11:50 -04:00
Wilson Snyder
61e2e55ba5 Internals: Fix coverage holes. No functional change. 2021-07-09 18:11:59 -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
Wilson Snyder
36599133bf Add --prof-c to pass profiling to compiler (#3059). 2021-07-07 19:12:52 -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
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
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
Geza Lore
2825940fad Fix dtype when simplifying masked shift.
Fixes #3044
2021-06-25 18:06:43 +01:00
Geza Lore
a198a3c1e1 Add extern "C" to function declarations in VPI tests.
These are necessary to link the executables. So far we have been saved
by one of the generated headers forward declaring these functions with
extern "C", but changing that header would break these tests.
2021-06-24 16:48:58 +01:00
Yutetsu TAKATSUKASA
ec4eb18846
Fiix incorrect result by bit tree opt (#3023) (#3030)
* Add a test to reproduce #3023. Also applied verilog-mode formatting.

* use unique_ptr. No functional change is intended.

* Introduce restorer that reverts changes during iterate() if failed.
2021-06-21 07:28:39 +09:00
Wilson Snyder
2ee52222e2 Tests: Add test (#2912). 2021-06-19 14:39:34 -04:00
Wilson Snyder
c11cd18491 In XML, show pinIndex information (#2877). 2021-06-19 13:41:41 -04:00
Geza Lore
9eafca5e28
Remove deprecated --no-relative-cfuncs (#3024) 2021-06-16 23:17:43 -04:00
Geza Lore
a8f83d5758
Construct AstExecGraph implementation outside of V3EmitC. (#3022)
The goal of this patch is to move functionality related to constructing
the thread entry points and then invoking them out of V3EmitC (and into
V3Partition). The long term goal being enabling V3EmitC to emit
functions partitioned based on header dependencies. V3EmitC having to
deal with only AstCFunc instances and no other magic will facilitate
this.

In this patch:
- We construct AstCFuncs for each thread entry point in
V3Partition::finalize and move AstMTaskBody nodes under these functions.
- Add the invocation of the threads as text statements within the
AstExecGraph, so they are still invoked where the exec graph is located.
(the entry point functions are still referenced via AstCCall or
AstAddOrCFunc, so lazy declarations of referenced functions are created
automatically).
- Explicitly handle MTask state variables (VlMTaskVertex in
verilated_threads.h) within Verilator, so no need to text bash a lot of
these any more (some text refs still remain but they are all created
next to each other within V3Partition.cpp).

The effect of all this on the emitted code should be nothing but some
identifier/ordering changes. No functional change intended.
2021-06-16 12:18:56 +01:00
Geza Lore
c75a686081
Internals: Update to clang-format-11 (#3021) 2021-06-14 14:50:40 -04:00
Geza Lore
24b5215cf9 Add --enable-m32 to configure 2021-06-14 00:37:59 +01:00
Wilson Snyder
13ddd0bc1c Fix error on unsupported recursive functions (#2957). 2021-06-13 12:38:31 -04:00
Wilson Snyder
31121141db Convert pipe filter example to python 2021-06-13 12:03:53 -04:00
Wilson Snyder
9d3e800311 Commentary 2021-06-13 12:03:53 -04:00
Geza Lore
7280307a39 Implement DPI import/export as loose functions 2021-06-13 15:06:28 +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
c67fe02f06 Do not generate debug info in tests
Pointless and takes up a lot of cache space in CI, so remove -ggdb and
associated debug options from tests.
2021-06-13 02:55:29 +01:00
Geza Lore
5555f20bd2 Improve ccache-report 2021-06-09 19:14:11 +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
Wilson Snyder
1e89392e76 Add --expand-limit argument (#3005). 2021-06-06 10:27:01 -04:00
Wilson Snyder
1f19e8e206 Tests: Add test case for #2895. 2021-06-06 09:17:56 -04:00
Geza Lore
eea7e1bd2a
Do not emit leading spaces on blank lines (#3007) 2021-06-04 15:00:13 +01:00
Julien Margetts
1f331bd94f
Fix part select issues in LATCH warning. (#2948) (#2938) 2021-06-01 09:01:18 -04:00
Wilson Snyder
2143bcfad5 Fix constant function calls with uninit value (#2995). 2021-05-31 22:46:41 -04:00
Geza Lore
e1f9fffb42
Fix --protect-ids when using SV classes (#2994)
A few names were incorrectly mangled, which made --protect-ids produce
invalid output when certain SV class constructs were uses. Now fixed and
added a few extra tests to catch this.
2021-05-31 13:40:22 +01:00