-
Notifications
You must be signed in to change notification settings - Fork 28
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
Remove cover message in FIRRTL #53
base: main
Are you sure you want to change the base?
Conversation
@@ -1641,7 +1641,7 @@ wire pred: UInt<1> | |||
wire en: UInt<1> | |||
pred <= eq(X, Y) | |||
en <= Z_valid | |||
cover(clk, pred, en, "X equals Y when Z is valid") : optional_name | |||
cover(clk, pred, en) : optional_name |
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.
are these completely missing from the grammar at the end? should this PR add this (along with assert and assume) to formalize this?
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.
yes, I'm working on clear them up.
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 just found BNF doesn't include verification statements. I'll create another PR for it.
Thanks for chasing these and updating the spec / grammar! FWIW SFC emits cover message as a comment presently, at least the 1.5.3 I have locally. I have an outstanding PR changing MFC to do the same (user complained about it when moving to MFC), before noticing this PR and the discussion on the Chisel PR. Having useful text to explain/associate with a verification statement is useful, but the "optional name" can serve that purpose, at least mechanically (not as friendly to read when turned into a label). Regardless, there is a little utility to the field presently, but is that enough to warrant keeping it? Thoughts/preferences? |
Afaik, the Chisel frontend does not actually use the message field for
I think it was a mistake to make this a part of the op. Some sort of optional meta-data field (would have been an annotation, now with CIRCT, it should probably part of the IR) might be better. Most importantly, we should have a good use-case description and things should be consistent. |
I don't thing we can put a message string (with spaces, emojis) in the "optional name" . If we have users actively complaining that they are taking the time to write messages and they see it being dropped, it's something I'd want to keep in any user facing apis for cover, tbd how that is lowered. It's not the same as a printf... they are not asking that message to get printed out every time they hit the cover statement. Forcing it to be represented as a printf in the IR that we need to remove and turn into a comment seems convoluted. If we do have it as a string in the IR for cover, we need to be clear if it is the kind of string that can take in fields from data (like printf does) or just a static string. So I guess I am saying I am in favor of keeping in the spec as a string that can be lowered into a comment, unless optional name allows arbitrary characters in the string |
I think such a functionality can be useful, but it just seems like an arbitrary limitation that it would only work for |
Agreed! Agreed optional name seems a poor substitute, so short-term I'm in favor of keeping the message field (and lowering to comment) for that purpose. That said the spec could capture the meaning of this field for cover more explicitly, presently it is only explicit about asserts with behavior for cover/assume implied. Discussing/designing new verification operations, and perhaps a mechanism for attaching comments to operations, both seem like great tasks to pursue! Very much agree re:providing good interface to users in Chisel and aiming to not have cover be a one-off. As an aside, this sort of mechanism may be (ab?)used to try to specify SV attributes, FWIW... |
That is a IR design philosophy question. Personally I found it much easier to leave message printing and formatting support restricted to one statement (
an alternative could be to treat assertions as
|
I am of the opinion that we should leave in the cover message, rename it to "comment", disallow format strings in comments (it must be a pure string), and specify that FIRRTL compilers should lower this to a comment in the backend language target. If a comment is not possible/available, the message should be elided. As to whether or not anchored comments should be first-class, there's many ways of handling this:
|
It seems a first-class way to attach comments to declarations and statements would be helpful here and for other use cases (comments on wires and regs, for example). Until that appears, it probably makes sense to keep it on covers, but renamed appropriately to indicate it's actual meaning. |
This PR removes
message
field in cover, according to reply from @ekiwi:Basically, there is no
message
field in System Verilog Spec defined at 19.5 Defining coverage points, for both MFC and SFC, they are not usingmessage
here, and Chisel is always generating empty message for cover(see chipsalliance/chisel#2912).