Commit Graph

2923 Commits

Author SHA1 Message Date
Andrew Nolte 6159a7dd8d
Fix VPI generate scope array naming (#3835) (#3836) 2023-01-03 07:38:55 -05:00
Wilson Snyder b24d7c83d3 Copyright year update 2023-01-01 10:18:39 -05:00
Ryszard Rozak bf4a844f2b
Fix self references when param class instantiated (#3833) 2022-12-30 06:05:01 -05:00
Wilson Snyder 5dbff89a90 Internal line coverage fixes 2022-12-29 20:18:28 -05:00
Wilson Snyder 24198ef0ed Internal line coverage fix 2022-12-29 14:18:45 -05:00
Wilson Snyder 8064b78d4f Test: Rename 2022-12-29 14:10:47 -05:00
Larry Doolittle 80a144797d
Commentary: Fix more spelling (#3828) 2022-12-26 10:30:41 +01:00
Wilson Snyder 1f58f48c05 Tests: Rename test of last commit 2022-12-23 13:12:21 -05:00
Wilson Snyder c0499da28b Spelling fixes 2022-12-23 11:32:38 -05:00
Wilson Snyder 3ccb2e0f2d Fix initiation of function variables (#3815). 2022-12-23 10:51:52 -05:00
Krzysztof Bieganski bb44d4e4f2
Support clocking blocks (#3674) 2022-12-23 07:34:49 -05:00
Jevin Sweval 299261714b
Fix crash in DFT due to width use after free (#3817) (#3820) 2022-12-20 19:36:04 -05:00
Aleksander Kiryk c2b09e35f8
Support unpacked structs (#3802) 2022-12-20 19:22:42 -05:00
Wilson Snyder c3b4bc85fa Tests: Ignore tabs in .mk.in 2022-12-20 11:20:23 -05:00
Mariusz Glebocki cb413aa264
Tests: Make it mt-safe to call operators on guarded and local objects. (#3821) 2022-12-19 10:53:28 -05:00
Wilson Snyder a15cd76a28 Tests: Add copyright. 2022-12-16 18:09:00 -05:00
Kamil Rakoczy 7a15457511
Tests: Add multithreading attribute checks (#3748) 2022-12-16 11:19:27 -05:00
Wilson Snyder f331c192b4 Tests: Fix duplicated if. 2022-12-12 21:32:45 -05:00
Wilson Snyder 972a11537c Internals: Fix lint-py warnings 2022-12-11 21:58:02 -05:00
Wilson Snyder 609bfa46e8 Fix ENUMVALUE on parameter, again (#3777). 2022-12-11 21:10:12 -05:00
Wilson Snyder 86b07423a9 Fix ENUMVALUE on parameter (#3777). 2022-12-11 13:28:24 -05:00
Wilson Snyder 3f4d4dec77 Fix ENUMVALUE on typedef (#3777) 2022-12-11 11:50:22 -05:00
Wilson Snyder a0e7930036 docs: Fix spelling 2022-12-09 22:39:41 -05:00
Wilson Snyder d61ad04f32 docs: Fix and test for AsciiDoc breaks (#3728) 2022-12-09 21:01:33 -05:00
Wilson Snyder 0824ef377f wip 2022-12-09 20:32:09 -05:00
Wilson Snyder 2dc0053ea4 Tests: rename 2022-12-08 07:23:53 -05:00
Krzysztof Bieganski 4b6e15d0eb
Fix non-blocking assignments in forks (#3781) (#3800) 2022-12-06 07:16:07 -05:00
Wilson Snyder ea1b141d13 Support probablity distribution functions. 2022-12-04 17:30:51 -05:00
Wilson Snyder 675cc891a5 Tests: Add rerunnable(0) 2022-12-02 19:57:40 -05:00
Wilson Snyder 0809c17ce1 Tests: Rename some tests that should be _bad. 2022-12-02 19:17:29 -05:00
Wilson Snyder 701d2277cd Tests: rename 2022-12-02 07:34:34 -05:00
Wilson Snyder e465a30eee Fix lint_off EOFNEWLINE in .vlt files (#3796). 2022-12-01 18:27:36 -05:00
Yutetsu TAKATSUKASA 889a1211f1
Fix 3786 (Internal error in bit op tree optimization) (#3793)
* Tests: Add a test to reproduce 3786

* Fix #3786 (Internal error in bit op tree optimization).
2022-12-01 22:00:24 +09:00
Wilson Snyder d87ef8394a Fix CASEINCOMPLETE when covers all enum values (#3745) (#3782).
Co-authored-by: "G-A. Kamendje" <gkamendje@gmail.com>
2022-11-30 19:42:21 -05:00
Wilson Snyder 4f4c26383c Support unpacked byte assignment from strings. 2022-11-30 19:17:28 -05:00
Wilson Snyder 42e4e18ec8 Support multiple $dumpvar identifiers 2022-11-30 18:13:57 -05:00
Wilson Snyder 355c4f76d0 Add error when super.new is not first statement (#3789) 2022-11-30 07:41:57 -05:00
Ryszard Rozak 073dc03adc
Support super.new calls (#3789) 2022-11-30 06:42:48 -05:00
Ryszard Rozak faedcc755b
Tests: Add test of passing this as argument (#3790) 2022-11-29 10:46:26 -05:00
Yinan Xu e569ff2752
Add error when use --exe with --lib-create. (#3785) 2022-11-29 06:37:38 -05:00
Krzysztof Bieganski 68e1b473e2
Support `std::semaphore` and typed `std::mailbox` (#3708)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-11-28 16:53:55 +01:00
Wilson Snyder f4be3d5d2b Fix empty string literals converting to string types (#3774). 2022-11-27 13:28:57 -05:00
Wilson Snyder 054b792021 Fix ENUMVALUE error to show value location (#3783) 2022-11-27 08:44:30 -05:00
Wilson Snyder d8071819fc Fix unquoted name in dtype errors. 2022-11-27 05:59:40 -05:00
Wilson Snyder 4b3731d318 Remove env from main() to be C++11 compatible 2022-11-23 18:50:31 -05:00
Ryszard Rozak 68f8617f79
Support member selects in with clauses (#3775) 2022-11-23 13:15:10 -05:00
Yves Mathieu 06fdf7be58
Add support of Events for VCD/FST traces (#3759) 2022-11-23 04:07:14 -05:00
Ryszard Rozak 57975c82b7
Support 'with' in unique, unique_index, min, max in queues (#3772) 2022-11-22 09:10:25 -05:00
Wilson Snyder d3c1f4353e Fix float parameters without parens 2022-11-21 06:48:13 -05:00
Ryszard Rozak 62bdd3ab49
Fix timing control in while-break loops (#3733) (#3769) 2022-11-21 06:27:55 -05:00
Geza Lore 3abb65d732 Strengthen AstNode types to AstNodeExpr
Declare every AstNode children and variables as AstNodeExpr where we
statically know this is the appropriate sub-type.
2022-11-20 19:31:28 +00:00
Wilson Snyder 278d532368 Tests: Add TEST_DUMPFILE define 2022-11-20 09:40:02 -05:00
Wilson Snyder 6297650fef Tests: Fix internal error stability 2022-11-20 07:45:51 -05:00
Wilson Snyder 5634e96bb6 Tests: Remove unsupported() in tests, instead check whatever is current behavior 2022-11-19 22:43:10 -05:00
Wilson Snyder e266b2cb03 Tests: Add $dist tests 2022-11-19 22:01:55 -05:00
Wilson Snyder 0af3efda5c Tests: Fix top_filename to properly test (#3767) 2022-11-19 17:09:43 -05:00
Wilson Snyder d3e1c40238 Tests: Cleaner macro. No functional change. 2022-11-19 17:06:11 -05:00
Wilson Snyder aacb38b776 Support assignment expressions. 2022-11-19 15:23:37 -05:00
Mariusz Glebocki d0e7177d8e
Disable stack size limit (#3706) (#3751) 2022-11-19 14:44:54 -05:00
Wilson Snyder 3a27e3d67b Fix false ENUMVALUE errors in unstable branch (#3761) 2022-11-19 14:07:39 -05:00
Wilson Snyder 09dff9c3a7 Fix false ENUMVALUE errors in unstable branch (#3761) 2022-11-19 13:30:23 -05:00
Wilson Snyder 0322e9da7e Fix randcase inside function. 2022-11-18 21:30:34 -05:00
Ryszard Rozak ef72b73a59
Support foreach loops on strings (#3760) 2022-11-18 07:07:56 -05:00
Wilson Snyder 749aab0a56 Support triple-quote blocks. 2022-11-17 20:38:01 -05:00
Wilson Snyder e8a1e4745c Support $stacktrace 2022-11-17 19:12:54 -05:00
Wilson Snyder 96306b7630 Tests: Update t_class_class 2022-11-17 18:15:38 -05:00
Ryszard Rozak d41efb189d
Fix pre/postincrement operations (#3744) (#3756) 2022-11-17 13:26:45 -05:00
Wilson Snyder 3c77c7bb92 Support and 2022-11-16 21:10:54 -05:00
Ryszard Rozak 3ddfa214e3
Fix $unit as base package for other packages (#3755) 2022-11-16 18:58:57 -05:00
Wilson Snyder a58cd66358 Fix printtimescale 2022-11-16 18:17:24 -05:00
Wilson Snyder c6ecd60993 Support pre_randomize and post_randomize. 2022-11-13 11:59:40 -05:00
Wilson Snyder d25834e57b Add ENUMVALUE warning when value misused for enum (#726). 2022-11-12 20:11:05 -05:00
Geza Lore eaf09ba0e7 Dfg: resolve multi-driven signal ranges
In order to avoid unexpected breakage on multi-driven variables, we
resolve in DFG construction by using only the first driver encountered.
Also issues the MULTIDRIVEN error for these signals.
2022-11-12 20:34:51 +00:00
Wilson Snyder 0a045a7bf6 Change ENDLABEL from warning into an error. 2022-11-12 12:09:48 -05:00
Geza Lore dbcaad99c5 Dfg: Fix crash on additional driver from non-DFG logic
Ensure variables written by non-DFG code are kept

Fixes #3740
2022-11-12 11:55:49 +00:00
Wilson Snyder a427860825 Support randcase. 2022-11-11 21:53:05 -05:00
Wilson Snyder 227e61f891 Fix comparing ranged slices of unpacked arrays. 2022-11-11 18:01:30 -05:00
Wilson Snyder b2e61425d6 Fix const initial assignments. 2022-11-11 17:45:34 -05:00
Wilson Snyder 9d7c4d9af3 Fix wait 0. 2022-11-11 17:18:59 -05:00
Wilson Snyder 528a73a492 Fix instability after disable iff error. 2022-11-10 22:09:24 -05:00
Wilson Snyder fbf2e59c85 Fix loss of V3Simulate on expression statements. 2022-11-10 20:49:11 -05:00
Wilson Snyder 16586d1d37 Fix tracing parameters overridden with -G (#3723). 2022-11-10 20:30:10 -05:00
Ryszard Rozak 441b5da5ce
Fix 'with' clause handling in functions (#3739) 2022-11-10 18:08:15 -05:00
Wilson Snyder e64295e92b Fix missing UNUSED warnings with --coverage (#3736). 2022-11-09 21:45:14 -05:00
Ryszard Rozak cbf9cc8e5f
Fix return in constructors (#3734) 2022-11-09 06:32:22 -05:00
Ryszard Rozak a29d9469da
Fix jump handling in do while loops (#3731) 2022-11-08 20:01:08 -05:00
Geza Lore fb9ec03c3f DfgPeephole: Use a work list driven algorithm for speed
Replace the 'run to fixed point' algorithm with a work list driven
approach. Instead of marking the graph as changed, we explicitly add
vertices to the work list, to be visited, when a vertex is changed. This
improves both memory locality (as the work list is processed in last in
first out order), and removed unnecessary visitations when only a few
nodes changes.
2022-11-05 20:31:09 +00:00
Wilson Snyder 21926eeb6b Tests: Improve some coverage 2022-11-05 11:40:34 -04:00
Geza Lore 6ae6b16223 V3Const: Fix folding of LogAnd with non-bool operands
Folding an AstLogAnd with a non-zero constant operand used to coerce the
type of the other operand, yielding an ill-typed node that DFG was then
unhappy about. Add a RedOr instead if the width of the replacement
operand is greater than zero.

Fixes #3726
2022-11-05 13:36:21 +00:00
Kamil Rakoczy d6126c4b32
Remove --no-threads; require --threads 1 for single threaded (#3703). 2022-11-05 08:47:34 -04:00
Ryszard Rozak 8d61cea366
Fix return type of $countbits functions to int (#3725) 2022-11-04 08:58:17 -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
Ryszard Rozak bac98df46b
Support named properties (#3667) 2022-11-01 18:53:47 -04:00
Geza Lore 0675510eb9 DFG: Fix attempted evaluation of constants wider than 32 bits
Fixes #3718
2022-10-28 17:14:19 +01:00
Wilson Snyder ee26378394 Tests: Fix instability (#3717) 2022-10-28 10:32:52 -04:00
Geza Lore 54c4351c39 V3Const: Do not introduce redundant AstExtend
Fixes #3716
2022-10-28 14:54:00 +01:00
Geza Lore e504e9aced Optimize clocked processes to comb when referencing const variables
In V3Active, we try hard to turn `always @(a or b or c)` into an
`always_comb` if the only variables read in the block are also in the
sensitivity list. In addition, also allow this optimization when reading
variables that are not in the sensitivity list, but are known to be
constant/never changing after initialization. In particular lookup
tables introduced by V3Table are covered by this. This can have a
significant impact on designs that use the `always @(a or b or c)` style
for combinational logic.
2022-10-28 14:37:30 +01:00
Wilson Snyder 5c658f8cd5 Fix width mismatch on inside operator (#3714). 2022-10-28 06:38:49 -04:00
Kamil Rakoczy ed93a111c2
Fix deadlock in ``timeprecision`` when using systemC (#3707) 2022-10-26 04:50:28 -07:00
Wilson Snyder 3487701b04 Tests: Cover some previously uncovered warnings 2022-10-22 16:03:42 -04:00
Wilson Snyder d33a3d09f7 Tests: Fix bison-dependent .out 2022-10-22 14:35:36 -04:00
Wilson Snyder 0716a28816 Tests: Check for v3warn/v3error without a test 2022-10-22 13:46:49 -04:00
Wilson Snyder 8e1901da10 Tests: Cover some previously uncovered warnings 2022-10-22 13:45:48 -04:00
Wilson Snyder ecfa385f13 Test/cleanup endtable without table 2022-10-22 12:30:44 -04:00
Wilson Snyder 495d52d30f Test and fix extra end_keywords 2022-10-22 12:17:56 -04:00
Wilson Snyder 2df886b2b0 Tests: Check std:: package for mailbox/process/semaphore 2022-10-22 10:58:10 -04:00
Krzysztof Bieganski fcf0d03cd4
Dynamic triggers for non-static contexts (#3599)
In non-static contexts like class objects or stack frames, the use of
global trigger evaluation is not feasible. The concept of dynamic
triggers allows for trigger evaluation in such cases. These triggers are
simply local variables, and coroutines are themselves responsible for
evaluating them. They await the global dynamic trigger scheduler object,
which is responsible for resuming them during the trigger evaluation
step in the 'act' eval region. Once the trigger is set, they await the
dynamic trigger scheduler once again, and then get resumed during the
resumption step in the 'act' eval region.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-22 14:05:39 +00:00
Wilson Snyder a57a3579c0 Fix false LATCH warning on 'unique if' (#3088). 2022-10-21 19:10:06 -04:00
Wilson Snyder 347e9b4ec8 Fix cell assigning integer array parameters (#3299). 2022-10-21 18:26:39 -04:00
Krzysztof Bieganski 785c51dd0b
Fix emitting timing debug info with `--protect-ids` (#3689) (#3701) 2022-10-21 16:56:44 -04:00
Arkadiusz Kozdra 627a144b83
Support access to constructs inside type parameters (#3702)
This changeset brings support for accesses like:

	class Cls#(type TYPE1);
	    TYPE1::some_method();
	endclass

It is done by delaying dot resolution on type parameters until they get
resolved by V3Param, and doing a more thorough reference skip.
2022-10-21 09:00:40 -04:00
Krzysztof Bieganski 5688d1a935
Internals: Add `V3UniqueNames` consistency assertion (#3692) 2022-10-21 07:05:38 -04:00
Wilson Snyder 79682e6072 Support empty generate_regions (#3695). [mpb27] 2022-10-20 22:04:50 -04:00
Wilson Snyder 7e1b92fa75 Add --get-supported to determine what features are in Verilator (#3688). 2022-10-20 21:42:30 -04:00
Arkadiusz Kozdra 0e4da3b0bf
Support virtual interfaces (#3654) 2022-10-20 06:31:00 -04:00
Krzysztof Bieganski e6add5e0b8
Fix trace activity with --timing (#3576) (#3678) (#3696) 2022-10-20 06:28:55 -04:00
Krzysztof Bieganski 22243d1e49
Support class type params without defaults (#3693) 2022-10-19 21:59:26 -04:00
Wilson Snyder e7068369fe Fix $display of fixed-width numbers (#3565). 2022-10-18 21:10:35 -04:00
Wilson Snyder b930d0731a Fix foreach and pre/post increment in functions (#3613). 2022-10-18 20:04:09 -04:00
Wilson Snyder 2723223884 Fix LSB error on --hierarchical submodules (#3539). 2022-10-18 17:29:51 -04:00
Topa Topino 46c5764383
Split UNUSED warning into genvar, param, and signal warnings (#3607) 2022-10-17 19:51:13 -04:00
Wilson Snyder 22ce36012e Add VERILATOR_TIMING define (#3684) 2022-10-17 18:18:56 -04:00
Geza Lore 5c65e0cfa1 Dfg: Fix incorrect folding of associative expressions with shared terms
Fixes #3679
2022-10-17 15:03:30 +01:00
Geza Lore 840e26b69a Fix incorrect return in DFG decomposition
Fixes #3676
2022-10-17 14:41:20 +01:00
Krzysztof Bieganski 5e79652922
Test tracing with `--timing` and `--main` (#3656)
Add a test for tracing with `--main` and `--timing`.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-17 12:36:37 +02:00
Wilson Snyder f3292a3651 Tests: Prove fixed (#2410) 2022-10-16 10:36:18 -04:00
Wilson Snyder 76ccd332a6 Internals: Remove DETECTARRAY, dead code. 2022-10-16 09:41:51 -04:00
Wilson Snyder 379a947379 Tests: Fix some internal code coverage holes 2022-10-15 13:59:07 -04:00
Wilson Snyder 916a3d9066 Fix --main --trace missing initial timestep (#3678). 2022-10-15 13:24:38 -04:00
Wilson Snyder e32ff0e1a6 Tests: Better mailbox and semaphore tests. 2022-10-15 10:37:24 -04:00
Wilson Snyder 5957156dee Tests: Fix bad result check. 2022-10-15 06:57:12 -04:00
Wilson Snyder 14f58ed6c7 Add error on real edge event control. 2022-10-15 06:21:34 -04:00
Arkadiusz Kozdra 038d57070b
Support standalone 'this' in classes (#3675) (#2594) (#3248) 2022-10-14 08:55:55 -04:00
Krzysztof Bieganski 8a347248f5
Use `AstDelay` nodes for intra-assignment delays (#3672)
Also fix messy implementation of net delays.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-14 09:35:26 +02:00
Krzysztof Bieganski caed086516
Move Postponed logic after the eval loop (#3673)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-13 21:04:43 +02:00
Krzysztof Bieganski 68927d4fd3
Make class ref typing stricter (#3671)
Prevents the possibility of assigning an integer to a class reference,
both at the SystemVerilog and the emitted C++ levels.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-13 14:33:15 +02:00
Krzysztof Bieganski ba052beccd
Make reference to increment temporary an rvalue (#3659)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-10 13:58:05 +02:00
Wilson Snyder 6f9c585452 Spelling (#3664) 2022-10-09 14:18:14 -04:00
Wilson Snyder 18c26b90af Fix --trace with --main/--binary (#3664) 2022-10-09 14:16:44 -04:00
Krzysztof Bieganski 97add4d57a
Fix null access on optimized-out fork statements (#3658)
`V3SchedTiming` currently assumes that if a fork still exists, it must
have statements within it (otherwise it would have been deleted by
`V3Timing`). However, in a case like this:
```
module t;
    reg a;
    initial fork a = 1; join
endmodule
```
the assignment in the fork is optimized out by `V3Dead` after
`V3Timing`. This leads to `V3SchedTiming` accessing fork's `stmtsp`
pointer, which at this point is null. This patch addresses that issue.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-10-06 15:38:59 +02:00
Geza Lore a83043d735 DfgPeephole: Rework folding of associative operations
Allow constant folding through adjacent nodes of all associative
operations, for example '((a & 2) & 3)' or '(3 & (2 & a))' can now be
folded into '(a & 2)' and '(2 & a)' respectively. Also improve speed of
making associative expression trees right leaning by using rotation of
the existing vertices whenever instead of allocation of new nodes.
2022-10-06 09:10:26 +01:00
Geza Lore 22fcd616aa DfgPeephole: Further restrict PUSH_REDUCTION_THROUGH_CONCAT
Only apply when there is guaranteed to be a subsequent constant folding
and elimination of some of the expression, otherwise this sometimes
interferes with the simplification of concatenations and harms overall
performance.
2022-10-06 09:10:26 +01:00
Geza Lore f87fe4c3b4 DfgPeephole: add constant folding for all integer types
Also added a testing only -fno-const-before-dfg option, as otherwise
V3Const eats up a lot of the simple inputs. A lot of the things V3Const
swallows in the simple cases can make it to DFG in complex cases, or DFG
itself can create them during optimization. In any case to save
complexity of testing DFG constant folding, we use this option to turn
off V3Const prior to the DFG passes in the relevant test.
2022-10-05 12:05:40 +01:00
Geza Lore f23f3ca907 Try to ensure DFG peephole patterns don't grow the graph
Some optimizations are only a net win if they help us remove a graph
node (or at least ensure they don't grow the graph), or yields otherwise
special logic, so try to apply them only in these cases.
2022-10-04 18:54:46 +01:00
Geza Lore 2a12b052f2 DFG: handle simple always blocks 2022-10-01 16:46:58 +01:00
Geza Lore 84b9502af4 DFG: Add more peephole patterns 2022-10-01 16:46:58 +01:00
Geza Lore 694bdbc130 DFG: Improve .dot dumps slightly 2022-10-01 16:46:58 +01:00
Wilson Snyder 880cac2fdd Merge branch 'master' into develop-v5 2022-10-01 11:24:55 -04:00
Marcel Chang 526e6b9fc7
Add --dump-tree-dot to enable dumping Ast Tree .dot files (#3636) 2022-10-01 11:05:33 -04:00
Kanad Kanhere 159cf0429c
Support linting for top module interfaces (#3635) 2022-10-01 10:48:37 -04:00
Ryszard Rozak 46b8dca360
Add handling of tristate select/extend (#3604) 2022-10-01 10:34:30 -04:00
Geza Lore c9d6344f2f DFG: Extract cyclic components separately
A lot of optimizations in DFG assume a DAG, but the more things are
representable, the more likely it is that a small cyclic sub-graph is
present in an otherwise very large graph that is mostly acyclic. In
order to avoid loosing optimization opportunities, we explicitly extract
the cyclic sub-graphs (which are the strongly connected components +
anything feeing them, up to variable boundaries) and treat them
separately. This enables optimization of the remaining input.
2022-09-30 09:51:10 +01:00
Wilson Snyder cd2a5771b8 Add --timing to --binary (#3625). 2022-09-28 19:02:23 -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
Wilson Snyder b92173bf3d Add --binary option as alias of --main --exe --build (#3625). 2022-09-28 09:04:33 -04:00
Wilson Snyder c6bce636ee Merge branch 'master' into develop-v5 2022-09-27 22:19:04 -04:00
Wilson Snyder 75a70bee6d Update to clang-format-14 on Ubuntu22.04 2022-09-27 21:47:45 -04:00
Wilson Snyder 1b1907af49 Tests: Rename some tests 2022-09-27 18:42:03 -04:00
Jake Merdich 1b18eee5dc
Tests: Fix CCache test not properly skipped (#3643)
If the skip condition happens, the rest still runs and it fails. Don't do that.
2022-09-27 09:11:49 -04:00
Ryszard Rozak 4931e48016
Support resolving assignments with equal strengths (#3637) 2022-09-26 21:21:37 -04:00
Geza Lore 47bce4157d
Introduce DFG based combinational logic optimizer (#3527)
Added a new data-flow graph (DFG) based combinational logic optimizer.
The capabilities of this covers a combination of V3Const and V3Gate, but
is also more capable of transforming combinational logic into simplified
forms and more.

This entail adding a new internal representation, `DfgGraph`, and
appropriate `astToDfg` and `dfgToAst` conversion functions. The graph
represents some of the combinational equations (~continuous assignments)
in a module, and for the duration of the DFG passes, it takes over the
role of AstModule. A bulk of the Dfg vertices represent expressions.
These vertex classes, and the corresponding conversions to/from AST are
mostly auto-generated by astgen, together with a DfgVVisitor that can be
used for dynamic dispatch based on vertex (operation) types.

The resulting combinational logic graph (a `DfgGraph`) is then optimized
in various ways. Currently we perform common sub-expression elimination,
variable inlining, and some specific peephole optimizations, but there
is scope for more optimizations in the future using the same
representation. The optimizer is run directly before and after inlining.
The pre inline pass can operate on smaller graphs and hence converges
faster, but still has a chance of substantially reducing the size of the
logic on some designs, making inlining both faster and less memory
intensive. The post inline pass can then optimize across the inlined
module boundaries. No optimization is performed across a module
boundary.

For debugging purposes, each peephole optimization can be disabled
individually via the -fno-dfg-peepnole-<OPT> option, where <OPT> is one
of the optimizations listed in V3DfgPeephole.h, for example
-fno-dfg-peephole-remove-not-not.

The peephole patterns currently implemented were mostly picked based on
the design that inspired this work, and on that design the optimizations
yields ~30% single threaded speedup, and ~50% speedup on 4 threads. As
you can imagine not having to haul around redundant combinational
networks in the rest of the compilation pipeline also helps with memory
consumption, and up to 30% peak memory usage of Verilator was observed
on the same design.

Gains on other arbitrary designs are smaller (and can be improved by
analyzing those designs). For example OpenTitan gains between 1-15%
speedup depending on build type.
2022-09-23 16:46:22 +01:00
Geza Lore ddb678cc5b Merge branch 'master' into develop-v5 2022-09-22 17:33:36 +01:00
Geza Lore 63c694f65f Streamline dump control options
- Rename `--dump-treei` option to `--dumpi-tree`, which itself is now a
  special case of `--dumpi-<tag>` where tag can be a magic word, or a
  filename
- Control dumping via static `dump*()` functions, analogous to `debug()`
- Make dumping independent of the value of `debug()` (so dumping always
  works even without the debug flag)
- Add separate `--dumpi-graph` for dumping V3Graphs, which is again a
  special case of `--dumpi-<tag>`
- Alias `--dump-<tag>` to `--dumpi-<tag> 3` as before
2022-09-22 17:24:41 +01:00
Geza Lore 72e7271a14 Merge branch 'master' into develop-v5 2022-09-21 12:19:00 +01:00
Geza Lore 0a8cfb8d2c Put dump file in TEST_OBJ_DIR 2022-09-21 11:35:03 +01:00
Wilson Snyder d162619bd3 Merge branch 'master' into develop-v5 2022-09-20 20:06:21 -04:00
Yu-Sheng Lin bba800f2d6
Fix calling trace() after open() segfault (#3610) (#3627) 2022-09-20 16:45:09 -04:00
Ryszard Rozak fe2a1e1749
Remove assignments with strengths weaker than strongest non-tristate RHS (#3629) 2022-09-19 04:54:20 -04:00
Wilson Snyder fc4ffd454e Rename --bin to --build-dep-bin. 2022-09-18 10:32:43 -04:00
Wilson Snyder 8dae4ad93a Tests: Rename to avoid dash. 2022-09-18 10:19:15 -04:00
Wilson Snyder 8da261f302 Tests: Rename to avoid dash. 2022-09-18 10:19:15 -04:00
Geza Lore af305bf280 Merge branch 'master' into develop-v5 2022-09-16 16:24:36 +01: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 0c70a0dcbf Remove redundant 'virtual' keywords from overridden methods
'virtual' is redundant when 'override' is present, so keep only
'override'.

Add t/t_dist_cppstyle.pl to check for this.
2022-09-16 15:19:38 +01:00
Kamil Rakoczy dbe1348b4c
Tests: Fix earlier commit, add build jobs to stats (#3623) (#3626) 2022-09-15 11:29:50 -04:00
Kamil Rakoczy da20da264b
Add --build-jobs, and rework arguments for -j (#3623) 2022-09-15 08:28:58 -04:00
Geza Lore 27031ed688 Merge branch 'master' into develop-v5 2022-09-15 10:28:35 +01:00
Wilson Snyder d85b909054 Internals: Use std:: for mem and str functions. 2022-09-14 21:10:19 -04:00
Wilson Snyder 75fd71d7e5 Add --main to generate main() C++ (previously was experimental only) (#3265). 2022-09-14 20:18:40 -04:00
Ryszard Rozak a3c58d7b70
Support IEEE constant signal strengths (#3601). 2022-09-14 07:39:27 -04:00
Wilson Snyder 81fe35ee2e Fix typedef'ed class conversion to boolean (#3616). 2022-09-12 18:03:56 -04:00
Geza Lore 08b6bdddf9 Update default --mod-prefix when --prefix is repeated
Fixes #3603
2022-09-12 17:25:09 +01:00
Wilson Snyder 752f425025 Tests: Process/Semaphore/Mailbox testing (all fail until supported) 2022-09-11 13:05:24 -04:00
Gustav Svensk 47262cd4ec
Fix arguments in non-static method call (#3547) (#3582) 2022-09-11 12:33:31 -04:00
Wilson Snyder 249feaae7c Tests: Remove lint-py, need ci package. 2022-09-07 22:59:32 -04:00
Wilson Snyder 5a1bcf9794 Tests: Add lint-py checker 2022-09-07 22:04:57 -04:00
Mladen Slijepcevic 1af046986d
Fix thread saftey in SystemC VL_ASSIGN_SBW/WSB (#3494) (#3513). 2022-09-05 18:42:12 -04:00
Wilson Snyder 1c9263a25b Commentary 2022-09-05 15:20:08 -04:00
Geza Lore fd6275a62b Merge branch 'master' into develop-v5 2022-09-05 17:03:43 +01:00
Krzysztof Bieganski a2e1b32a1c
Fix inlining of forks (#3594)
Before this change, some forked processes were being inlined in
`V3Timing` because they contained no `CAwait`s. This only works under
the assumption that no `CAwait`s will be added there later, which is not
true, as a function called by a forked process could be turned into a
coroutine later. The call would be wrapped in a new `CAwait`, but the
process itself would have already been inlined at this point.

This commit moves the inlining to `transformForks` in `V3SchedTiming`,
which is called at a point when all `CAwait`s are already in place.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-09-05 15:19:19 +01:00
Krzysztof Bieganski da7ad35577
Fix fork debug output (#3593)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-09-05 11:27:24 +01:00
Geza Lore d42a2d6494 Fix V3Gate crash on circular logic
The recent patch to defer substitutions on V3Gate crashes on circular
logic that has cycle length >= 3 with all inlineable signals (cycle
length 2 is detected correctly and is not inlined). Fix by stopping
recursion at the loop-back edge.

Fixes #3543
2022-09-02 19:58:58 +01:00
Wilson Snyder 849bb5590a Merge branch 'master' into develop-v5 2022-08-31 19:51:07 -04:00
Wilson Snyder 51daa64e9a Fix --hierarchical with order-based pin connections (#3585). 2022-08-31 18:12:21 -04:00
Geza Lore 2ecda74471 Merge branch 'master' into develop-v5 2022-08-31 10:45:18 +01:00
Aleksander Kiryk 2136afde6b
Support negated properties (#3572) 2022-08-30 06:33:42 -04:00
Wilson Snyder 819e8741cc Merge branch 'master' into develop-v5 2022-08-30 00:20:21 -04:00
Wilson Snyder 6a5f77b278 Internals: Cleanup some string/model constructors. No functional change. 2022-08-29 23:50:32 -04:00
Wilson Snyder c335aad25f Fix --hierarchical with order-based pin connections (#3583). 2022-08-29 22:49:19 -04:00
Aleksander Kiryk 24ec84851a
Support $sampled (#3569) 2022-08-29 08:39:41 -04:00
Arkadiusz Kozdra 0a3a15a66e
Support class parameters (#2231) (#3541) 2022-08-28 10:24:55 -04:00
Wilson Snyder 2358ced061 Rename tracing rolloverSize and add test (#3570). 2022-08-28 08:25:02 -04:00
Krzysztof Bieganski 2af5304884
Fix tracing of slow coroutines (#3576 part) (#3579) 2022-08-26 05:11:44 -05:00
Varun Koyyalagunta 5869fdf7f6
Fix $dump systemtask with --output-split-cfuncs (#3495) (#3497) 2022-08-25 18:29:11 -05:00
Krzysztof Bieganski 39af5d020e
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.

Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).

The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.

There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
  with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
  them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
  resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
  blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
  for suspending a stack of coroutines (normally, C++ coroutines are
  stackless).

There is a new visitor in `V3Timing.cpp` which:
  * scales delays according to the timescale,
  * simplifies intra-assignment timing controls and net delays into
    regular timing controls and assignments,
  * simplifies wait statements into loops with event controls,
  * marks processes and tasks with timing controls in them as
    suspendable,
  * creates delay, trigger scheduler, and fork sync variables,
  * transforms timing controls and fork joins into C++ awaits

There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.

There is also a function that transforms forked processes into separate
functions.

See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 13:26:32 +01:00
Wilson Snyder ebb37b0156 Merge branch 'master' into develop-v5 2022-08-20 14:02:09 -04:00
Wilson Snyder 90dc04cf93 Add --future0 and --future1 options. 2022-08-20 14:01:13 -04:00
Krzysztof Bieganski 10cf492946
Add support for expressions in event controls (#3550)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-19 20:18:38 +02:00
Geza Lore 1404319b28 Merge branch 'master' into develop-v5 2022-08-19 13:39:44 +01:00
Ryszard Rozak db5fdfb0ee
Fix === with some tristate constants (#3551). 2022-08-18 07:03:05 -04:00
Wilson Snyder 93272c13fd Tests: Confirm fixed (#181) 2022-08-15 22:17:36 -04:00
Wilson Snyder 43abaeb055 Tests: Confirm fixed (#485) 2022-08-15 22:17:17 -04:00
Wilson Snyder 18b9e661c9 Tests: Confirm fixed (#446) 2022-08-15 22:17:09 -04:00
Wilson Snyder f435d96241 Fix case statement comparing string literal (#3544). 2022-08-15 21:56:09 -04:00
Mostafa Gamal df5f95a5bd
Fix nested default assignment for struct pattern (#3511) (#3524) 2022-08-12 06:55:07 -04:00
Drew Ranck b0c475205b
Fix void-cast queue pop_front or pop_back (#3542) (#3364)
Fix compile error for queue method usage, if it is the
first statement in a block of code, and the return
value is not used. Example:

>  if (foo)
>    void'(bar.pop_front());
2022-08-12 06:51:25 -04:00
Wilson Snyder cbe1b8e266 Fix segfault exporting non-existant package (#3535). 2022-08-08 17:53:50 -04:00
Yutetsu TAKATSUKASA d20f22beb1
Fix tristate logic when reading inout port in a module #3399 (#3523)
* Tests: Add a test to reproduce #3399

* Fix #3399. When reading an inout port in a module, it should refer the
original inout port, not the generated MODTEMP.
2022-08-07 21:12:57 +09:00
Wilson Snyder f4fe10844b Tests: Fix t_flag_help.pl (#3532). 2022-08-07 04:57:59 -04:00
Geza Lore c266739e9f Merge branch 'master' into develop-v5 2022-08-05 12:17:57 +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
Geza Lore ad2fbfe62d Merge branch 'master' into develop-v5 2022-07-29 12:04:24 +01:00
Yutetsu TAKATSUKASA 1f9323d086
Set correct dtype in replaceShiftSame() (#3520)
* Tests: Add a test to reproduce bug3399

* Fix3399. Set the correct dtype in replaceShiftSame().

* Tests: update stats.

* Update Changes
2022-07-29 07:05:04 +09:00
Geza Lore 574dbfded1 V3MergeCond: Fix incorrect merge of assignments to the condition 2022-07-28 15:50:02 +01:00
Geza Lore a5ddd10e31 Tests: compare VCD files both ways
vcddiff is a bit broken, and sometimes 'vcddiff a b' fails while the
files are indeed equivalent. There is a chance however that 'vcddif b a'
will succeed in this case, so compare trace files both ways when
checking test results and claim success if vcddiff succeeds in at least
one direction.
2022-07-27 10:48:02 +01:00
github action e871cd8a44 Apply 'make format' 2022-07-25 21:47:29 +00:00
Mostafa Gamal 7b431b37c7
Fix struct pattern assignment (#2328) (#3517). 2022-07-25 17:46:22 -04:00
Gustav Svensk eeef5ab4de
Fix sformat string incorrectly cleared (#3515) (#3519). 2022-07-25 17:36:34 +02:00
Yutetsu TAKATSUKASA 60eab3eb8c
Fix wrong result of bit op tree optimization #3509 (#3516)
* Tests: Add a test to reproduce #3509

* Tests: Compile without tautological-compare check because bit op tree optimization is disabled in the test.

* Internals: Dedup code. No functional change is intended.

* Fix #3509.

"2'b10 == (2'b11 & {1'b0, val[0]})"  and "2'b10 != (2'b11 & {1'b0, val[0]})" were
wrongly optimized to "!val[0]" and "val[0]" respectively.
Now properly optimize them to 1'b0 and 1'b1.

* Commentary

* Commentary: Update Changes
2022-07-24 19:54:37 +09:00
Geza Lore 31abe537a0 Fix DPI export trigger sensitivity in 'nba'
Fixes #3508
2022-07-21 17:43:03 +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
Arkadiusz Kozdra 542e324869
Wildcard index type support for associative arrays (#3501).
Associative arrays that specify a wildcard index type may be indexed by
integral expressions of any size, with leading zeros removed
automatically.  A natural representation for such expressions is a
string, especially that the standard explicitly specifies automatic
casts from string indices to bit vectors of equivalent size.
The automatic cast part is done implicitly by the existing type system.

A simpler way to just make this work would be to convert wildcard index
type to a string type directly in the parser code, but several new AST
classes are needed to make sure illegal method calls are detected.
The verilated data structure implementation is reused, because there is
no need for differentiating the behavior on C++ side.
2022-07-20 15:01:36 +02: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 c28bf9ce24 Fix change detection over unpacked arrays. 2022-07-18 12:25:22 +01:00
Geza Lore 5a1f1796d7 Fix t/t_public_{clk,src}.pl after merge of master 2022-07-15 16:48:22 +01:00
Geza Lore ffc95fcf0e Merge branch 'master' into develop-v5 2022-07-15 16:48:14 +01:00
Todd Strader b0e796ca83
Public combo propagation issues (#2905) 2022-07-15 11:44:32 -04:00
Geza Lore 6a7bda6910 Correctly schedule combinational logic driven from DPI exports.
Fixes #3429.
2022-07-14 15:35:49 +01:00
Geza Lore c9ac9a75a6 Merge branch 'master' into develop-v5 2022-07-12 17:29:45 +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 d8ea989eda Tests/examples: Remove some legacy Verilator:: calls. 2022-07-09 09:50:50 -04:00
Wilson Snyder 5f3316d3dc * Fix empty string arguments to display (#3484). 2022-07-09 08:30:57 -04:00
Wilson Snyder a4fddb3fbe Fix table misoptimizing away display (#3488). 2022-07-09 07:55:46 -04:00
Yutetsu TAKATSUKASA 9f37cef1bb
Fix #3470 of incorrect bit op tree optimization (#3476)
* Tests: Add a test to reproduce #3470

* Update LSB during return path of traversal. No functional change is intended.

* Introduce LeafInfo::m_msb

* Update LeafInfo::m_msb when visitin AstCCast

* Internals: Add comment, reorder. No functional change is intended.

* Delete explicit from copy constructor to fix build error.

* Update Changes

* Internals: Remove unused parameter. No functional change is intended.

* Tests: Add explanation to t_const_opt.
2022-07-06 08:33:37 +09:00
Geza Lore 3aa8624658 Set 'threads' in tests via parameter to compile
This is in preparation to #3454.
2022-07-05 12:33:41 +01:00
Wilson Snyder b25b798dbe Merge branch 'master' into develop-v5 2022-07-04 13:20:03 -04:00
Geza Lore 383e384739 Remove always true cfg_with_threaded from test driver 2022-06-27 15:23:32 +01:00
Wilson Snyder e7ca4a69e3 Merge branch 'master' into develop-v5 2022-06-19 15:22:09 -04:00
Todd Strader 47b650d821
Fix public unpacked input ports (#3465) 2022-06-15 07:41:59 -04:00
Geza Lore 0c2c097377 Add -fno-merge-cond-motion option
This disables code motion during V3MergeCond, for debugging.
2022-06-13 14:16:11 +01:00
Kamil Rakoczy 660d1059b0
With --no-decoration, remove output whitespace (#3460)
Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2022-06-10 07:26:33 -04:00
Wilson Snyder e7dc2de14b Fix BLKANDNBLK on $readmem/$writemem (#3379). 2022-06-04 12:43:18 -04:00
Wilson Snyder e2525d8440 Tests: Fix racy tests for develop-v5. 2022-06-04 12:22:11 -04:00
Wilson Snyder 6769106881 Merge branch 'master' into develop-v5 2022-06-04 12:17:29 -04:00
Wilson Snyder 32100a3c91 Tests: Fix racy tests for develop-v5. 2022-06-04 12:17:04 -04:00
Wilson Snyder 0f324c8309 Merge branch 'master' into develop-v5 2022-06-04 11:59:49 -04:00
Wilson Snyder 67f7432dd7 Commentary (#3436). 2022-06-04 08:37:42 -04:00
Wilson Snyder 59dc2853e3 Support concat assignment to packed array (#3446). 2022-06-03 21:32:13 -04:00
Wilson Snyder ada58465b2 Add -f<optimization> options to replace -O<letter> options (#3436). 2022-06-03 20:43:16 -04:00
Wilson Snyder 173f57c636 Changed --no-merge-const-pool to -fno-merge-const-pool (#3436). 2022-06-03 19:41:59 -04:00
Yutetsu TAKATSUKASA d64f979f99
Fix BitOpTree optimization to consider polarity of frozen node (#3445) (#3459)
* Tests: add a test to another failing case of #3445

* Consider polarity as lsb in BitOpTree optimization.
2022-06-01 09:26:16 +09:00
Yutetsu TAKATSUKASA 26b7452178
Fix #3445 of BitOpTreeOpt (#3453)
* Tests: Check BitOpTree statistics in t_const_opt.

* Tests: Add a test to reproduce #3445

* Fix #3445. Don't forget LSB of frozen node in BitOpTreeOpt.

* Apply suggestions from code review

Co-authored-by: Geza Lore <gezalore@gmail.com>
2022-05-30 19:33:06 +09: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 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
Geza Lore 0722f47539
Improve V3MergeCond by reordering statements (#3125)
V3MergeCond merges consecutive conditional `_ = cond ? _ : _` and
`if (cond) ...` statements. This patch adds an analysis and ordering
phase that moves statements with identical conditions closer to each
other, in order to enable more merging opportunities. This in turn
eliminates a lot of repeated conditionals which reduced dynamic branch
count and branch misprediction rate. Observed 6.5% improvement on
multi-threaded large designs, at the cost of less than 2% increase in
Verilation speed.
2022-05-27 16:57:51 +01:00
Krzysztof Bieganski d7a75dc026 Merge branch 'master' into develop-v5 2022-05-25 11:06:38 +02:00
Wilson Snyder 530817191e Support non-ANSI interface port declarations (#3439). 2022-05-25 00:50:50 -04:00
Geza Lore 1282548a1c Only consider definitions in t_flag_csplit 2022-05-20 18:02:00 +01:00
Krzysztof Bieganski 9edccfdffa
Initial support for intra-assignment timing controls, net delays (#3427)
This is a pre-PR to #3363.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-05-17 19:19:44 +01:00
Geza Lore 1a056f6db9 Fix invalid conditional merging when starting at 'c = c ? a : b'
Fixes #3409.
2022-05-17 18:36:40 +01:00
Krzysztof Bieganski 0a91ddf38a
Tests: Better grep check in t_foreach (#3435)
This is a pre-PR to #3363.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-05-17 09:20:59 -04:00
Krzysztof Bieganski 67bb2c640e
Tests: Rename t_timing_clkgen to t_timing_clkgen1 (#3430)
This is a pre-PR to #3363, which will introduce more clock gen tests.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-05-17 09:19:51 -04:00
Geza Lore 282887d9c6 Fix code coverage holes
Fixes #3422
2022-05-16 21:22:21 +01:00
Krzysztof Bieganski ecaa07a72a
Rename AstTimingControl to AstEventControl (#3425)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-05-16 20:44:41 +01: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 3c4131d45d Fix 'with' operator with type casting (#3387). 2022-05-15 09:53:48 -04:00
Wilson Snyder ae8d8ee1ac Fix crash with misuse of display. 2022-05-15 09:29:45 -04:00
Geza Lore 766fb56651 Merge branch 'master' into develop-v5 2022-05-14 10:30:45 +01:00
Wilson Snyder 38438b3373 Internals: Cleanup some defaults. No functional change. 2022-05-12 23:30:39 -04:00
Wilson Snyder 71dedccbbe Support compile time trace signal selection with tracing_on/off (#3323). 2022-05-12 22:28:08 -04:00
Geza Lore bec4610e12 Merge branch 'master' into develop-v5 2022-05-08 15:50:50 +01:00
Kamil Rakoczy 9378259779
Fix UNOPTFLAT warning from initial static var (#3406)
Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2022-05-06 10:24:03 +02:00
Wilson Snyder 3d762282b9 Fix hang with large case statement optimization (#3405). 2022-05-05 07:02:52 -04:00
Geza Lore 2ad0bcbba9 Merge branch 'master' into develop-v5 2022-05-01 16:49:42 +01:00
Wilson Snyder 915ceb2d04 Tests: Untabify tests. No functional change. 2022-05-01 10:10:00 -04:00
Geza Lore 88bb7cdca6 Merge branch 'master' into develop-v5 2022-04-29 17:14:11 +01:00
Geza Lore 49c90ecbce Issue consistent INITIALDLY/COMBDLY/BLKSEQ warnings
Some cases of warnings about the use of blocking and non-blocking
assignments in combinational vs sequential processes were suppressed in
a way that is inconsistent with the *actual* current execution model of
Verilator. Turning these back on to, well, warn the user that these might
cause unexpected results. V5 will clean these up, but until then err on
the side of caution.

Fixes #864.
2022-04-29 17:05:44 +01:00
Kamil Rakoczy 5de1c619c8
Fix foreach segmentation fault (#3400). 2022-04-28 06:11:31 -04:00
Yoda Lee a6d678d41d
Fix hang in generate symbol references (#3391) (#3398) 2022-04-27 18:40:36 -04:00
Geza Lore 46de9460a6 Merge branch 'master' into develop-v5 2022-04-23 15:38:30 +01:00
Geza Lore 62337bb6ac Future proofing some tests. No functional change. 2022-04-23 15:12:52 +01:00
Geza Lore 0b74e9b354 Ensure topological ordering of module list.
At the end of V3Param, fix up the module list to be topologically
sorted. We need to do this at the end as a later instantiation of a
recursive module might instantiate an earlier specialization, which we
cannot know until we processed everything. The rest of the compiler
depends on the module list being topologically sorted.

Fixes #3393
2022-04-23 13:25:27 +01:00
Geza Lore 5f0e1fae7f Simplify and clarify reporting of enclosing instance
Rename AstNodeModule::hierName -> someInstanceName and explain that this
is only used for user messages.

Rename AstNode::locationStr -> instanceStr and simplify implementation.
In particular, do not report an instance if we can't find a reasonable
guess.
2022-04-22 23:38:23 +01:00
Wilson Snyder 7bfc1a00a7 Fix tracing interfaces inside interfaces (#3309). 2022-04-14 09:14:44 -04:00
Wilson Snyder 92f64de115 Add FIXMEV5 comments 2022-04-13 22:18:59 -04:00
Geza Lore c79ea88576 Fix incorrect localization when encountering non-leaf functions.
Fixes #3286.
2022-04-09 20:30:39 +01: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 960d0de361 Tests: Cleanup vluint_t/vlsint_t in tests, part of (#3255) 2022-03-27 15:03:25 -04:00
Wilson Snyder 31ce1fdfd3 Tests: Check legacy part of (#3255) 2022-03-27 14:50:49 -04:00
Wilson Snyder 9821381059 Tests: new t_lint_latch_5 test (#2997). 2022-03-27 14:42:36 -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 38b2845e2a Tests: Fix whitespace test and resulting fallout. 2022-03-26 15:41:32 -04:00
Drew Ranck 90fb2e5487
Fix ++/-- tree fix in case statements (#3346) (#3349). 2022-03-12 11:24:32 -05: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
Yutetsu TAKATSUKASA e29132377e
Fix driver.pl when expected value is 0 (#3339)
* Tests: use defined() to accept $expvalue==0

* Tests: Update expected stats of t_cast_huge in --vltmt mode
2022-03-06 14:43:28 +09:00
Yutetsu TAKATSUKASA 999751c422
Count non-empty always blocks in V3Split (#3337)
"Optimizations, Split always" in stats now means the number of newly added always.
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
2022-03-06 12:56:34 +09:00
Wilson Snyder 22656d6fdd Fix Vdeeptemp error with --threads and --compiler clang (#3338). 2022-03-05 20:17:36 -05:00
Wilson Snyder ef0c5fd772 Fix unnamedblk error on foreach (#3321). 2022-03-05 17:05:22 -05:00
Wilson Snyder 90c61c79d6 Fix unnamedblk error on foreach (#3321). 2022-03-05 17:04:52 -05:00
Wilson Snyder 4ba3bff87f Fix class stringification on wide arrays (#3312). 2022-03-05 16:32:30 -05:00
Wilson Snyder c3dd6f5344 Fix public function arguments that are arrayed (#3316). 2022-03-05 16:19:53 -05:00
Wilson Snyder 321880f5a6 Add trace dumpvars() call for selective runtime tracing (#3322). 2022-03-05 15:44:32 -05:00
Geza Lore 3737d209f6 Keep recursive module list topologically (#3324).
Fixes (#3324).
2022-03-05 15:04:13 +00:00
Todd Strader 29c4b0a141
Fix cast to array types (#3333) 2022-03-03 07:48:04 -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
Geza Lore decfa6bd7a V3Order: Use unique ordinals per function name
This helps diffing generated code after reordering output, otherwise no
functional change.
2022-02-16 18:36:40 +00:00
github action 77fe7c426e Apply 'make format' 2022-02-16 05:11:38 +00:00
Raynard Qiao 331c2244fc
Fixed signed number operation (#3294) (#3308) 2022-02-16 00:10:34 -05:00
Wilson Snyder 77e68acf54 Suppress WIDTH warning on negate using carry bit (#2395). [Peter Monsson] 2022-02-13 15:27:31 -05:00
Wilson Snyder 7a355d448a Fix skipping public enum values with four-state values (#3303). 2022-02-10 19:27:28 -05:00
Wilson Snyder 434c3c3ef3 Removed the deprecated "fl" attribute in XML output; use "loc" attribute instead. 2022-01-17 16:22:07 -05:00
Wilson Snyder 21e05c43dd Removed the deprecated lint_off flag -msg; use -rule instead. 2022-01-17 16:04:06 -05:00
Wilson Snyder 48a098b041 Tests: Fix some force/release coverage holes. 2022-01-16 16:53:06 -05:00
Geza Lore f8c0169e82 Implement 'forceable' attribute
Using the 'forceable' directive in a configuration file, or the /*
verilator forceable */ metacomment on a variable declaration will
generate additional public signals that allow the specified signals to
be forced/released from the C++ code.
2022-01-16 15:31:37 +00:00
Geza Lore 539c9d4c63 Merge alternate 'force'/'release' implementation
- Add more tests, including for tracing.
- Apply some cleaner, more generic abstractions in the implementation.
- Use clearer AstRelease which is not an assignment.
2022-01-16 15:31:37 +00:00
Geza Lore b4d8220cbb
Deprecate --cdc (#3279) 2022-01-16 15:30:44 +00:00
Wilson Snyder 5eded789aa Fix test 2022-01-09 19:29:30 -05:00
Wilson Snyder 441ecfedc9 Internals: Make all .h files compilable 2022-01-08 11:18:23 -05:00
Yutetsu TAKATSUKASA 4e5f30858b
Fix #3258 of internal error with inout port (#3268)
* Tests: Modify t_tri_inout to reproduce #3258

* Set direction of __en accorting to its main signal direction

* Update Changes
2022-01-05 08:37:20 +09:00
Wilson Snyder b989ac6db5 Internals: Support linking recursive function calls (but not later stages) 2022-01-03 18:50:41 -05:00
Wilson Snyder 4d1f4bbf49 Backout last commit; is unstable. 2022-01-03 13:04:47 -05:00
Wilson Snyder e9ad665d32 Internals: Support linking recursive function calls (but not later stages) 2022-01-03 12:25:50 -05:00
Wilson Snyder 78052f87bd Tests: Update recursive function tests 2022-01-03 12:02:53 -05:00
Wilson Snyder 2e2b82c052 Support class static members (#2233). 2022-01-02 15:09:07 -05:00
Wilson Snyder 028737cde8 Tests: Add unsupported t_class_static_member tests. 2022-01-02 09:43:26 -05:00
Wilson Snyder bf972963f4 Misc internal and test work towards enum type checks (#726). 2022-01-01 22:16:58 -05:00
Wilson Snyder e4c5eb5e69 Fix spurious UNUSED by ignoring inout pin connections (#3242). 2022-01-01 18:37:34 -05:00
Wilson Snyder 2e8cc22c54 Copyright year update. 2022-01-01 18:34:15 -05:00
Wilson Snyder 655910d486 Fix associative array first method as statement (#3228). 2022-01-01 17:10:26 -05:00
Wilson Snyder d679d50eca Fix $random not updating seed (#3238). [Julie Schwartz] 2022-01-01 16:43:06 -05:00
Wilson Snyder 65de118e51 Internals: Factor common V3Width function. 2022-01-01 16:15:53 -05:00
Wilson Snyder 4cd56b1fb9 Use C++11 standard types for MacOS portability (#3254) (#3257). 2022-01-01 16:04:20 -05:00