hdl.ir: lower domains before resolving hierarchy conflicts.

Otherwise, two subfragments with the same local clock domain would
not be able to drive its clock or reset signals. This can be easily
hit if using two ResetSynchronizers in one module.

Fixes #265.
This commit is contained in:
whitequark 2019-11-07 08:20:27 +00:00
parent e9887780af
commit 9749c70730
2 changed files with 15 additions and 1 deletions

View file

@ -540,8 +540,8 @@ class Fragment:
fragment = SampleLowerer()(self)
new_domains = fragment._propagate_domains(missing_domain)
fragment._resolve_hierarchy_conflicts()
fragment = DomainLowerer()(fragment)
fragment._resolve_hierarchy_conflicts()
if ports is None:
fragment._propagate_ports(ports=(), all_undef_as_ports=True)
else:

View file

@ -642,6 +642,20 @@ class FragmentHierarchyConflictTestCase(FHDLTestCase):
self.f1._resolve_hierarchy_conflicts(mode="silent")
self.assertEqual(self.f1.subfragments, [])
def test_no_conflict_local_domains(self):
f1 = Fragment()
cd1 = ClockDomain("d", local=True)
f1.add_domains(cd1)
f1.add_driver(ClockSignal("d"))
f2 = Fragment()
cd2 = ClockDomain("d", local=True)
f2.add_domains(cd2)
f2.add_driver(ClockSignal("d"))
f3 = Fragment()
f3.add_subfragment(f1)
f3.add_subfragment(f2)
f3.prepare()
class InstanceTestCase(FHDLTestCase):
def test_construct(self):