-
Notifications
You must be signed in to change notification settings - Fork 347
[ExportVerilog] Add LTL and Verif dialect support #5256
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
Conversation
238451a
to
82d7590
Compare
717a63c
to
845b24d
Compare
82d7590
to
580a15a
Compare
Yes this would be great 👍 . |
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.
Generally LGTM! Focused on the printing.
Added some suggestions, be sure to drop all the debug prints, the error diagnostics seem worth addressing as well, especially since encountering in test.
c1dad90
to
1f22d7e
Compare
845b24d
to
3e7ed1d
Compare
8000 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.
Nice! Perhaps file an issue to remove assert, assume, and cover from SV.
Looks awesome, great work! Maybe in the future we might want to introduce a variable declaration into LTL and spill multiply used expressions. Since currently all the expressions are expanded, it's easy to construct exponential example. Though I guess it's a bit artificial but it could be a problem when we started using LTL heavily, e.g: hw.module @Sequences(%a: i1) {
%0 = ltl.concat %a, %a : i1, i1
%1 = ltl.concat %0, %0 : !ltl.sequence, !ltl.sequence
%2 = ltl.concat %1, %1 : !ltl.sequence, !ltl.sequence
%3 = ltl.concat %2, %2 : !ltl.sequence, !ltl.sequence
%4 = ltl.concat %3, %3 : !ltl.sequence, !ltl.sequence
%5 = ltl.concat %4, %4 : !ltl.sequence, !ltl.sequence
verif.assert %5 : !ltl.sequence
hw.output
} current output: assert property (a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0
a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0
a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0
a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0
a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0 a ##0
a ##0 a ##0 a ##0 a); |
3e7ed1d
to
e62a2b3
Compare
1f22d7e
to
3b0036e
Compare
Haha nice one @uenoku! I hadn't thought of passing the same value multiple times to concat to create an exponential blow-up in the output. You're totally right, we should introduce a property and sequence declaration op that can be used to move the definitions behind a name. Then Added #5286 to track this. |
Add support for emitting the assert, assume, and cover ops from the `verif` dialect, and property and sequence expressions from the `ltl` dialect directly in ExportVerilog. In the future we may want to build up AST-like ops in the SV dialect for this, simplify ExportVerilog, and add a lowering from Verif/LTL to SV separately. Doing so would allow us to do more involved conversions and leverage more syntactic sugar upon emission, and would declutter ExportVerilog. In their current form the LTL and Verif dialects are simple enough to emit directly though, so this is what this commit does for now. The new `verif` assert-like ops can be used either in a procedural region, where they will emit as immediate `assert(x)` when possible, or a graph region like a module, where they will emit as `assert property`. We'll be able to add lowering options later to have more control over which flavor of assertions we want. The properties and sequences in Verilog form a separate kind of expression tree that doesn't really mix with boolean expressions all that much. Therefore, this commit introduces a new `PropertyEmitter` inspired by the `ExprEmitter` which handles property and sequence expression trees.
3b0036e
to
fe3224d
Compare
Add support for emitting the assert, assume, and cover ops from the
verif
dialect, and property and sequence expressions from theltl
dialect directly in ExportVerilog. In the future we may want to build up AST-like ops in the SV dialect for this, simplify ExportVerilog, and add a lowering from Verif/LTL to SV separately. Doing so would allow us to do more involved conversions and leverage more syntactic sugar upon emission, and would declutter ExportVerilog. In their current form the LTL and Verif dialects are simple enough to emit directly though, so this is what this commit does for now.The new
verif
assert-like ops can be used either in a procedural region, where they will emit as immediateassert(x)
when possible, or a graph region like a module, where they will emit asassert property
. We'll be able to add lowering options later to have more control over which flavor of assertions we want.The properties and sequences in Verilog form a separate kind of expression tree that doesn't really mix with boolean expressions all that much. Therefore, this commit introduces a new
PropertyEmitter
inspired by theExprEmitter
which handles property and sequence expression trees.