Expand description
Passes for the Calyx compiler.
Structs
Perform serval canonicalizations on the program.
Given a LiveRangeAnalysis that specifies the “share” and “state_share” cells alive at each group, minimizes the cells used for each component.
Adds assignments from a components clk
port to every
component that contains an input clk
port.
Collapses and de-nests control constructs.
Propagate unconditional reads and writes from wires.
Compiles away all ir::Empty
statements into an
ir::Enable
.
Compiles ir::Invoke
statements into an ir::Enable
that runs the invoked component.
Inlines all sub-components marked with the @inline
attribute.
Cannot inline components when they:
Wires up the go
and done
holes for Calyx programs with a single
enable to the component go
and done
ports.
Removes unused cells from components.
Removes unused groups and combinational groups from components. A group is considered in use when it shows up in an ir::Enable. A combinational group is considered in use when it is a part of an ir::If or ir::While or ir::Invoke.
Externalize input/output ports for cells marked with the @external(1)
attribute.
The ports of these cells are exposed through the ports of the parent
component.
Add the group’s go
signal into the guards of all non-hole assignments
of this group.
Transform groups that are structurally invoking components into equivalent ir::Invoke statements.
Transforms a group into a seq of 2 smaller groups, if possible. Currently, in order for a group to be transformed must
Removes all groups and inlines reads and writes from holes.
This pass checks if components are (state) shareable. Here is the process it goes through: if a component uses any ref cells, or non-shareable cells then it is automatically not shareable. Otherwise, check if each read of a stateful cell is guaranteed to be dominated by a write to the same cell– we check this by building a domination map. If so, component is state shareable.
Infer “static” annotation for groups and add “@static” annotation when (conservatively) possible.
Lowers guards into a purely structural representation. After this pass, all guards are guaranteed to be either ir::Guard::True or ir::Guard::Port.
Merge assignments of the form with the same (dst_port, src_port) pairs.
under a par control block, if multiple groups have the same static attribute, then merge them together.
Pass to check for common errors such as missing assignments to done
holes
of groups.
Transforms all par
into seq
. Uses analysis::ControlOrder to get a
sequentialization of par
such that the program still computes the same
value. When there is no such sequentialization, errors out.
Unsharing registers reduces the amount of multiplexers used in the final design, trading them off for more memory.
Transforms combinational groups, which have a constant done condition, into proper groups by registering the values read from the ports of cells used within the combinational group.
Removes NODE_ID, BEGIN_ID, and END_ID from each control statement
Adds assignments from a components reset
port to every
component that contains an input reset
port.
Simplify guards using BDDs and other heuristic tricks. Not used in the default compilation pipeline.
Transforms a par of seq blocks into a seq of par blocks. It will sometimes only apply this transformation to a subset of seq blocks in the par block. Regardless, this transformation should never increase the number of cycles the par block takes to execute.
Pass to check common synthesis issues.
Core lowering pass. Compiles away the control programs in components into purely structural code using an finite-state machine (FSM).
Lowering pass that generates latency-sensitive FSMs when control sub-programs have @static
annotations. The pass works opportunisitically and attempts to compile all nested static
control programs nested within the overall program, replacing them with groups that implement
the correct transitions.
Fully unroll all while
loops with a given @bound
.
Pass to check if the program is well-formed.
Alternate hole inliner that removes groups and group holes by instantiating wires that hold the value for each signal.