From: whitequark Date: Mon, 28 Oct 2019 10:11:41 +0000 (+0000) Subject: back.verilog: remove $verilog_initial_trigger after proc_prune. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff03f989a2c2e43b9bbe07f71c5a733bce98c427;p=nmigen.git back.verilog: remove $verilog_initial_trigger after proc_prune. $verilog_initial_trigger was introduced to work around Verilog simulation semantics issues with `always @*` statements that only have constants on RHS and in conditions. Unfortunately, it breaks Verilator. Since the combination of proc_prune and proc_clean passes eliminates all such statements, it can be simply removed when both of these passes are available, currently on Yosys master. After Yosys 0.10 is released, we can get rid of $verilog_initial_trigger entirely. --- diff --git a/nmigen/back/rtlil.py b/nmigen/back/rtlil.py index accaeb0..5cd9f97 100644 --- a/nmigen/back/rtlil.py +++ b/nmigen/back/rtlil.py @@ -899,6 +899,14 @@ def _convert_fragment(builder, fragment, name_map, hierarchy): # by looking for any signals on RHS. If there aren't any, we add some logic # whose only purpose is to trigger Verilog simulators when it converts # through RTLIL and to Verilog, by populating the sensitivity list. + # + # Unfortunately, while this workaround allows true (event-driven) Verilog + # simulators to work properly, and is universally ignored by synthesizers, + # Verilator rejects it. + # + # Running the Yosys proc_prune pass converts such pathological `always @*` + # blocks to `assign` statements, so this workaround can be removed completely + # once support for Yosys 0.9 is dropped. if not stmt_compiler._has_rhs: if verilog_trigger is None: verilog_trigger = \ diff --git a/nmigen/back/verilog.py b/nmigen/back/verilog.py index 8faf58a..eb98a34 100644 --- a/nmigen/back/verilog.py +++ b/nmigen/back/verilog.py @@ -39,6 +39,7 @@ def _convert_rtlil_text(rtlil_text, *, strip_internal_attrs=False, write_verilog read_ilang <