circt
circt copied to clipboard
[LowerFirReg] Reimplement the mux reachability analysis
The PR implements a new heuristic to determine if a Mux is reachable from a FirReg.
In general an operation is reachable from a register if its in the fanout of the register.
For FirReg lowering, an if/else structure is required for proper enable inference, if a mux is within the fanout from the register.
The fanout path can only consist of MuxOp, ArrayGetOp or ArrayCreateOp.
Thus any ops other than MuxOp, ArrayGetOp or ArrayCreateOp block the reachability.
The analysis is built lazily when its queried and the result is cached to avoid redundant traversal of the IR.