Geza Lore
603f4c615a
Improve Loop unrolling ( #6480 ) ( #6493 )
...
This patch implements #6480 . All loop statements are represented using
AstLoop and AstLoopTest.
This necessitates rework of the loop unroller to handle loops of
arbitrary form. To enable this, I have split the old unroller used for
'generate for' statements and moved it into V3Param, and subsequently
rewrote V3Unroll to handle the new representation. V3Unroll can now
unroll more complex loops, including with loop conditions containing
multiple variable references or inlined functions.
Handling the more generic code also requires some restrictions. If a
loop contains any of the following, it cannot be unrolled:
- A timing control that might suspend the loop
- A non-inlined call to a non-pure function
These constructs can change the values of variables in the loop, so are
generally not safe to unroll if they are present. (We could still unroll
if all the variables needed for unrolling are automatic, however we
don't do that right now.)
These restrictions seem ok in the benchmark suite, where the new
unroller can generally unroll many more loops than before.
2025-09-29 15:25:25 +01:00
Wilson Snyder
3b623dc12e
Internals: Refactor to create VCMethod ( #3715 ). No functional change intended.
2025-09-27 08:22:17 -04:00
Wilson Snyder
4ad1dde723
Internals: Emit newlines for AstCStmt automatically. No functional change intended.
2025-09-26 08:25:47 -04:00
Geza Lore
800af37975
Internals: Refactor generate construct Ast handling ( #6280 ) ( #6470 )
...
Internals: Refactor generate construct Ast handling (#6280 )
We introduce AstNodeGen, the common base class of AstGenBlock,
AstGenCase, AstGenFor, and AstGenIf, which together represent all SV
generate constructs. Subsequently remove AstNodeFor, AstNodeCase
(AstCase is now directly derived from AstNodeStmt) and adjust internals
to work on the new representation.
Output is identical modulo hashes do to changed AstNode type ids, no
functional change intended.
Step towards #6280 .
2025-09-23 19:49:01 +01:00
Wilson Snyder
a647747260
Add IMPLICITSTATIC also on procedure variables.
2025-09-21 19:52:19 -04:00
Geza Lore
e0e8503151
Internals: Make all AstBegin constructor arguments explicit ( #6464 )
2025-09-20 13:16:03 -04:00
Geza Lore
a44907b700
Fix memory leaks - batch 4 ( #6439 )
2025-09-16 19:22:36 +01:00
Geza Lore
56927fb955
Fix memory leaks - batch 3 ( #6419 )
2025-09-11 12:01:36 +01:00
Geza Lore
dd11d5a598
Fix memory leaks - batch 1 ( #6411 )
2025-09-09 22:39:44 +01:00
Wilson Snyder
0d1f036f17
Add error on non-packed struct randc ( #5999 ).
2025-09-06 08:24:19 -04:00
Igor Zaworski
4070db9990
Fix rand variable inside constraint ( #6315 )
2025-09-04 06:19:08 -04:00
Wilson Snyder
e32108713d
Fix randomize on function-local variable ( #6234 ).
2025-08-27 21:25:40 -04:00
Geza Lore
6f69c990fd
Internals: Remove AstCondBound and AstNodeCond ( #6293 ) ( #6294 )
...
Fixes #6293
2025-08-15 15:49:06 -07:00
Wilson Snyder
3ca1c9b6dd
Internals: Fix and enforce brace new constructors. No functional change intended.
2025-08-08 18:21:12 -04:00
Wilson Snyder
d1f851e1e1
Internals: Optimize empty 'if' into StmtExpr
2025-08-08 05:10:40 -04:00
Wilson Snyder
dca504c706
Internals: Use UINFOTREE istead of dumpTree
2025-08-02 13:44:40 -04:00
Ryszard Rozak
a5b0a0d9dd
Add support for `$countones` in constraints ( #6144 ) ( #6235 )
2025-07-28 16:14:03 +02:00
Yilou Wang
10ac99ac05
Support randomization of scope variables with 'std::randomize()' ( #5438 ) ( #6185 )
2025-07-25 12:13:46 +02:00
Ryszard Rozak
a21ecb2ab9
Add support for randomize..with on objects of aliased types ( #6195 )
2025-07-18 13:04:47 +02:00
Wilson Snyder
6c9cbaef62
Internals: Clean up some constructors. No functional change intended.
2025-07-03 18:59:32 -04:00
Geza Lore
916d473eff
Internals: Replace unnecessary AstSel::widthp() child node with const in node ( #6117 )
2025-06-24 11:59:09 -04:00
Wilson Snyder
46c7b69c64
Internals: UINFO now includes newline itself. No functional change.
2025-05-22 20:29:32 -04:00
Yilou Wang
a80aa07de6
Support constrained random for associative arrays ( #5985 ) ( #5986 )
2025-05-07 07:07:16 -04:00
Yilou Wang
e0fdb933a0
Support constraint random for StructArray ( #5805 ) ( #5937 )
2025-04-16 07:08:46 -04:00
Wilson Snyder
7521c2c644
Standardize some error messages.
2025-03-23 19:51:54 -04:00
Wilson Snyder
c508fd5d24
Internals: Remove single-statement braces. No functional change.
2025-03-19 22:55:11 -04:00
Yilou Wang
7fe51583e5
Fix foreach of assocArr inside a constraint block ( #5727 ) ( #5841 )
2025-03-11 13:32:34 -04:00
Wilson Snyder
8026b2a7f3
Fix checking built-in method arguments ( #5839 )
2025-03-08 14:11:12 -05:00
Yilou Wang
dae4c8ee22
Support constrained random for arrays in structs ( #5765 ) ( #5802 )
2025-02-24 17:51:51 -05:00
Wilson Snyder
fe15171649
Internals: cppcheck cleanups. No functional change.
2025-02-18 01:14:51 -05:00
Yilou Wang
6b4183632c
Support Unpacked Structures' Constrained Randomization ( #5657 ) ( #5759 )
2025-02-03 11:56:00 -05:00
Yilou Wang
d3e205f201
Support constraints on associative array user-defined keys ( #5671 ) ( #5729 )
2025-01-11 12:07:52 -05:00
Yilou Wang
0380a36c76
Fix constrained random for > 64-bit associative arrays ( #5670 ) ( #5682 )
2025-01-09 08:33:38 -05:00
Wilson Snyder
8fbb725f34
Copyright year update.
2025-01-01 08:30:25 -05:00
Wilson Snyder
4b4ca90c71
Internals: Create FuncRef/TaskRef directly from Func/Task pointer. No functional change intended
2024-12-15 09:15:49 -05:00
Wilson Snyder
80b2fa3583
Add error on randc inside dist
2024-12-14 11:47:46 -05:00
Yilou Wang
54ef9ad31c
Support associative array basic constrained randomization ( #5658 ) ( #5670 )
2024-12-12 11:31:54 -05:00
Wilson Snyder
0c820c3068
Internals: Standardize template argument names. No functional change.
2024-11-29 20:20:38 -05:00
Ryszard Rozak
ae990ebcda
Add warning on global constraints ( #5625 )
2024-11-22 08:47:14 -05:00
Ryszard Rozak
5470cf9fa9
Support randomize size constraints with restrictions ( #5582 partial) ( #5611 )
2024-11-15 10:45:06 -05:00
Wilson Snyder
4969125e5a
Add error on soft constraints of randc
2024-11-09 12:45:55 -05:00
Wilson Snyder
d230ccd716
Add error on `solve before` of `randc` variable.
2024-11-09 12:26:48 -05:00
Yilou Wang
a173883b2d
Support basic constrained random for multi-dimensional dynamic array and queue ( #5591 )
2024-11-08 14:04:58 -05:00
Ryszard Rozak
6083480abb
Fix `rand` dynamic arrays with null handles ( #5594 )
...
l
2024-11-08 06:53:43 -05:00
Ryszard Rozak
b3348a38d0
Internals: Remove repeated clearing of constraints ( #5583 )
...
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2024-11-04 04:48:55 -08:00
Ryszard Rozak
292c2e289e
Support `rand` dynamic arrays of objects ( #5557 ) ( #5564 )
2024-10-25 12:00:43 -04:00
Yilou Wang
2409f32d87
Fix multi-range indices assignment ( #5534 ) ( #5547 )
...
Co-authored-by: Udaya Raj Subedi <075bei047.udaya@pcampus.edu.np>
2024-10-21 09:56:50 -04:00
Yilou Wang
8c3cc3af8f
Fix struct array assignment ( #5455 ) ( #5537 )
2024-10-21 09:54:33 -04:00
Yilou Wang
920c8012de
Support unconstrained randomization for associative array and queue ( #5515 )
2024-10-08 10:54:20 -04:00
Yilou Wang
c05c48aaf3
Support unpacked array Constrained Randomization ( #5437 ) ( #5489 )
2024-10-02 10:29:47 -04:00
Arkadiusz Kozdra
02e7767886
Fix randomize with foreach constraints ( #5492 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-09-26 19:31:06 +02:00
Yilou Wang
70112438c3
Support packed/unpacked and dynamic array unconstrained randomization ( #5414 ) ( #5415 )
2024-09-19 20:07:05 -04:00
Arkadiusz Kozdra
dd95e033e7
Support inside array constraints ( #5448 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-09-19 07:27:59 -04:00
Arkadiusz Kozdra
0b7510befa
Support basic dist constraints ( #5431 )
2024-09-12 05:20:36 -07:00
Arkadiusz Kozdra
4a58997604
Support basic constrained queue randomization ( #5413 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-09-10 09:33:14 -04:00
Arkadiusz Kozdra
ef259f63ca
Fix randomize treated as std::randomize in classes ( #5436 )
2024-09-10 09:10:36 -04:00
Arkadiusz Kozdra
2f690c0530
Fix foreach colliding index names ( #5444 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-09-10 07:17:21 -04:00
Krzysztof Bieganski
088862d449
Support appending to queue via `[]` ( #5421 )
2024-09-02 09:45:47 -04:00
Krzysztof Bieganski
f133a2811f
Fix capturing params in `randomize() with` ( #5416 ) ( #5418 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-29 23:02:21 +02:00
Krzysztof Bieganski
aecf38e3ad
Fix V3Randomize compile error on old GCC ( #5403 ) ( #5417 ).
...
No functional change intended.
2024-08-29 10:39:54 -04:00
Krzysztof Bieganski
675d9a641e
Call `pre`/`post_randomize` on `randomize() with` ( #5412 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-28 19:42:49 +02:00
Krzysztof Bieganski
155dcc5658
Fix empty `foreach` in `if` in constraints ( #5408 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-27 15:39:36 +02:00
Krzysztof Bieganski
f623db7d68
Normalize types in constraints ( #5407 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-27 12:53:44 +02:00
Yilou Wang
c4cb26fa9a
Support unconstrained randomization for unions ( #5395 ) ( #5396 )
2024-08-26 11:04:45 -04:00
Wilson Snyder
8741fd17ad
Internals: cppcheck cleanups. No functional change intended.
2024-08-23 18:24:34 -04:00
Krzysztof Bieganski
eb8bbcda05
Internals: Simplify `CaptureVisitor` in `V3Randomize` ( #5397 )
2024-08-23 07:57:57 -04:00
Krzysztof Bieganski
930f35acc9
Support `constraint_mode` ( #5338 )
2024-08-21 06:16:44 -04:00
Krzysztof Bieganski
59d2eea302
Fix capturing fields from superclass in `randomize() with` ( #5389 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-20 13:25:58 -04:00
Krzysztof Bieganski
6cb0a41857
Support inline random variable control ( #5317 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-13 14:20:31 -04:00
Arkadiusz Kozdra
3e5859e5da
Support constraining AstSel ( #5344 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-08-08 15:37:08 +01:00
Krzysztof Bieganski
f4cb2c8cf2
Add more `rand_mode` unsupported errors ( #5329 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-08-05 17:56:03 -04:00
Krzysztof Boroński
45ee949cc4
Internals: Disambiguate variable references under `with` clauses of `randomize()` methods ( #5277 )
2024-08-02 11:45:17 -04:00
Arkadiusz Kozdra
54f9f4b6a9
Support foreach constraints ( #5302 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-08-02 10:03:55 -04:00
Krzysztof Bieganski
2f5c58b345
Support `rand_mode` ( #5273 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-07-31 22:30:48 +01:00
Ryszard Rozak
b9e1d55262
Fix handling of rand fields not referenced in constraints ( #5305 )
...
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2024-07-26 05:46:30 -04:00
Krzysztof Bieganski
f5caa4b7dc
Fix randomizing current object with `rand` class instance member ( #5292 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-07-22 14:41:12 +02:00
Krzysztof Bieganski
2bd2b9324f
Fix inline constraints creating class random generator ( #5280 )
2024-07-19 13:03:48 -04:00
Arkadiusz Kozdra
43377ed8b0
Add support for `this.randomize with` ( #5282 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-07-19 09:14:56 +02:00
Krzysztof Bieganski
b18037b7e7
Internals: Move non-visit methods to the proper place ( #5279 )
2024-07-18 08:57:39 -04:00
Krzysztof Bieganski
2a30a87580
Fix randomization when used with inheritance ( #5268 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-07-17 08:21:45 +02:00
Arkadiusz Kozdra
0a9b31bb30
Add warning on dist in constraints ( #5264 )
2024-07-15 21:01:33 -04:00
Krzysztof Bieganski
34e37d7bd0
Keep one member map for randomize method creation ( #5263 )
...
No functional change intended.
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-07-15 16:42:41 +02:00
Krzysztof Boroński
3cf9606ea9
Support inline constraints for class randomization methods ( #5234 )
...
Signed-off-by: Krzysztof Boronski <kboronski@antmicro.com>
2024-07-12 16:18:18 +02:00
Krzysztof Bieganski
2696a9a5bd
Fix unconstrained randomization of unpacked structs ( #5252 )
...
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2024-07-11 16:43:56 +02:00
Arkadiusz Kozdra
570e1bc35a
Support conditional constraints ( #5245 )
2024-07-10 11:30:18 -04:00
Arkadiusz Kozdra
85356f464f
State-dependent constraints ( #5217 )
...
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-07-01 20:19:15 +02:00
Wilson Snyder
708f875b31
Fix MSVC warnings. No functional change intended.
2024-06-07 22:52:56 -04:00
Arkadiusz Kozdra
739be2f782
Support constrained randomization with external solvers ( #4947 )
2024-05-17 10:38:34 -04:00
Kefa Chen
5f1dc73a1b
Support public packed struct / union ( #860 ) ( #4878 )
2024-03-03 10:23:04 -05:00
Wilson Snyder
3786f59e03
Change to IEEE 1800-2023 warning mentions
2024-03-02 10:15:19 -05:00
Szymon Gizler
5f52c066e5
Internals: Add serializeOnly() and dumpTreeEitherLevel() ( #4815 ) ( #4715 ). No functional change intended.
2024-01-09 10:35:13 -05:00
Wilson Snyder
e76f29e5ba
Copyright year update
2024-01-01 03:19:59 -05:00
Wilson Snyder
9fd5634778
Internals: Remove unneeded private's. No functional change
2023-11-13 21:37:45 -05:00
Wilson Snyder
99dbd23f1b
Support passing constraints to --xml-only output (still otherwise unsupported) ( #4683 )
2023-11-11 20:20:37 -05:00
Wilson Snyder
f3ae4b8786
Fix spelling
2023-11-10 23:25:53 -05:00
Geza Lore
d60f180f43
Avoid double traversal of maps
...
The typical find/if-not-exists-insert pattern can be achieved with 1
lookup instead of 2 using emplace with a sentinel value. Also maps value
initialize their values when inserted with the [] operator, this is
defined and so there is no need to explicitly insert zeroes for integer
values.
2023-10-28 13:41:43 +01:00
Geza Lore
30318a6654
C++11 cleanup
2023-10-28 11:26:48 +01:00
Ryszard Rozak
64af83161a
Fix rand fields of reference types ( #4627 )
2023-10-26 17:17:23 -04:00
Ryszard Rozak
84125d7c92
Fix virtual methods ( #4616 )
2023-10-24 15:51:46 +02:00
Wilson Snyder
b5828a7ce9
Fix header order botched by clang-format in recent commit.
2023-10-18 06:37:46 -04:00