In CIRCT, MLIR IR is lowered to handshake dialect to show the data path of synthesized circuits at abstraction level. Branch-like and merge-like ops are used to present the control flow the code.
However, there are some limits in using existing ops to describe certain code patterns like switch
(arbitration in hardware) and floating inputs. Here I propose two new ops for handshake dialect:
- DeMux op
Existing conditional branch ops in handshake can only have two results. The data is forwarded to the first output if the condition is true (1), otherwise it is forwarded to the second output.
DeMux is common in hardware designs like arbitration logic. It also corresponds to switch
in high-level language. The behavior is that for a given N output, the data is forwarded to the kth output if the select input has a value of k (k <= N). This is different from the behavior of conditional branch ops.
- RSink op
The behavior of RSink op is opposite to the Source op. It can be considered as a dead signal that never produce any invalid signal. It can be used to model floating input while satisfies the condition where each value has exactly one use in Handshake dialect.
I plan to make a patch for that, but I am not sure if it is the right thing to do. It would be nice to have any comments from others. Thanks!