Commit Graph

2923 Commits

Author SHA1 Message Date
Ryszard Rozak 9da3aacd08
Fix bit selections under parameterized classes (#4210) 2023-05-18 20:01:36 -04:00
Krzysztof Bieganski 729f8b9334
Move suspendable detection to a separate visitor (#4208)
This makes the implementation of the detection and propagation of the
suspendable property simpler and easier to read. More importantly, there are no
more jumps around the AST with the `visit` functions, which in some cases could
result in incorrect visitor context while in the `visit` function. See the added
test, which would cause Verilator to segfault before this patch.

In testing, verilation performance was not shown to be affected by this change.
Though there is a slight performance improvement from this patch, due to adding
one more check before refreshing class member cache.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2023-05-17 17:09:33 +00:00
Ryszard Rozak 279216048b
Fix dotted references in parameterized classes (#4206) 2023-05-16 07:40:02 -04:00
Ryszard Rozak 2ce7a348df
Fix references to members of parameterized base classes (#4196) 2023-05-15 19:50:04 -04:00
Wilson Snyder 46f719ceaa Tests: Fix some coverage holes 2023-05-13 20:15:03 -04:00
Krzysztof Bieganski 4835ed6967
Fix forced assignments that override non-continuous assignments (#4183) (#4192)
Only assign forced value on release if it was forced in the first place.
2023-05-12 06:57:12 -04:00
Ryszard Rozak 0198a3fc52
Use unchanged copy of parameterized class for instantation (#4179) 2023-05-11 09:56:15 +02:00
Krzysztof Boroński e095bf1af0
Support inside expressions with strings and doubles (#4138) (#4139) 2023-05-10 20:36:41 -04:00
Aylon Chaim Porat d5de67c6dc
Fix wide structure VL_TOSTRING_W generation (#4188) (#4189)
* V3Common.cpp::makeVlToString: fix `VL_TOSTRING_W` statement generation to include width argument

* fix contribution name

* add testcase for long struct `VL_TO_STRING_W` bug
2023-05-10 20:34:44 -04:00
Ryszard Rozak 2267db093f
Fix hashes of instances of parameterized classes (#4182) 2023-05-10 18:34:29 -04:00
Wilson Snyder c0490627bf Tests: Update historical 2023-05-07 22:00:52 -04:00
Wilson Snyder d269fbb446 Add creating __inputs.vpp file with --debug (#4177). 2023-05-07 17:58:14 -04:00
Wilson Snyder 444020f7c7 Fix super.new missing data type (#4147). 2023-05-07 16:47:34 -04:00
Wilson Snyder 6188083baa Tests: Improve randc tests 2023-05-07 15:08:44 -04:00
Wilson Snyder e6f5a0495f Fix $fscanf of decimals overflowing variables (#4174). 2023-05-07 08:25:10 -04:00
Wilson Snyder 0606a29f13 Fix arrays of unpacked structs (#4173). 2023-05-06 21:41:17 -04:00
Wilson Snyder 4bb876aee5 Fix false IMPLICITSTATIC on package functions. 2023-05-06 19:48:22 -04:00
Wilson Snyder a3640c1767 Support get_randstate/set_randstate class method function. 2023-05-06 19:09:19 -04:00
Wilson Snyder 250c6950cf Fix randomize missing simple class rand members. 2023-05-06 18:33:08 -04:00
Ethan Sifferman 64ab537b68
Add NEWERSTD warning when using feature in newer language standard (#4168) (#4172). 2023-05-05 22:36:51 -04:00
Wilson Snyder fdea386727 Fix false WIDTHEXPAND on array declarations (#3959). 2023-05-05 22:05:19 -04:00
Wilson Snyder 28944ed862 Fix crash on duplicate imported modules (#3231). 2023-05-05 20:31:48 -04:00
Wilson Snyder d308a561e4 Fix detection of wire/reg duplicates 2023-05-05 20:16:27 -04:00
Wilson Snyder 584f8cc9e7 Internal: With --xml-only support --debug-exit-uvm 2023-05-05 13:47:34 -04:00
Kamil Rakoczy 832b17d4d2
clang_check_attributes: fix mt-safe checks for global objects in constructor context (#4171) 2023-05-04 14:00:30 -04:00
Krzysztof Bieganski 76c5875912
Fix marking overridden methods as coroutines (#4120) (#4169)
This patch fixes two cases where methods in base classes were not being marked
as coroutines, even though they were being overridden by coroutines.
- One case is the class member cache not getting refreshed for searched classes.
- The other is when the overriding methods are not declared as `virtual`. In
  that case, the `isVirtual()` getter on such a method returns false, which led
  to `V3Timing` skipping the step of searching for overridden methods.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2023-05-04 15:27:45 +02:00
Ryszard Rozak 266dc7679a
Don't link AstRefDType if it has parameterized class ref (#4164) (#4170) 2023-05-04 15:09:01 +02:00
Stefan Wallentowitz 7708c88e32
Fix duplicate static names in blocks in functions (#4144) (#4160)
Static variables of functions are created in the function. When blocks
in a function use identical names for static variables, we need to name
those variables properly.
2023-05-02 20:24:44 -04:00
Kamil Rakoczy 49d2eb9a08
Fix initialization order of initial static after function/task (#4159) 2023-05-02 11:50:57 -04:00
Toru Niina 9130eb8b99
Fix DPI function type alias (#4148) (#4149) 2023-04-28 07:21:09 -04:00
Ryszard Rozak 09e856d2f3
Fix deleting unused parameterized classes (#4150) 2023-04-28 07:20:25 -04:00
Ryszard Rozak ee5c0a2902
Support parameterized class references in extends statement (#4146) 2023-04-24 17:25:53 -04:00
Ryszard Rozak 621b7e63cf
Print the type of provided RHS in class type check (#4145) 2023-04-24 17:24:04 -04:00
Risto Pejašinović f794180865
Fix hier attribute of --xml-only cell section to respect begin blocks (#4129) (#4133)
Co-authored-by: Risto Pejasinovic <risto.pejasinovic@cern.ch>
2023-04-24 07:28:29 -04:00
Geza Lore 0e769d42a1 Optimize trigger evaluation
Pack the elements of VlTriggerVec as dense bits (instead of a 1 byte
bool per bit), and check whether they are set on a word granularity.
This effectively transforms conditions of the form `if (trig.at(0) |
trig.at(2) | trig.at(64))` into `if (trig.word(0) & 0x5 | trig.word(1) &
0x1)`. This improves OpenTitan ST by about 1%, worth more on some other
designs.
2023-04-24 09:09:36 +02:00
Wilson Snyder 5a98c1a3b1 Commentary 2023-04-23 10:10:05 -04:00
Geza Lore cac634d39b
Fix DfgToAst conversion of CountBits (#4101) (#4143) 2023-04-23 08:49:44 -04:00
Peter Monsson 08330bad0b
Fix variables in class methods to be automatic (#4111) (#4137) 2023-04-21 08:07:22 -04:00
Ryszard Rozak 84a46939b3
Fix class extend param references (#4136)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-04-20 07:11:35 -04:00
Kamil Rakoczy 65a484e00b
Internal: Update clang_check_annotations conditions (#4134) 2023-04-20 07:02:31 -04:00
Krzysztof Boroński 843fdd3e57
Resolve class lvalues after parameterization (#4131) 2023-04-19 18:05:37 -04:00
Ryszard Rozak a10b51705f
Fix class param extends A=B (#4128)
Visit global class params even if a class extends a param
2023-04-17 09:08:57 -03:00
Wilson Snyder 7f49b6c102 Parse 'let' as unsupported 2023-04-16 17:23:16 -04:00
Ryszard Rozak d1b80ffa29
Support parameterized return types of methods (#4122) 2023-04-14 08:52:43 -04:00
Ryszard Rozak f95ce886f1
Fix duplicating parameter class types (#4115) 2023-04-14 06:51:33 -04:00
Wilson Snyder 0307d59c1f Fix unpacked structs under classes (#4102). 2023-04-10 19:40:34 -04:00
Wilson Snyder 3aa013c8db Tests: Remove old file 2023-04-10 19:40:34 -04:00
Srinivasan Venkataramanan 722ab9306a
Support class method calls without parenthesis (#3902) (#4082) 2023-04-10 19:37:24 -04:00
Wilson Snyder 2ab34b5eeb Fix false error on new const assignment (#4098). 2023-04-09 19:46:47 -04:00
Wilson Snyder e3bdae77a0 Tests: Add randsequence test 2023-04-09 17:08:04 -04:00
Wilson Snyder bf5cbb512e Add UNSUPPORTED on dotted disable instead of syntax error 2023-04-09 10:11:47 -04:00
Wilson Snyder d4bb58630e Support 'for' initialization with comma 2023-04-09 09:56:39 -04:00
Wilson Snyder 13a87e5514 Parse process class, and report runtime errors (#3612) 2023-04-08 15:04:42 -04:00
Wilson Snyder d67d75282c Support ++/-- on dotted member variables. 2023-04-07 20:57:17 -04:00
Kamil Rakoczy 827cbf22c9
Fix sense expression variable naming (#4081) 2023-04-07 07:23:37 -04:00
Wilson Snyder 05660d1118 Add CONSTRAINTIGN warning when constraint ignored. Likewise ignore constraint_mode, rand_mode. 2023-04-05 21:27:37 -04:00
Ryszard Rozak a3f9221a67
Fix importing symbols from base class (#4084) 2023-04-04 20:56:18 -04:00
Wilson Snyder 7e1980af7a Tests: Avoid t_dist failures on deleted files. 2023-04-02 15:10:45 -04:00
Wilson Snyder 921fd919b5 Tests: Improve short circuit test 2023-04-01 23:10:05 -04:00
Wilson Snyder 86156dd05b Revert false-positive static error (#4072) (#4077) 2023-04-01 18:54:37 -04:00
Wilson Snyder 3219ffddd4 Tests: Ignore commented out messages 2023-04-01 18:17:45 -04:00
Wilson Snyder 3a01c32bf9 Revert false-positive static error (#4072) (#4077) 2023-04-01 15:45:34 -04:00
Wilson Snyder 9ffd0a4e70 Support queue[$-1] selects. 2023-04-01 15:23:39 -04:00
Wilson Snyder 69121633cf Support class srandom and class random stability. 2023-04-01 10:50:27 -04:00
Wilson Snyder 93c598dd19 Commentary 2023-04-01 10:38:33 -04:00
Krzysztof Bieganski d012563ab1
Fix tracing with awaits at end of block (#4075) (#4076)
Given an await at the end of a block, e.g. at the end of a loop body, a trace
activity setter was not inserted, as there were no following statements. This
patch makes the activity update unconditional.
2023-03-31 13:51:31 -04:00
Krzysztof Bieganski 0b96789e65
Add error on static access to non-static class member (#4072)
Before this patch, it was possible to access non-static class members using
static access, which resulted in C++ compilation errors. This adds
verilation-time checks for such situations.
2023-03-27 10:46:51 -04:00
Wilson Snyder 947402bc57 Fix interface generate begin (#4065). 2023-03-26 08:49:38 -04:00
Yutetsu TAKATSUKASA d4107dce52
Improve xor tree optimization (#4071)
* AstNot does not have to be frozen in an xor tree during BitOp tree optimization.

* Tests: Update stats.
2023-03-26 20:36:32 +09:00
Yutetsu TAKATSUKASA 990b19e048
Fix incorrect optimization of bit op tree (#4059) (#4070) 2023-03-26 03:29:10 -04:00
Srinivasan Venkataramanan 2290e6ccf2 Fix info message prints under --assert (#4036) (#4053) 2023-03-24 19:22:48 -04:00
Wilson Snyder 14c8f072f1 Commentary 2023-03-24 19:06:07 -04:00
Krzysztof Bieganski c55df02b1a
Fix C++ compile errors when passing class refs as task arg (#4063)
1. Fixes passing a null reference as a task argument. Before this patch it would
   cause a C++ compile error like `cannot convert ‘VlNull’ to ‘VlClassRef<...>’`.

2. Fixes passing a class reference as a task argument when the argument is a
   reference to a base class. Before the patch it would cause a C++ compile
   error like `cannot convert ‘VlClassRef<{DERIVED_CLASS}>’ to ‘VlClassRef<{BASE_CLASS}>`.
2023-03-24 13:18:59 -04:00
Ryszard Rozak 5b86248b54
Add error if class types don't match (#4064) 2023-03-24 13:18:20 -04:00
Ryszard Rozak f439a7927f
Fix parameters in a class body to be localparam (#4061) 2023-03-23 10:20:35 +01:00
Aleksander Kiryk 277bd67f72
Fix NBAs inside fork-joins (#4050) 2023-03-21 10:39:29 -04:00
Krzysztof Bieganski 5de8ccbf32
Fix task calls as fork statements (#4055)
Before this patch, calling tasks directly under forks would result in each
statement of these tasks being executed concurrently. This was due to Verilator
inlining tasks most of the time. Such inlined tasks' statements would simply
replace the original call, and there would be no indication that these used to
be grouped together. Ultimately resulting in `V3Timing` treating each statement
as a separate process.

The solution is simply to wrap each fork sub-statement in a begin in `V3Begin`
(except for the ones that are begins, as that would be pointless). `V3Begin` is
already aware of forks, and is supposed to avoid issues like this one, so it
seems like a natural fit. This also protects us from similar bugs, i.e. if some
statement gets replaced or expanded into multiple statements.

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2023-03-21 13:50:53 +01:00
Iztok Jeras 2aa6a229ca
Change range order warning from LITENDIAN to ASCRANGE (#4010) 2023-03-20 20:44:11 -04:00
Wilson Snyder 2b21697b86 Support class extends of package::class. 2023-03-18 17:26:36 -04:00
Ryszard Rozak 371b8310d9
Support method calls without parenthesis (#4034)
* Support method class without parenthesis

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>

* Delete replaced nodes

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>

---------

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-03-17 13:25:39 +01:00
Ryszard Rozak 1ac721af8f
Add STATICVAR warning and convert to automatic (#4027) (#4030)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-03-17 07:48:41 -04:00
Wilson Snyder 85fd88ace2 Optimize duplicate JumpBlocks away (#4028) 2023-03-16 22:29:06 -04:00
Wilson Snyder ed1e377bb1 Fix large return blocks with --comp-limit-blocks (#4028). 2023-03-16 21:40:01 -04:00
Kamil Rakoczy bbf53bd5af
Add VL_MT_SAFE attribute to several functions. (#3729) 2023-03-16 19:48:56 -04:00
Wilson Snyder a9b07fe7d7 Tests: Remove unintended t_0 test 2023-03-16 18:44:28 -04:00
Kamil Rakoczy 66e4656a8e
Fix event controls reusing same variable (#4014) 2023-03-16 07:12:54 -04:00
Wilson Snyder 8ae79066a2 Fix false ENUMVALUE on expressions and arrays. 2023-03-15 21:56:35 -04:00
Wilson Snyder 36da6a3563 Fix parsing #1_2 delays 2023-03-15 21:22:28 -04:00
Wilson Snyder 45690faea7 Parse defparam = as unsupported 2023-03-15 21:04:10 -04:00
Wilson Snyder 046fecbb35 Fix fclose(0). 2023-03-15 20:49:59 -04:00
Ryszard Rozak 0f6024ef3c
Fix rand fields in base classes (#4025) 2023-03-15 11:48:18 -04:00
Wilson Snyder 2488b5a97f Fix pullup/pulldown to create implicit wires. 2023-03-14 21:14:27 -04:00
Wilson Snyder 0fc5d37901 Fix bounded queues with parameter bounds 2023-03-14 20:29:47 -04:00
Wilson Snyder ea4cc4e076 Parse nettype with package, still unsupported 2023-03-14 19:52:01 -04:00
Wilson Snyder 9e25c21fed Fix unpacked struct clocking 2023-03-14 19:35:40 -04:00
Ryszard Rozak fc3fdcc71c
Tests: Fix randomize_method test (#4024) 2023-03-14 13:47:43 -04:00
Ryszard Rozak 80b7b8bbdb
Don't call randomize on null field (#4023)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-03-14 14:48:06 +01:00
Wilson Snyder a8ce272e4a Commentary: spelling 2023-03-14 08:39:54 -04:00
Ryszard Rozak ed1a9309d4
Throw warning if static variable is declared in a loop (#4018)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-03-14 10:03:08 +01:00
Ryszard Rozak 1d0a06438c
Assign unique names for blocks in do..while loop (#4019) 2023-03-14 09:54:43 +01:00