-
Notifications
You must be signed in to change notification settings - Fork 347
[FIRRTL] DropConst pass #5152
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] DropConst pass #5152
Conversation
4941449
to
54c0555
Compare
8ec32fd
to
07766f4
Compare
084edfe
to
029a445
Compare
07766f4
to
2b34d86
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.
If you move the when op checking to a verifier, then you could probably re-write this very generically:
op->walk([](op){
if (op.isa<ConstCast>())
....
for (region : op.getRegion)
for (block : region.getBlocks)
for (blarg : block.getArguments)
blarg.setType(updateType(blarg.getType));
for (result : op.getResult())
result.setType(updateType(result.getType());
We need to start thinking about how enumeration types and const are going to work.
313216c
to
3e54136
Compare
65ec10d
to
9649220
10000
Compare
a0839b7
to
9649220
Compare
b9304aa
to
92cdb80
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.
Didn't review this as closely as before. I think you can merge this, or if you want to increase your commit count, split it up into 3 commits for DropConst pass, const drop type changes + SubAccess::inferReturnType, connect verifier.
Do we properly handle the error detection in this case?
module Foo:
input i : UInt<4>
output c : const UInt<8>[16]
; It is an error to use a non-const index to drive a value to a const
c[i] <= UInt<8>(10)
Would be nice if we didn't walk the subaccess chain twice in the connect verifier, but we can iterate on it. We have also talked about moving the flow verification on to the module, as it might be faster to do it as a dataflow pass. We could do something similar with the const correctness verification.
I believe these tests cover the subaccess cases: circt/test/Dialect/FIRRTL/connect-errors.mlir Line 614 in 71ed710
circt/test/Dialect/FIRRTL/connect-errors.mlir Line 626 in 71ed710
|
Updated to disallow any assignment to a subaccess that drops const |
Builds on #5151.
Added DropConst pass that checks const usage in when blocks, then drops all
const modifiers from types.