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: 6fd7cbad0d6c
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: cce6b8687bd0
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Feb 1, 2020

  1. build.plat: align pipeline with Fragment.prepare().

    Since commit 7257c20, platform code calls create_missing_domains()
    before _propagate_domains_up() (as a part of prepare() call). Since
    commit a7be3b4, without a platform, create_missing_domains() is
    calle after _propagate_domains_up(); because of that, it adds
    the missing domain to the fragment. When platform code then calls
    prepare() again, this causes an assertion failure.
    
    The true intent behind the platform code being written this way is
    that it *overrides* a part of prepare()'s mechanism. Because it was
    not changed when prepare() was modified in 7257c20, the override,
    which happened to work by coincidence, stopped working. This is
    now fixed by inlining the relevant parts of Fragment.prepare() into
    Platform.prepare().
    
    This is not a great solution, but given the amount of breakage this
    causes (no platform-using code works), it is acceptable for now.
    
    Fixes #307.
    whitequark committed Feb 1, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    thockin Tim Hockin
    Copy the full SHA
    cce6b86 View commit details
Showing with 8 additions and 5 deletions.
  1. +5 −2 nmigen/build/plat.py
  2. +3 −3 nmigen/hdl/ir.py
7 changes: 5 additions & 2 deletions nmigen/build/plat.py
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
from .. import __version__
from .._toolchain import *
from ..hdl import *
from ..hdl.xfrm import SampleLowerer, DomainLowerer
from ..lib.cdc import ResetSynchronizer
from ..back import rtlil, verilog
from .res import *
@@ -115,7 +116,9 @@ def prepare(self, elaboratable, name="top", **kwargs):
self._prepared = True

fragment = Fragment.get(elaboratable, self)
fragment.create_missing_domains(self.create_missing_domain, platform=self)
fragment = SampleLowerer()(fragment)
fragment._propagate_domains(self.create_missing_domain, platform=self)
fragment = DomainLowerer()(fragment)

def add_pin_fragment(pin, pin_fragment):
pin_fragment = Fragment.get(pin_fragment, self)
@@ -144,7 +147,7 @@ def add_pin_fragment(pin, pin_fragment):
add_pin_fragment(pin,
self.get_diff_input_output(pin, p_port, n_port, attrs, invert))

fragment = fragment.prepare(ports=self.iter_ports(), missing_domain=lambda name: None)
fragment._propagate_ports(ports=self.iter_ports(), all_undef_as_ports=False)
return self.toolchain_prepare(fragment, name, **kwargs)

@abstractmethod
6 changes: 3 additions & 3 deletions nmigen/hdl/ir.py
Original file line number Diff line number Diff line change
@@ -343,7 +343,7 @@ def _propagate_domains_down(self):

subfrag._propagate_domains_down()

def create_missing_domains(self, missing_domain, *, platform=None):
def _create_missing_domains(self, missing_domain, *, platform=None):
from .xfrm import DomainCollector

collector = DomainCollector()
@@ -373,11 +373,11 @@ def create_missing_domains(self, missing_domain, *, platform=None):
self.add_domains(new_fragment.domains.values())
return new_domains

def _propagate_domains(self, missing_domain):
def _propagate_domains(self, missing_domain, *, platform=None):
self._propagate_domains_up()
self._propagate_domains_down()
self._resolve_hierarchy_conflicts()
new_domains = self.create_missing_domains(missing_domain)
new_domains = self._create_missing_domains(missing_domain, platform=platform)
self._propagate_domains_down()
return new_domains