Open
Description
Just putting a bookmark down for an interesting use case that has a potentially cute solution. We have already have:
if_
, which generates a Calyxif
with a port but without a comb group.if_with
, which very neatly generates a Calyxif
with a port and a comb group. It takes as input a cell and comb group, and usescell.out
as theif
’s port. This cell and comb group tuple is generated via a different set of helpers, e.g.eq_use
returns an eq cell and a comb group that performs an equality check using that cell. It is nice that we can then just pass this tuple toif_with
.static_if
, which generates a Calyxstatic if
with a port but without a comb group.
static_if_with
is not what you think it is: static if
in Calyx should have a port but should not have a comb group: those are disallowed in a static domain. Rather, the following should happen:
The command static_if_with(CellAndGroup, IfBody, ElseBody)
, should be processed by:
- Snapping apart the
CellAndGroup
intocell
andgroup
. - Putting all of
group
's assignments into the component’s continuous assignment stanza. - Turning the command into
static_if(cell.out, IfBody, ElseBody)
Originally posted by @anshumanmohan in #1783 (comment)