lakeroad
lakeroad copied to clipboard
Deduplicate sub-expressions/sub-circuits in design (antiunification?)
In my generals talk, I proposed deduplicating "instructions" from a hardware design using a set of rewrites:
The rewrites looked like, e.g.:
(binop ?op ?bw (apply (instr ?ast0 ?canonical-args0) ?args0) (apply (instr ?ast1 ?canonical-args1) ?args1))
=> (apply (instr (binop-ast ?op ?bw ?ast0 ?ast1) (canonicalize (concat ?args0 ?args1)))
(concat ?args0 ?args1))
(binop ?op ?bw ?left (apply (instr ?ast1 ?canonical-args1) ?args1))
=> (apply (instr (binop-ast ?op ?bw (hole ?bw) ?ast1) (canonicalize (concat (list ?left) ?args1)))
(concat (list ?left) ?args1))
(binop ?op ?bw (apply (instr ?ast0 ?canonical-args0) ?args0) ?right)
=> (apply (instr (binop-ast ?op ?bw ?ast0 (hole ?bw)) (canonicalize (concat ?args0 (list ?right))))
(concat ?args0 (list ?right)))
(binop ?op ?bw ?a ?b)
=> (apply (instr (binop-ast ?op ?bw (hole ?bw) (hole ?bw)) (canonicalize (list ?a ?b)))
(list ?a ?b))
This was around the same time as the Babble paper, which used a very similar idea of deduplicating "instructions" -- they called it Antiunification.
This issue tracks the incorporation of this idea into Lakeroad: whether or not we should do it, how it should be done, and other questions.