Description
dead-assign-removal
gets rid of assignments to combinational cells that are never read from. The current pass only works for normal group
s. Let's extend it to work on static groups. #1653 documents one particular effort that didn't work out.
The specific program is that static par
, unlike par
, allow groups to synchronize using timing information, making the following program valid:
import "primitives/compile.futil";
component main() -> () {
cells {
add = std_add(32);
r = std_reg(32);
}
wires {
static<1> group do_add {
add.left = 32'd1;
add.right = 32'd0;
}
static<1> group do_write {
r.in = add.out;
r.write_en = 1'd1;
}
}
control {
static par { do_write; do_add; }
}
}
The dynamic version of this program is not valid.
Implementation Approach
Instead of focusing only on the groups, we need to traverse the control program and track all the combinational cells that are read from any group in a particular par
context. Once that is done, we can go and remove assignments that are not read from any static group
in any thread context. The challenging part is doing this in one pass: threads can create complex cascades or combinational chains where they assign to combinational cells. For example:
static par {
do_add; // assigns to add which uses the output from sub
do_sub; // assigns to sub which uses the output from lt
do_lt; // assigns to lt which uses the output from register
}