From: whitequark Date: Thu, 27 Aug 2020 13:03:15 +0000 (+0000) Subject: back.verilog: use `proc -nomux` if it is available. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b0d9b7dcb1a0a310a48f8361013881ae7882d138;p=nmigen.git back.verilog: use `proc -nomux` if it is available. Yosys offers no stability guarantees for individual `proc_*` passes, though so far it worked out fine. This commit changes the Verilog backend to use `proc -nomux` instead, which is guaranteed to have backwards-compatible behavior. Fixes #479. --- diff --git a/nmigen/back/verilog.py b/nmigen/back/verilog.py index 9f813d0..37e4158 100644 --- a/nmigen/back/verilog.py +++ b/nmigen/back/verilog.py @@ -13,15 +13,19 @@ def _convert_rtlil_text(rtlil_text, *, strip_internal_attrs=False, write_verilog script = [] script.append("read_ilang <= (0, 9, 3468): - # Yosys >=0.9+3468 (since commit f3d7e9a1) emits Verilog without a possible sim/synth - # mismatch, making $verilog_initial_trigger unnecessary. + if yosys_version >= (0, 9, 3527): + # Yosys >=0.9+3527 (since commit 656ee70f) supports the `-nomux` option for the `proc` + # script pass. Because the individual `proc_*` passes are not a stable interface, + # `proc -nomux` is used instead, if available. script.append("delete w:$verilog_initial_trigger") - script.append("proc_prune") - script.append("proc_init") - script.append("proc_arst") - script.append("proc_dff") - script.append("proc_clean") + script.append("proc -nomux") + else: + # On earlier versions, use individual `proc_*` passes; this is a known range of Yosys + # versions and we know it's compatible with what nMigen does. + script.append("proc_init") + script.append("proc_arst") + script.append("proc_dff") + script.append("proc_clean") script.append("memory_collect") if strip_internal_attrs: