Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: amaranth-lang/amaranth
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6d9852506fb2
Choose a base ref
...
head repository: amaranth-lang/amaranth
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 12beda6e5b1d
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 26, 2020

  1. back.verilog: omit Verilog initial trigger only if Yosys adds it.

    Verilog has an edge case where an `always @*` process, which is used
    to describe a combinatorial function procedurally, may not execute
    at time zero because none of the signals in its implicit sensitivity
    list change, i.e. when the process doesn't read any signals. This
    causes the wires driven by the process to stay undefined.
    
    The workaround to this problem (assuming SystemVerilog `always_comb`
    is not available) is to introduce a dummy signal that changes only
    at time zero and is optimized out during synthesis. nMigen has had
    its own workaround, `$verilog_initial_trigger`, for a while. However,
    `proc_prune`, while increasing readability, pulls references to this
    signal out of the process. Because of this, a similar workaround was
    implemented in Yosys' `write_verilog` itself.
    
    This commit ensures we use our workaround on versions of Yosys
    without the updated `write_verilog`, and Yosys' workaround on later
    versions.
    
    Fixes #418.
    whitequark committed Aug 26, 2020
    Copy the full SHA
    12beda6 View commit details
Showing with 3 additions and 2 deletions.
  1. +3 −2 nmigen/back/verilog.py
5 changes: 3 additions & 2 deletions nmigen/back/verilog.py
Original file line number Diff line number Diff line change
@@ -13,8 +13,9 @@ def _convert_rtlil_text(rtlil_text, *, strip_internal_attrs=False, write_verilog
script = []
script.append("read_ilang <<rtlil\n{}\nrtlil".format(rtlil_text))

if yosys_version >= (0, 9, 231):
# Yosys 0.9 release has buggy proc_prune.
if yosys_version >= (0, 9, 3468):
# Yosys >=0.9+3468 (since commit f3d7e9a1) emits Verilog without a possible sim/synth
# mismatch, making $verilog_initial_trigger unnecessary.
script.append("delete w:$verilog_initial_trigger")
script.append("proc_prune")
script.append("proc_init")