-
Notifications
You must be signed in to change notification settings - Fork 334
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
[MooreToCore] Add nested moore.conditional support #8125
Conversation
if (operation->hasTrait<OpTrait::HasRecursiveMemoryEffects>()) | ||
return WalkResult::advance(); |
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 one!
%5 = moore.conditional %4 : l1 -> l2 { | ||
%6 = moore.read %b_1 : <l1> | ||
%7 = moore.conditional %6 : l1 -> l2 { | ||
moore.yield %2 : l2 | ||
} { | ||
moore.yield %1 : l2 | ||
} | ||
moore.yield %7 : l2 | ||
} { | ||
moore.yield %0 : l2 | ||
} |
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.
This test uses quite a few other supporting operations (module, nets, variables, procedure, blocking assigns) to test the conditional lowering. Would it be possible to move just the conditionals and the corresponding checks into a func.func
, similar to @Conversions
just below? It might be possible to even move it inside of @Conversions
. That would make the test less brittle if any of the module and procedure lowerings change, which are unrelated to the conditionals.
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.
Hi! I simplified test and rebased branch. Could you check it?
c7a54ae
to
ca52474
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.
This looks great! Thanks for tackling this 👍
This code adds correct lowering for nested ternary operators like this: ```verilog module Mod(input a, input b, output logic [1:0] c); always_comb c = a ? b ? 2'd0 : 2'd1 : 2'd2; endmodule ```
ce42131
to
982e335
Compare
If there are no remarks, could you merge it? I haven't commit access. |
Sure thing, thanks! |
Hi! This code adds correct lowering for nested ternary operators like this: