-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Moore] Introduce a new operation - netOp for net declaration #6884
Conversation
The netOp is mainly used for declaring NetKind elements in the module. The NetKind has: |
Thanks for helping code review in advance 😃 ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have limited knowledge for Moore/Slang but this looks good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with all the subtleties of SystemVerilog, but here are some of my thoughts/observations.
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Thanks for pushing on this 👍 Added a few comments.
Mark |
case slang::ast::NetType::Interconnect: | ||
case slang::ast::NetType::Unknown: | ||
case slang::ast::NetType::UserDefined: | ||
break; | ||
} | ||
llvm_unreachable("unsupported net kind"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm_unreachable
is weird in that it doesn't really print an error message in non-debug/non-assertion builds. It will just hint the compiler at this branch being unreachable in release builds. However, you do want to report an error to the user here. Something like the following:
static FailureOr<moore::NetKind> convertNetKind(slang::ast::NetType::NetKind kind, Location loc) {
switch (kind) {
// ...
case slang::ast::NetType::Interconnect:
case slang::ast::NetType::Unknown:
case slang::ast::NetType::UserDefined:
return mlir::emitError(loc, "unsupported net type `") << slang::ast::toString(kind) << "`";
}
}
3facd95
to
52087a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks 🥳
Thanks a lot !!! ❤️ The improved module & instance will be ready soon. |
NetOp is for variable declaration. Net Types defines different types of net connections in SV. There are twelve built-in net types defined `supply0`, `supply1`, `tri`, `triand`, `trior`, `trireg`, `tri0`, `tri1`, `uwire`, `wire`, `wand`, `wor`, and three special net types: `interconnect`, `userdefined`, `unknown`. The special ones are marked as unsupported because we have no plan to support them currently. Corresponding test cases have been added to the parser/print and ImportVerilog pass tests. Add two expected failed netkind test cases - `interconnect` & `user-defined`. Co-authored-by: Fabian Schuiki <fabian@schuiki.ch> Co-authored-by: Hailong Sun <hailong.sun@terapines.com>
d8744ed
to
dcb5db0
Compare
dcb5db0
to
ed73545
Compare
According to the IEEE 1800-2017 std, we design netOp for net declaration. Various NetKind are supported to generate in the net declaration:
Supply0
Supply1
Wire
Uwire
WAnd
WOr
Tri0
Tri1
Tri
TriAnd
TriOr
TriReg
The interconnect net declaration and user-defined net types are not supported yet.