-
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
[FIRRTLToHW] Add missing twoState attributes #5257
Conversation
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.
Thanks, 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.
Thanks!
auto allOnes = builder.create<hw::ConstantOp>(loc, value.getType(), -1); | ||
return builder.createOrFold<XorOp>(loc, value, allOnes, false); | ||
return builder.createOrFold<XorOp>(loc, value, allOnes, twoState); |
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.
It saddens me that I had to check the Verilog spec to verify not and xor had the same truth table for 'x and 'z. (Tables 11-13 and 11-15).
Assuming lowerElementwiseLogicalOp is only used for logical ops.
Sorry for the iteration, but I noticed that setting the attribute after (potential) folding is not a great idea and also uneccessarily complicated at that point. |
I think just waiting on clang-format cleanliness. |
I'm slightly confused about the problem. The clang-format error occurs in a file that I did not change (FIRRTLTypes.cpp) and has already been fixed in #5153. Should I rebase the PR? |
FIRRTL is specified to be strictly two-state, thus, after lowering, all relevant comb operations should carry the
twoState
attribute. This PR picks up a few instances where it was missing.I'm currently working on the CombFolds to ensure they retain n-state behaviour for Verilog and/or VHDL if the attribute is missing (thanks @darthscsi for enduring my questions during last week's meeting). I'd be happy to get some early feedback on my changes to make sure I'm on the right track: https://github.com/fzi-hielscher/circt/tree/nuke-nstate-opts