Commit Graph

491 Commits

Author SHA1 Message Date
Ryszard Rozak 2ce7a348df
Fix references to members of parameterized base classes (#4196) 2023-05-15 19:50:04 -04:00
Wilson Snyder a3640c1767 Support get_randstate/set_randstate class method function. 2023-05-06 19:09:19 -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 d308a561e4 Fix detection of wire/reg duplicates 2023-05-05 20:16:27 -04:00
Ryszard Rozak 266dc7679a
Don't link AstRefDType if it has parameterized class ref (#4164) (#4170) 2023-05-04 15:09:01 +02:00
Wilson Snyder add68130b8 Internals: Rename to dumpLevel(), to avoid confusion with make-a-dump() 2023-05-03 18:04:10 -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 84a46939b3
Fix class extend param references (#4136)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-04-20 07:11:35 -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
github action fc70876aa9 Apply 'make format' 2023-04-10 23:38:20 +00:00
Srinivasan Venkataramanan 722ab9306a
Support class method calls without parenthesis (#3902) (#4082) 2023-04-10 19:37:24 -04:00
Ryszard Rozak a3f9221a67
Fix importing symbols from base class (#4084) 2023-04-04 20:56:18 -04:00
Wilson Snyder 86156dd05b Revert false-positive static error (#4072) (#4077) 2023-04-01 18:54:37 -04:00
Wilson Snyder 3a01c32bf9 Revert false-positive static error (#4072) (#4077) 2023-04-01 15:45:34 -04:00
Wilson Snyder 69121633cf Support class srandom and class random stability. 2023-04-01 10:50:27 -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 2b21697b86 Support class extends of package::class. 2023-03-18 17:26:36 -04:00
Wilson Snyder d6c5d40f9b Internals: Add VNVisitorConst class. 2023-03-17 19:59:09 -04:00
Wilson Snyder 2488b5a97f Fix pullup/pulldown to create implicit wires. 2023-03-14 21:14:27 -04:00
Krzysztof Boroński f68c16a5e6
Fix symbol entries when inheriting classes (#3995) (#3996) 2023-03-06 07:43:58 -05:00
Wilson Snyder e21198cb2d Add warning on missing class reference #() 2023-03-03 21:06:52 -05:00
github action 08a433260c Apply 'make format' 2023-03-01 05:44:35 +00:00
Wilson Snyder 7fc278f6db Fix import of extends typedefs 2023-03-01 00:30:45 -05:00
Wilson Snyder c82a098f2e Internals: Parse class extends :: 2023-02-14 21:23:55 -05:00
Wilson Snyder 4d29487e75 Fix -Wpedantic on std::process. 2023-02-11 10:55:06 -05:00
Ryszard Rozak d34aa10faf
Fix class field linking when a super classes is a param (#3949) 2023-02-10 07:44:14 -05:00
Wilson Snyder 70eceae3d8 Fix core dump on bad dotted reference. 2023-02-05 12:45:14 -05:00
Aleksander Kiryk 31130c4b4a
Fix std:: to be parsed first (#3864) (#3928) 2023-02-03 09:04:16 -05:00
Ryszard Rozak 33468fa0e7
Fix class extend parameter dot case (#3926) 2023-02-02 17:59:47 -05:00
Ryszard Rozak 0e955d503e
Handle references of static members of type aliases of a parametrized class (#3922)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-02-02 08:36:11 +01:00
Ryszard Rozak 7f3e178b68
Fix paramaterized class function linkage (#3917)
* Visit function arguments even if the function is unlinkable
* Don't use m_unlinedScopep in AstLambdaArgRef handling
2023-01-30 22:20:56 -05:00
Wilson Snyder 248bd173d3 Support interface classes and class implements. 2023-01-28 18:06:37 -05:00
Wilson Snyder 8d2be855f5 Internals: Parsing and tests for class interfaces 2023-01-28 16:30:47 -05:00
Wilson Snyder f20997a2f0 Support global clocking and $global_clock. 2023-01-28 12:31:52 -05:00
Wilson Snyder bea225e191 Fix duplicate name check on extern symbols 2023-01-28 11:55:44 -05:00
Ryszard Rozak 91c44d7830
Support class extending its parameter (#3904) 2023-01-25 20:33:18 -05:00
Ryszard Rozak 4a8cfe367d
Support function calls without parenthesis (#3903) (#3902)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-01-24 15:36:30 +01:00
Ryszard Rozak b56e7f6910
Support static function variables (#3830) 2023-01-23 08:35:10 -05:00
Ryszard Rozak be53eec5ca
Support property calls without parenthesis (#3879) (#3893) 2023-01-20 07:25:37 -05:00
Wilson Snyder 035bf13e4a Fix foreach unnamedblk duplicate error (#3885). 2023-01-18 21:48:06 -05:00
Wilson Snyder b24d7c83d3 Copyright year update 2023-01-01 10:18:39 -05:00
Wilson Snyder 24198ef0ed Internal line coverage fix 2022-12-29 14:18:45 -05:00
Larry Doolittle 80a144797d
Commentary: Fix more spelling (#3828) 2022-12-26 10:30:41 +01:00
Krzysztof Bieganski bb44d4e4f2
Support clocking blocks (#3674) 2022-12-23 07:34:49 -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 833780fac1 Internal: cppcheck fixes. No functional change intended. 2022-11-27 05:52:40 -05:00
Ryszard Rozak 68f8617f79
Support member selects in with clauses (#3775) 2022-11-23 13:15:10 -05:00
Wilson Snyder f44cd9cd48 Internals: Fix constructor style. 2022-11-20 17:40:38 -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
Ryszard Rozak 3ddfa214e3
Fix $unit as base package for other packages (#3755) 2022-11-16 18:58:57 -05:00
Wilson Snyder c6ecd60993 Support pre_randomize and post_randomize. 2022-11-13 11:59:40 -05:00
Wilson Snyder 6736e92cdb Internals: Fix some ugly line breaks. No functional change. 2022-11-11 22:33:17 -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
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
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
Arkadiusz Kozdra 0e4da3b0bf
Support virtual interfaces (#3654) 2022-10-20 06:31:00 -04:00
Krzysztof Bieganski 22243d1e49
Support class type params without defaults (#3693) 2022-10-19 21:59:26 -04:00
Arkadiusz Kozdra 038d57070b
Support standalone 'this' in classes (#3675) (#2594) (#3248) 2022-10-14 08:55:55 -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
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 ce03293128 Generate AstNode accessors via astgen
Introduce the @astgen directives parsed by astgen, currently used for
the generation child node (operand) accessors. Please see the updated
internal documentation for details.
2022-09-21 13:56:03 +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
Wilson Snyder 2dc85a5acd Internals: enum constructor cleanups. No functional change intended. 2022-09-15 19:58:10 -04:00
Wilson Snyder d85b909054 Internals: Use std:: for mem and str functions. 2022-09-14 21:10:19 -04:00
Wilson Snyder 51daa64e9a Fix --hierarchical with order-based pin connections (#3585). 2022-08-31 18:12:21 -04:00
Wilson Snyder ea55db7286 Internals: Cleanup some string constructors. No functional change. 2022-08-30 01:02:39 -04:00
Wilson Snyder 6a5f77b278 Internals: Cleanup some string/model constructors. No functional change. 2022-08-29 23:50:32 -04:00
Arkadiusz Kozdra 0a3a15a66e
Support class parameters (#2231) (#3541) 2022-08-28 10:24:55 -04: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
Wilson Snyder b9d7819faa Internals: Fix some cppcheck issues. Some dump functions fixed. 2022-07-30 10:01:39 -04:00
Wilson Snyder 530817191e Support non-ANSI interface port declarations (#3439). 2022-05-25 00:50:50 -04:00
Wilson Snyder 3c4131d45d Fix 'with' operator with type casting (#3387). 2022-05-15 09:53:48 -04:00
Yoda Lee a6d678d41d
Fix hang in generate symbol references (#3391) (#3398) 2022-04-27 18:40:36 -04:00
Wilson Snyder 33105f017c Commentary 2022-03-30 20:17:59 -04:00
Wilson Snyder 90c61c79d6 Fix unnamedblk error on foreach (#3321). 2022-03-05 17:04:52 -05: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 15b32dc140 Internals: cpplint cleanups. No functional change. 2022-01-08 12:01:39 -05: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 7e355e211c Fix dangling node on error 2022-01-02 20:54:13 -05:00
Wilson Snyder 2e2b82c052 Support class static members (#2233). 2022-01-02 15:09:07 -05:00
Wilson Snyder f1bb0544be Internals: Cleanups towards static class members. No functional change intended. 2022-01-02 15:03:57 -05:00
Wilson Snyder e6857df5c6 Internals: Rename Ast on non-node classes (#3262). No functional change.
This commit has the following replacements applied:

	s/\bAstUserInUseBase\b/VNUserInUseBase/g;
        s/\bAstAttrType\b/VAttrType/g;
        s/\bAstBasicDTypeKwd\b/VBasicDTypeKwd/g;
        s/\bAstDisplayType\b/VDisplayType/g;
        s/\bAstNDeleter\b/VNDeleter/g;
        s/\bAstNRelinker\b/VNRelinker/g;
        s/\bAstNVisitor\b/VNVisitor/g;
        s/\bAstPragmaType\b/VPragmaType/g;
        s/\bAstType\b/VNType/g;
        s/\bAstUser1InUse\b/VNUser1InUse/g;
        s/\bAstUser2InUse\b/VNUser2InUse/g;
        s/\bAstUser3InUse\b/VNUser3InUse/g;
        s/\bAstUser4InUse\b/VNUser4InUse/g;
        s/\bAstUser5InUse\b/VNUser5InUse/g;
        s/\bAstVarType\b/VVarType/g;
2022-01-02 14:03:20 -05:00
Wilson Snyder 24a0d2a0c9 Internals: Favor member assignment initialization. No functional change intended. 2022-01-01 11:46:49 -05:00
Wilson Snyder ca42be982c Copyright year update. 2022-01-01 08:26:40 -05:00
Wilson Snyder 5e3016f34a Fix foreach on dotted reference. 2021-12-12 20:44:58 -05:00
Wilson Snyder f775feb7f0 Fix foreach on dotted reference. 2021-12-12 20:43:15 -05:00
Wilson Snyder 6b0601fd54 Support lower dimension looping in foreach loops (#3172). 2021-12-11 20:39:58 -05:00
Wilson Snyder 984ee624ed Fix break under foreach loop (#3230).
Internals: Move Foreach handling into V3Width.
2021-12-11 15:06:33 -05:00
Adrien Le Masle 00ef0519f5
Fix top level parameter overwrite when a package has same parameter (#3241) (#3247) 2021-12-11 14:55:59 -05:00
Wilson Snyder cd737065f2 Internals: More const. No functional change intended. 2021-11-26 17:55:36 -05:00
Wilson Snyder 2742a8c813 Internals: No need for variable name on immediate visitors. No functional change intended. 2021-11-26 10:52:45 -05:00
Wilson Snyder 05e12ab60e Internals: More const. No functional change intended. 2021-11-26 10:52:45 -05:00
Wilson Snyder b1b92b7dd4 Fix hang on recursive definition error (#3199). 2021-11-23 07:27:41 -05:00
Wilson Snyder 37e3c6da70 Internals: Add more const. No functional change intended. 2021-11-13 13:50:44 -05:00
Geza Lore 381c87a1eb Remove VN_CAST_CONST and VN_AS_CONST.
The _CONST suffix on these macros is only lexical notation, pointer
constness can be preserved by overloading the underlying
implementations appropriately. Given that the compiler will catch
invalid const usage (trying to assign a non-const pointer to a const
pointer variable, etc.), and that the declarations of symbols should
make their constness obvious, I see no reason to keep the _CONST
flavours.
2021-10-24 11:43:48 +01:00
Geza Lore 70603bb752 Add static assertions for unnecessary VN_IS/VN_AS/VN_CAST
Fail at compile time if the result of these macros can be statically
determined (i.e.: they aways succeed or always fail). Remove unnecessary
casts discovered. No functional change.
2021-10-22 19:39:24 +01:00
Geza Lore dae9fa5053 Use VN_AS wherever possible and obvious. No functional change. 2021-10-22 14:06:00 +01:00
Wilson Snyder 8ecdc85cf7 Internals: C++11 style cleanups. No functional change. 2021-07-11 18:42:01 -04:00
Geza Lore 708abe0dd1 Introduce model interface class, make $root part or Syms (#3036)
This patch implements #3032. Verilator creates a module representing the
SystemVerilog $root scope (V3LinkLevel::wrapTop). Until now, this was
called the "TOP" module, which also acted as the user instantiated model
class. Syms used to hold a pointer to this root module, but hold
instances of any submodule. This patch renames this root scope module
from "TOP" to "$root", and introduces a separate model class which is
now an interface class. As the root module is no longer the user
interface class, it can now be made an instance of Syms, just like any
other submodule. This allows absolute references into the root module to
avoid an additional pointer indirection resulting in a potential speedup
(about 1.5% on OpenTitan). The model class now also contains all non
design specific generated code (e.g.: eval loops, trace config, etc),
which additionally simplifies Verilator internals.

Please see the updated documentation for the model interface changes.
2021-06-30 16:35:40 +01:00
Wilson Snyder 512fe0a2d1 Internals: Add const. No functional change. 2021-06-20 18:33:13 -04:00
Wilson Snyder c11cd18491 In XML, show pinIndex information (#2877). 2021-06-19 13:41:41 -04:00
Wilson Snyder 13ddd0bc1c Fix error on unsupported recursive functions (#2957). 2021-06-13 12:38:31 -04:00
Geza Lore c207e98306
Implement a distinct constant pool (#3013)
What previously used to be per module static constants created in
V3Table and V3Prelim are now merged globally within the whole model and
emitted as part of a separate constant pool. Members of the constant
pool are global variables which are declared lazily when used (similar to
loose methods).
2021-06-13 15:05:55 +01:00
Udi Finkelstein 0ea5af40c5
Add PINNOTFOUND warning in place of "Pin not found" error (#2868) 2021-04-01 18:17:42 -04:00
Wilson Snyder ba1f53a070 Improve DEFPARAM warning text. 2021-03-14 20:37:50 -04:00
Wilson Snyder 689d5b5090 Internals: Add std:: to make_pair. No functional change. 2021-03-12 18:17:49 -05:00
Wilson Snyder 3a55600913 Internals: Restyle with C++11 using replacing typedef 2021-03-12 18:10:45 -05:00
Wilson Snyder 404b323f8c Internals: Remove some unnecessary typedefs. No functional change. 2021-03-12 17:26:53 -05:00
Wilson Snyder 6ff1911110 Tests: Cover some internal code coverage issues 2021-03-07 13:52:37 -05:00
Wilson Snyder 9650aefa42 Internals: Cleanup unneeded {}. No functional change 2021-02-21 21:25:21 -05:00
Wilson Snyder bd602d0e2d Copyright year update 2021-01-01 10:29:54 -05:00
Wilson Snyder b7a533109d Fix cppcheck warnings. No functional change intended. 2020-12-23 15:22:02 -05:00
Wilson Snyder c39a8b439a Internals: Use emplace instead of insert(make_pair(...)). No functional change intended. 2020-12-18 18:24:47 -05:00
Wilson Snyder b04a1caeac In warnings, rename cells to instances to match IEEE 2020-12-12 22:43:55 -05:00
Wilson Snyder 53c4c7d540 Fix error format (#2095). 2020-12-12 22:26:50 -05:00
Wilson Snyder 18f8c8a14f Fix error when dotted refers to missing module (#2095). 2020-12-12 20:25:00 -05:00
Wilson Snyder d7af6436a2 Fix genblk naming to match IEEE (#2686). 2020-12-12 12:57:11 -05:00
Wilson Snyder 251812638d Internals: Rename accessor. No functional change. 2020-12-07 18:50:31 -05:00
Wilson Snyder f858dd44ac Fix :: references to forward classes 2020-12-05 16:23:20 -05:00
Wilson Snyder f0e691a1b8 Handle unsupported parameters through link phase 2020-12-05 11:30:14 -05:00
Wilson Snyder 5fb834e41e Fix passing parameter type instantiations by position number. 2020-12-05 11:00:30 -05:00
Wilson Snyder a54ac52a35 Internals: Use 'Bit' where mean 2-state type. No functional change. 2020-11-29 08:23:36 -05:00
Wilson Snyder 1299b70945 Internals: Pass class parameters through link. 2020-11-27 22:48:42 -05:00
Wilson Snyder d56b923eaa Fix 'randomize() with {}' crash 2020-11-26 11:50:50 -05:00
Wilson Snyder a37866ee92 Support 'super'. 2020-11-26 11:06:59 -05:00
Wilson Snyder 60a1d25a96 Fix extern function member references. 2020-11-26 08:55:32 -05:00
Wilson Snyder ad21f2e850 Fix 'this' in extern functions. 2020-11-26 08:28:53 -05:00
Wilson Snyder f2d8e45d72 For performance, use unordered_set/map where possible. No functional change intended. 2020-11-25 20:57:30 -05:00
Wilson Snyder 085ef5fc05 Fix extern function var refs getting errors. 2020-11-25 20:05:44 -05:00
Wilson Snyder bf24fa9478 Fix access to non-overridden base class variable (#2654). 2020-11-24 22:46:02 -05:00
Wilson Snyder e1c45440fc Internals: Rename packagep(). No functional change. 2020-11-24 21:56:03 -05:00
Wilson Snyder fd21a41acd Internals: Minor cleanups before class fix (#2654). No functional change intended. 2020-11-24 21:28:26 -05:00
Wilson Snyder 35374f09b4 Add error on class extending itself 2020-11-24 18:15:49 -05:00
Wilson Snyder e85a2e860e Support 'with item.index'. 2020-11-23 23:18:58 -05:00
Wilson Snyder b6ded59c2b Internals: Use and enforce class final for ~5% performance boost. 2020-11-18 21:32:16 -05:00
Wilson Snyder c0888c1b0f Internals: Use newline instead of endl to avoid unneeded flush. 2020-11-18 21:03:23 -05:00
Wilson Snyder 1b0a48ea02 Internals: Use C++11 = default where obvious. No functional change intended. 2020-11-16 19:56:16 -05:00
Wilson Snyder f4ef4ad9f3 Internals: Favor std::array where easy. No functional change intended. 2020-11-15 16:21:26 -05:00
Wilson Snyder e74cc32f2d Add internal assertion that VarScopes properly formed. 2020-11-14 16:13:06 -05:00
Wilson Snyder 7eac788306 Add error on using :: with module 2020-11-12 19:45:26 -05:00
Wilson Snyder 79d33bf1ee Use C++11 for loops, from clang-migrate. No functional change intended 2020-11-10 22:10:38 -05:00
Wilson Snyder fc52fb9093 Fix arrays of modport interfaces (#2614). 2020-11-08 22:43:32 -05:00
Wilson Snyder cef7708f38 Internals: Fix missed access change. No functional change intended. 2020-11-08 22:02:35 -05:00