hdl._ir: raise an error when an elaboratable is duplicated in hierarchy.

Fixes #1194.
This commit is contained in:
Wanda 2024-04-03 12:02:32 +02:00 committed by Catherine
parent 2cf9bbf306
commit 466536efcf
3 changed files with 29 additions and 2 deletions

View file

@ -77,6 +77,18 @@ class FragmentDriversTestCase(FHDLTestCase):
self.assertEqual(list(f.iter_sync()), [])
class DuplicateElaboratableTestCase(FHDLTestCase):
def test_duplicate(self):
sub = Module()
m = Module()
m.submodules.a = sub
m.submodules.b = sub
with self.assertRaisesRegex(DuplicateElaboratable,
r"^Elaboratable .* is included twice in the hierarchy, as "
r"top\.a and top\.b$"):
Fragment.get(m, None).prepare()
class FragmentPortsTestCase(FHDLTestCase):
def setUp(self):
self.s1 = Signal()