Commit Graph

3954 Commits

Author SHA1 Message Date
Wilson Snyder
e004ea7ae2 Revert (#3835) (#3836) 2023-01-03 08:25:30 -05:00
Andrew Nolte
6159a7dd8d
Fix VPI generate scope array naming (#3835) (#3836) 2023-01-03 07:38:55 -05:00
Kamil Rakoczy
be65030d61
Fix cmake upper-case and missing include directory (#3838) 2023-01-02 06:25:50 -05:00
Geza Lore
a168d593eb Fix some front-end memory leaks 2023-01-01 15:31:29 +00:00
Geza Lore
6ab47f799b Actually delete the netlist when VL_LEAK_CHECKS 2023-01-01 15:31:29 +00:00
Geza Lore
fd52f7f479 Fix memory leak in V3Sched.
Fixes #3834.
2023-01-01 15:31:29 +00: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
9255707dd4 Fix detecting multiple pattern defaults 2022-12-29 20:16:30 -05:00
Wilson Snyder
24198ef0ed Internal line coverage fix 2022-12-29 14:18:45 -05:00
Wilson Snyder
fde380868a Fix misc memory leaks 2022-12-29 13:59:24 -05:00
Wilson Snyder
be42dc906c Fix GDB watchedit 2022-12-29 13:58:19 -05:00
Wilson Snyder
bad4110b03 For --stat, add total elapsed time 2022-12-29 11:48:19 -05:00
github action
f6b101d98b Apply 'make format' 2022-12-26 09:31:25 +00:00
Larry Doolittle
80a144797d
Commentary: Fix more spelling (#3828) 2022-12-26 10:30:41 +01:00
Wilson Snyder
45abcb6107 Internals: Some V3LinkInc cleanups. No functional change. 2022-12-23 16:17:08 -05:00
Wilson Snyder
d5a18c99fe fungetc has lvalue character argument. 2022-12-23 13:00:34 -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
Wilson Snyder
afd7c2ae25 Internals: Use visitor to refactor Ctors, prep for (#3815) 2022-12-23 10:12:11 -05:00
Krzysztof Bieganski
bb44d4e4f2
Support clocking blocks (#3674) 2022-12-23 07:34:49 -05:00
Wilson Snyder
d64971ba35 Fix some MSVC warnings. 2022-12-22 12:19:09 -05:00
Kritik Bhimani
65daf99bf4
Support Windows-native builds using cmake (#3814) 2022-12-20 19:42:27 -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
51de2c9194 Remove reader task code which was non-functional (#3360) 2022-12-17 16:48:08 -05:00
Wilson Snyder
a554dd7c8d Optimize expansion of extend operators - fix earlier commit. 2022-12-15 22:49:49 -05:00
Wilson Snyder
7d93952a0d Fix make intermediate (#3748) 2022-12-15 19:53:51 -05:00
Wilson Snyder
1ddb2dd5e7 Fix make intermediate (#3748) 2022-12-15 19:26:54 -05:00
Wilson Snyder
2770ddf071 Optimize expansion of extend operators. 2022-12-15 07:38:53 -05:00
github action
fcd1306ef3 Apply 'make format' 2022-12-14 12:08:19 +00:00
Kritik Bhimani
9d2f1c607a
Fix MSVCC issues (#3813) 2022-12-14 07:07:25 -05:00
github action
d192372c7e Apply 'make format' 2022-12-12 23:46:23 +00:00
Kritik Bhimani
7b073fec7d
Fix MSVC++ portability issues (#3812) 2022-12-12 18:45:32 -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
0a3c90e517 Fix forked processes compiled as slow/cold (#3766) 2022-12-11 14:44:18 -05:00
Wilson Snyder
afc66f6a85 Fix make jobserver with submakes (#3758). 2022-12-11 14:19:40 -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
86e3c02339 Internal: Remove stale make rule (#3811). 2022-12-11 09:48:25 -05:00
Wilson Snyder
a0e7930036 docs: Fix spelling 2022-12-09 22:39:41 -05:00
Krzysztof Bieganski
4b6e15d0eb
Fix non-blocking assignments in forks (#3781) (#3800) 2022-12-06 07:16:07 -05:00
Krzysztof Bieganski
87bb32fde1
Fix forks without any delayed statements (#3792) (#3801) 2022-12-06 07:14:29 -05:00
Wilson Snyder
ea1b141d13 Support probablity distribution functions. 2022-12-04 17:30:51 -05:00
Wilson Snyder
84c7368621 Rename std.sv and add to install. 2022-12-03 11:31:26 -05:00
Larry Doolittle
f27cf4c804
Commentary: Fix spelling in C++ comments (#3797) (#3798) 2022-12-02 18:46:38 -05:00
Wilson Snyder
87135d0b2d Internals: Fix missing const. No functional change. 2022-12-01 18:47:09 -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
31d8b4cb8e Internals: Rename AstNodeSystem*D etc. No functional change intended. 2022-11-30 22:08:57 -05: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
Wilson Snyder
8ff607f679 Deprecate verilated_fst_sc.cpp and verilated_vcd_sc.cpp (#3507) 2022-11-29 22:17:50 -05:00
Wilson Snyder
b51bb4d0e7 Internal: Add node objects to UASSERT (#3786) 2022-11-29 18:34:44 -05:00
Wilson Snyder
f0a7abcef8 Internals: Use named accessors instead of op1p etc. No functional change intended. 2022-11-29 18:17:50 -05:00
Yinan Xu
ff9596bb23
Fix missing user objects in --lib-create mode (#3780) (#3784) 2022-11-29 09:02:39 -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
2c7f1ef40f Internals: Cleanup debug dumps so can grep-out leading-dashed lines 2022-11-27 08:31:22 -05:00
Wilson Snyder
5f583b0680 Fix clang warning from previous commits. 2022-11-27 06:27:51 -05:00
Wilson Snyder
fa4270b551 bisonpre: Commentary 2022-11-27 06:18:58 -05:00
Wilson Snyder
d8071819fc Fix unquoted name in dtype errors. 2022-11-27 05:59:40 -05:00
Wilson Snyder
833780fac1 Internal: cppcheck fixes. No functional change intended. 2022-11-27 05:52: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
Wilson Snyder
e97e6c2213 Fix V3Tristate warning (#3773) 2022-11-22 17:46:58 -05:00
Geza Lore
508e937164 Fix tautological predicate in V3DfgPeephole
Fixes #3771
2022-11-22 15:05:34 +00: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
66d85b3381 Internals: Fix cppcheck warnings. No functional change intended. 2022-11-21 21:40:49 -05:00
Wilson Snyder
73d6de4471 Internals: Fix constructor style. 2022-11-21 20:41:32 -05:00
Wilson Snyder
0af02563ca Internals: Fix verilog.y style 2022-11-21 20:22:13 -05:00
Wilson Snyder
b82ce5743b Internals: Fix verilog.y style 2022-11-21 08:30:40 -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
Wilson Snyder
2eed4452ad Internals: Fix constructor style. 2022-11-20 20:13:55 -05:00
Wilson Snyder
f44cd9cd48 Internals: Fix constructor style. 2022-11-20 17:40:38 -05:00
Wilson Snyder
25f970eac2 Internals: Fix constructor style. 2022-11-20 15:06:49 -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
352d0b4582 Internals: Fix constructor style. 2022-11-20 13:11:01 -05:00
github action
a60e273c29 Apply 'make format' 2022-11-20 15:26:23 +00:00
Jiacheng Qian
47253450a4
Fix to escape VERILATOR_ROOT file paths (#3764) (#3765) 2022-11-20 10:25:41 -05:00
Wilson Snyder
aacb38b776 Support assignment expressions. 2022-11-19 15:23:37 -05:00
Wilson Snyder
21d80cdfa1 Internals: Fix constructor style. 2022-11-19 14:45:38 -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
f266b02bc7 Internals: Improve dtype small dump. 2022-11-19 13:23:28 -05:00
Wilson Snyder
de9c92fd14 Internals: Add missing const. No functional change. 2022-11-19 10:48:46 -05:00
Wilson Snyder
0322e9da7e Fix randcase inside function. 2022-11-18 21:30:34 -05:00
Wilson Snyder
b2d92b7c25 Allow ENCAPSULATED and ENUMVALUE to be disabled 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
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
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
e6da59eecd Internals: Mark some VL_PURE functions. No functional change. 2022-11-15 09:18:47 -05:00
Wilson Snyder
c6ecd60993 Support pre_randomize and post_randomize. 2022-11-13 11:59:40 -05:00
Wilson Snyder
ee26dddfa1 Internals: Fix constructor style. 2022-11-13 11:23:57 -05:00
github action
d1658b9e82 Apply 'make format' 2022-11-13 14:27:37 +00:00
Wilson Snyder
818347f99b Internals: Fix some unnecessary member paddings. No functional change intended. 2022-11-13 09:26:46 -05:00
Kritik Bhimani
201419c646
Fix MSVC compiler errors (#3742) (#3746) 2022-11-13 08:35:06 -05:00
Wilson Snyder
d25834e57b Add ENUMVALUE warning when value misused for enum (#726). 2022-11-12 20:11:05 -05:00
Wilson Snyder
4f50073feb Internals: Fix constructor style. 2022-11-12 19:51:03 -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
github action
8291d8bcc1 Apply 'make format' 2022-11-12 17:10:41 +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
6736e92cdb Internals: Fix some ugly line breaks. No functional change. 2022-11-11 22:33:17 -05:00
Wilson Snyder
a427860825 Support randcase. 2022-11-11 21:53:05 -05:00
William D. Jones
41d2ebe288
Fix CONTEXT compile error on mingw64 (#3741). 2022-11-11 21:43:10 -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
0c75d4eaca Internals: Fix constructor style. 2022-11-10 22:58:27 -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
2a3eabff73 Various Dfg performance improvements 2022-11-06 15:54:51 +00:00
Geza Lore
454efbe3fc Dfg: Use a worklist driven algorithm for unused vertex removal
This improves verilation speed slightly.
2022-11-06 14:13:42 +00: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
Wilson Snyder
cf4c00e3b4 Internals: if assertion should be VL_UNLIKELY 2022-11-02 20:11:25 -04: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
Geza Lore
99791ac8b3 Reduce verbosity of DFG debug 2022-10-28 16:35:53 +01: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
Geza Lore
ef2776034e Adjust instruction count estimates for AstCMethodHard
The cost of an AstCMethodHard right now is generally unknown. However,
VlTriggerVec::at is used a lot in conditions, so we make an effort
to estimate this correctly via 2 changes:
- In general when an AstVarRef appears as the target of an
  AstCMethodHard, we cost it as a simple address computation (an add)
- Check for VlTriggerVec::at explicitly when costing AstCMethodHard,
  which is essentially a load.

This can have a significant effect when there are a lot of unique
triggers in the design.
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
Geza Lore
65290afe0a Fix VString::endsWith when suffix is longer than input string. 2022-10-27 18:38:44 +01:00
Wilson Snyder
3487701b04 Tests: Cover some previously uncovered warnings 2022-10-22 16:03:42 -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
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
203993b018 Internals: Fix constructor style. 2022-10-21 19:03:40 -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
Jiuyang Liu
2e4f5c863f
Fix VPI inline module naming mismatch (#3690) (#3694) 2022-10-21 13:04:42 -04:00
HungMingWu
196f3292d5 Improve V3Ast function usage ergonomics (#3650)
Signed-off-by: HungMingWu <u9089000@gmail.com>
2022-10-21 14:12:12 +01: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
Geza Lore
8b0d71994d DFG: don't try to call DfgVertex::width() on arrays
In DFG DfgVertex::width() is only defined for vertices representing
packed values, which DfgVertex::hash() used to violate. The only
non-packed values at the moment are DfgVarArray, which is a
DfgVertexVar, which are handled specially anyway, so this is easy to
fix.

Fixes #3682
2022-10-21 10:57:13 +01: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
Geza Lore
7b07cf912e Delete trigger dump when --protect-ids is used
In order to not leak signal names with --protect-ids, we simply make the
trigger dump function empty (this is a debug only construct).

Partial fix for #3689
2022-10-20 15:44:51 +01:00
Geza Lore
6a3ec17887 DFG: Do not inline SystemC variables
The emitted SystemC types (e.g. sc_bv) are not interchangeable with
Verilator internal C++ types (e.g.: VlWide), so the variables themselves
are not interchangeable (but can be assigned to/from each other). We can
preserve correctness simply be not inlining any SystemC variables (i.e.:
don't simplify any 'sc = nonSc' or 'nonSc = sc' assignments). SystemC
types only appear at top level ports so this should have no significant
impact.

Fixes #3688
2022-10-20 15:44:51 +01: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
Krzysztof Bieganski
bec0b7d4d0
Disallow delays with --lib-create (#3691) 2022-10-19 20:52:29 -04:00
Wilson Snyder
f6f13c7fda Internals: Comment out debug that may flag ASAN problem (#3574) 2022-10-18 21:17:52 -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
Kamil Rakoczy
b6c116d4bf
Internals: Add VL_MT_SAFE annotations to const functions (#3681) 2022-10-18 17:07:09 -04:00
github action
c057847760 Apply 'make format' 2022-10-17 23:52:01 +00: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
Wilson Snyder
76ccd332a6 Internals: Remove DETECTARRAY, dead code. 2022-10-16 09:41:51 -04:00
Wilson Snyder
3cd2c8532d Internals: Cleanup spacing of Vi for loops. 2022-10-15 18:47:10 -04:00
Wilson Snyder
c0739e908c Fix internal traceActivity to be zero reset not randomized. 2022-10-15 18:37:44 -04:00
Wilson Snyder
916a3d9066 Fix --main --trace missing initial timestep (#3678). 2022-10-15 13:24:38 -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
github action
8dacbdec3a Apply 'make format' 2022-10-11 09:04:38 +00:00
Geza Lore
2a110c91cf Speed up DfgGraph decomposition algorithms 2022-10-11 09:55:08 +01: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
18c26b90af Fix --trace with --main/--binary (#3664) 2022-10-09 14:16:44 -04:00
Geza Lore
ff49f797e5 Speed up DfgGraph::addGraph
Append whole lists in one go, rather than going item by item.
2022-10-08 12:46:02 +01:00
Geza Lore
c033a0d7c8 Optimize DfgGraph vertex storage
Vertices representing variables (DfgVertexVar) and constants (DfgConst)
are very common (40-50% of all vertices created in some large designs),
and we also need to, or can treat them specially in algorithms. Keep
these as separate lists in DfgGraph for direct access to them. This
improve verilation speed.
2022-10-08 12:46:02 +01:00
Geza Lore
461f3c1004 DFG: Remove topological sort
Cyclic components are now extracted separately, so there is no
functional reason to have to do a topological sort (previously we used it
to detect cyclic graphs). Removing it to gain some speed.
2022-10-08 12:46:02 +01:00
Geza Lore
90447d54d1 Make DfgConst hold V3Number directly
Remove intermediary AstConst. No functional change intended.
2022-10-08 12:46:02 +01:00
Geza Lore
439d30a953 Minor cleanup in V3Number 2022-10-08 12:46:02 +01:00
Geza Lore
29a080dd9b DFG: Special case representation of AstSel
AstSel is a ternary node, but the 'widthp' is always constant and is
hence redundant, and 'lsbp' is very often constant. As AstSel is fairly
common, we special case as a DfgSel for the constant 'lsbp', and as
'DfgMux` for the non-constant 'lsbp'.
2022-10-06 19:59:01 +01:00
Geza Lore
0570cb8d9f DFG: Correctly set dtype when converting DfgCountOnes to Ast 2022-10-06 19:59:01 +01:00
Geza Lore
6fa14bf029 Speed up DfgPeephole in various ways 2022-10-06 19:59:01 +01:00
Geza Lore
4f0158b5e0 Speed up Dfg common sub-expression elimination
Added a DfgVertex::user() mechanism for storing data in vertices.
Similar in spirit to AstNode user data, but the generation counter is
stored in the DfgGraph the vertex is held under. Use this to cache
DfgVertex::hash results, and also speed up DfgVertex hashing in general.

Use these and additional improvements to speed up CSE.
2022-10-06 19:59:01 +01: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
5b742571d3 DFG: run removeVars after CSE
This enables removing some more redundant variables.
2022-10-06 09:31:56 +01: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
Krzysztof Bieganski
1a8188e1b4
Fix linker errors in user-facing timing functions (#3657)
Before this change, a design verilated with `--timing` that does not
actually use timing features would be emitted with `eventsPending` and
`nextTimeSlot` declared in the top class. However, their definitions
would be missing, leading to linker errors during design compilation.
This patch makes Verilator always emit the definitions, which prevents
linker errors. Trying to use `nextTimeSlot` without delays in the design
will result in an error at runtime.
2022-10-05 18:16:05 -04: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
965d99f1bc DFG: Make implementation more similar to AST
Use the same style, and reuse the bulk of astgen to generate DfgVertex
related code. In particular allow for easier definition of custom
DfgVertex sub-types that do not directly correspond to an AstNode
sub-type. Also introduces specific names for the fixed arity vertices.
No functional change intended.
2022-10-04 15:49:30 +01:00
Wilson Snyder
ced82cbac4 Internals: Add some internal coverage exclusions etc. No functional change. 2022-10-03 10:57:37 -04:00
Wilson Snyder
10fc1f757c Internals: cppcheck cleanups. No functional change intended. 2022-10-02 23:04:55 -04:00
Wilson Snyder
4367e03e46 Internals: Make VL_UNREACHABLE similar to std::unreachable() 2022-10-02 16:35:45 -04: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
github action
a204b24fcf Apply 'make format' 2022-10-01 15:06:12 +00:00
Marcel Chang
526e6b9fc7
Add --dump-tree-dot to enable dumping Ast Tree .dot files (#3636) 2022-10-01 11:05:33 -04:00
github action
f1ba6cb517 Apply 'make format' 2022-10-01 14:53:40 +00: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
cc51966ad1 DFG: Remove unconneced variables early 2022-09-30 11:53:03 +01: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
Geza Lore
acebafcbc2 DFG: Partial support for unpacked arrays
Representation and Ast / Dfg conversions available, for element-wise
access only. Not much optimization yet (only CSE).
2022-09-29 19:00:45 +01:00
Geza Lore
4a1a2def95 DFG: make variable inlining part of the peephole optimizer
This saves some traversals and prepares us to better handle cyclic DFGs.
2022-09-29 18:40:10 +01:00
Geza Lore
09e352ef66 DFG: support hashing of graphs circular through variables
No functional change
2022-09-29 18:40:10 +01:00
Geza Lore
17976d7401 DFG: fix REPLACE_EQ_OF_CONST_AND_CONST peephole pattern 2022-09-29 18:40: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
Geza Lore
a999c73ce0 Commentary 2022-09-28 14:43:40 +01: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
Ryszard Rozak
4931e48016
Support resolving assignments with equal strengths (#3637) 2022-09-26 21:21:37 -04:00
Geza Lore
1b17acdb01 DFG: Support AstSel and AstConcat on LHS of assignments
Added DfgVertexVariadic to represent DFG vetices with a varying number
of source operands. Converted DfgVar to be a variadic vertex, with each
driver corresponding to a fixed range of bits in the packed variable.
This allows us to handle AstSel on the LHS of assignments. Also added
support for AstConcat on the LHS by selecting into the RHS as
appropriate.

This improves OpenTitan ST speed by ~13%
2022-09-26 19:54:52 +01:00
Geza Lore
9c1cc5465d DFG: Support packed structure and union types 2022-09-26 18:31:50 +01:00
Geza Lore
d8b5359fcb Merge branch 'master' into develop-v5 2022-09-26 14:45:08 +01:00
Geza Lore
9da012568c Ensure DFG stats are consistent 2022-09-26 14:38:26 +01:00
Geza Lore
9a20a258f5 Omit AstNode::m_editCount in release build
This is only a debugging aid at this point, so compile out of the
release build. This reduces peak memory consumption by 4-5%. We still
keep the global counters to detect the tree have changed, to avoid
unnecessary dumps.
2022-09-25 08:57:33 +01:00
Geza Lore
10796457d2 V3Life: don't depend on AstNode::editCountGbl()
No functional change intended.
2022-09-24 20:45:30 +01:00
Geza Lore
78e659a142 Reduce size of FileLine
Multiple tricks to reduce the size of class FileLine from 72 to 40
bytes:

- Reduce file name index from 32 to 16 bits. This still allows 64K
  unique input files, which is hopefully enough.
- Intern message/warning enable bitset and use a 16-bit index, again
  allowing 64K unique sets which is hopefully enough.
- Put the m_waive flag into the sign bit of one of the line numbers.
- Use explicit reference counting to avoid overhead of shared_ptr.

Added assertions to ensure interned data fits within it's index space.

This saves ~5-10% peak memory consumption at no measurable run-time cost
on various designs.
2022-09-24 20:16:21 +01: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
3a8a314566 Merge branch 'master' into develop-v5 2022-09-23 11:21:12 +01:00
Geza Lore
050060b139 Make enum constructors and operators constexpr 2022-09-23 11:10:28 +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
github action
12093e6939 Apply 'make format' 2022-09-21 19:22:15 +00:00
Geza Lore
9949a6cd17 Generate AstGen::checkTreeiter to enforce Ast op*p use
Use astgen to generate a more thorough version of AstNode::checkTree,
which checks that operands are or consistent structure and type, as
described in the @astgen op directives. Also change checkTree to always
run when --debug-check is given.

Fix discovered fallout.
2022-09-21 18:12:11 +01:00
Geza Lore
4600932d8c Remove unused files 2022-09-21 14:16:20 +01:00