[Libre-soc-dev] adding PartitionedSignal support to nmigen's If/Switch/Case

Jacob Lifshay programmerjake at gmail.com
Tue Sep 21 01:36:04 BST 2021


from what I can see, nmigen threads the If and Switch/Case signals all the
way through the IR and ends up leaving them to yosys's process_* passes to
translate to logic -- adding support for new types will be a major job.

>From what I see, we have several options available:
1. take the do-it-ourselves approach of having nmigen If, Switch, and Case
all just defer to PartitionedSignal methods, this requires reimplementing
inside PartitionedSignal what is currently a major portion of nmigen and
basically all of yosys's process logic. I'd estimate 2-3 months full-time
work just for the implementation ignoring formal proofs with minimal
modifications to nmigen and no modifications to yosys. This is probably the
option lkcl was originally thinking of, but I think he underestimated its
difficulty.

2. figure out how to thread PartitionedSignal through nmigen and yosys,
this will require easily >4mo work and seems highly likely to be rejected
by nmigen and yosys upstreams.

3. (my preference):
write our code to use Mux instead of If/Switch/Case when dealing with
PartitionedSignal; this will reduce readability of our code, but will be
waay easier to do. This means we decide If/Switch/Case is not worth the
trouble and close those bugs as won't fix and reallocate their budget where
it will be more worthwhile.

Jacob


More information about the Libre-soc-dev mailing list