Circuit IR Compilers and Tools

-calyx-compile-control: Generates latency-insensitive finite state machines to realize control. 

This pass performs a bottom-up traversal of the control program and does the following:

  1. For each control statement such as “calyx.seq”, create a new GroupOp to contain all the structure to realize the schedule.
  2. Implement the schedule by setting the constituent groups’ GoOp and DoneOp.
  3. Replace the control statement in the control program with the corresponding compilation group.

-calyx-go-insertion: Insert go signals into the guards of a group’s non-hole assignments 

This pass inserts the operation “calyx.group_go” into the guards of all assignments housed in the group, with the exception of the “calyx.group_done” terminator. For example,

Before: @Group1 {
  calyx.assign %in = %out1, %guard ? : i8
  %done = calyx.group_done %out2 : i1


// The `go` assignment takes on an undefined
// value until the Compile Control pass.
%undef = calyx.undef : i1
... @Group1 {
  %go = calyx.group_go %undef : i1

  %and = comb.and %guard, %go : i1
  calyx.assign %in = %out1, %and ? : i8

  %done = calyx.group_done %out2 : i1

-calyx-remove-groups: Inlines the groups in a Calyx component. 

This pass removes the Group interface from the Calyx program, and inlines all assignments. This is done in the following manner:

  1. Assign values to the ‘done’ signal of the component, corresponding with the top-level control group’s DoneOp. Add the ‘go’ signal of the component to all assignments.
  2. TODO(Calyx): If there are multiple writes to a signal, replace the reads with the disjunction.
  3. Remove all groups.