calyx
calyx copied to clipboard
Synthesis Papercut pass only-read/write checks for `ref` memories
trafficstars
The Synthesis Papercut pass incorrectly flags reference memories that are only read or written to as needing @external flags. This happens because the pass does not recognize that reference memories must have external memories associated with them in some other components. Since reading/writing to ref memories has the same effect as reading/writing to @external memories, we don't need to
Add @external to cell to turn this into an interface memory.
As an illustrating example, the following example should be valid:
component main() -> () {
cells {
@external(1) x = comb_mem_d1(32, 4, 3);
st = store();
}
wires {}
control {
invoke store[ext_mem0 = x]()();
}
}
component store(@clk clk: 1, @reset reset: 1, @go go: 1) -> (@done done: 1) {
cells {
ref ext_mem0 = comb_mem_d1(32, 4, 3)
std_slice_0 = std_slice(32, 3);
load_0_reg = std_reg(32);
ret_arg0_reg = std_reg(32);
}
wires {
out0 = ret_arg0_reg.out;
group bb0_0 {
...
ext_mem0.addr0 = std_slice_0.out;
ext_mem0.write_data = load_0_reg.out;
...
}
group ret_assign_0 { ... }
}
control {
seq {
bb0_0;
ret_assign_0;
}
}
}