circt icon indicating copy to clipboard operation
circt copied to clipboard

[CalyxToFSM] Controller FSM outlining and instantiation

Open mortbopet opened this issue 2 years ago • 0 comments

#3595 introduced FSM materialization for the Calyx control program. In this, an FSM was materialized with top-level I/O corresponding to the go, done ports of the compiledGroups within the control program.

The final step in control schedule lowering is to outline the FSM into module scope and replace it with an fsm.hwinstance operation. When doing this, we need to define the I/O of the fsm.hwinstance operation:

  1. inputs will be group_done signals for the compiled groups
  2. outputs will be group_go signals to the compiled groups

The ideal place to do this is to modify the remove-groups pass by:

  1. Perform the conversion as it exists now but instead by using backedges for the group_go signals to each group, and recording the group_done signals for each group.
  2. outline the fsm.machine into module scope
  3. replace it with a fsm.hwinstance, with group_done operands sorted by the compiledGroups attribute.
  4. Replace the group_go backedges with the results of the fsm.hwinstance operation.

mortbopet avatar Jul 26 '22 07:07 mortbopet