-
Notifications
You must be signed in to change notification settings - Fork 298
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
[FIRRTL] Add has_been_reset intrinsic #5777
Conversation
Add the `circt.has_been_reset` FIRRTL intrinsic. More specifically: - Add the `firrtl::HasBeenResetIntrinsicOp` - Add support for the op in the FIRRTL visitor - Add support for the op in `LowerIntrinsics` - Lower the op to `verif::HasBeenResetOp`, inferring the sync/async-ness from the reset's FIRRTL type - Add tests for `LowerIntrinsics`, `LowerToHW`, and the canonicalizer - Add a firtool end-to-end test to check that this interacts properly with the `InferResets` pass
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.
While I can't fully confirm that the C++ and Tablegen are correct, they pass the smell test and the tests definitely LGTM
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!
@@ -12,6 +12,7 @@ | |||
#include "circt/Dialect/HW/HWDialect.h" | |||
#include "circt/Dialect/HW/HWTypes.h" | |||
#include "circt/Dialect/Verif/VerifDialect.h" | |||
#include "mlir/Interfaces/InferTypeOpInterface.h" |
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.
Why does adding a FIRRTL op require adding headers to other dialects? Are these missing from the FIRRTL places, or unrelated?
(They appear necessary, but haven't looked at why, do you remember/know?)
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 really don't get this part of TableGen. The key here is the include "mlir/Interfaces/InferTypeOpInterface.td"
line in VerifOps.td
. If you have an op with something like
let results = (outs I1:$result);
TableGen will only produce the implicit conversion from Op to Value and the builder function without the result TypeRange
if you have the InferTypeOpInterface.td
include further up in the TD file. If you comment out the include, the accessors and builders with inferred result type won't be generated. Even if your op doesn't implement or inherit from that InferTypeOpInterface
at all. All that's needed is the include. Blows my mind.
So what ends up happening is I have something like that I1
result and expect it to work nicely, and won't realize I'm missing that include until I actually try to use that specific builder; which likely wasn't the case in the original PR that just added the op 🙈
Co-authored-by: Will Dietz <will.dietz@sifive.com>
Add the
circt.has_been_reset
FIRRTL intrinsic. More specifically:firrtl::HasBeenResetIntrinsicOp
LowerIntrinsics
verif::HasBeenResetOp
, inferring the sync/async-ness from the reset's FIRRTL typeLowerIntrinsics
,LowerToHW
, and the canonicalizerInferResets
pass