-
Notifications
You must be signed in to change notification settings - Fork 305
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
Fix temporal code motion #7959
base: main
Are you sure you want to change the base?
Fix temporal code motion #7959
Conversation
This commit fixes the pass in some cases where llhd.drv value was created in the same block. The case can be the result of simple verilog code. For example: module Mod(input a, input clk, output logic b); always @(posedge clk) begin b <= ~a; end endmodule Bug can be reproduced by command: circt-verilog example.sv | circt-opt --llhd-temporal-code-motion Signed-off-by: Andrey Vyazovtsev <[email protected]>
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 a lot for finding and fixing this issue!
If you run the llhd-early-code-motion
pass before temporal code motion, this will not fail. I was thinking about merging the early code motion and temporal code motion passes into an llhd-simplify-processes
pass. Maybe we should do that instead of repeating some of its logic here. It should already properly handle block arguments and CFG loops. WDYT?
auto *op = arg.getDefiningOp(); | ||
assert(op && "Using block argument as llhd.drv value is unexpected"); |
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 assumes that passes like block-argument-to-mux
are called beforehand. But the pass shouldn't crash if that's not the case, i.e., this should fail with a proper error message or be supported.
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 was thinking about merging
Can I try to implement this? Should old passes be deprecated or removed? Should corresponding files be merged or can we just call passes successively in third file?
That looks it strange but two days ago I tried to use the pass before
I agree with you. It's unclear that |
I think that I was confused due to #7963 issue. The PR may be closed. |
This commit fixes the pass in some cases where llhd.drv value was created
in the same block. The case can be the result of simple verilog code.
For example:
Bug can be reproduced by command:
circt-verilog example.sv | circt-opt --llhd-temporal-code-motion