-
Notifications
You must be signed in to change notification settings - Fork 277
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
[LowerToHW] Implement MuxCell intrinsics lowering #5458
Conversation
66997a3
to
4b1b604
Compare
4b1b604
to
650c7bb
Compare
module Mux2Cell: | ||
input cond: UInt<1> | ||
input low: UInt<1> | ||
output out: UInt<1>[2] | ||
wire w: UInt<1> | ||
inst mux2 of Mux2 | ||
inst ext of Val | ||
w <= ext.v | ||
mux2.sel <= xor(cond, UInt<1>(1)) | ||
mux2.high <= w | ||
mux2.low <= low | ||
out[0] <= mux2.out | ||
inst mux2_1 of Mux2 | ||
mux2_1.sel <= xor(cond, UInt<1>(1)) | ||
mux2_1.high <= ext.v | ||
mux2_1.low <= low | ||
out[1] <= mux2_1.out |
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 a bit complicated but this is an example that produces incorrect results if CSE prevention was not added.
This is the output verilog when we didn't do CSE prevention.
|
387213f
to
1d5dddb
Compare
I changed to use hw.wires and inner symbols to block optimizations so that we can keep AST structures. I'm going to merge the PR but post commit review is welcomed. |
OrderedOutputOp might help keep things in the right order. (or similar) |
This commit deprecates addMuxPragma flag in LowerToHW and implements lowering of MuxCell intrinsics. MuxCell intrinsics are lowered into a wire declaration, an assignment with infer_mux_override pragma and a value with map_to_mux pragma. Operands are probed to hw.wire with inner symbols to prevent optimizations from destructing AST structures.
This commit deprecates
addMuxPragma
flag in LowerToHW and implements lowering of MuxCell intrinsics.MuxCell intrinsics are lowered into a wire declaration, an assignment with
infer_mux_override
pragma and a value withmap_to_mux
pragma. Operands are probed to hw.wire with inner symbols to prevent optimizations from destructing AST structures.