hdl._ir: Handle duplicate fragment names.

This commit is contained in:
Wanda 2024-02-29 20:57:23 +01:00 committed by Catherine
parent 047b64d02c
commit 76a7dc396c
2 changed files with 16 additions and 3 deletions

View file

@ -1030,6 +1030,18 @@ class NamesTestCase(FHDLTestCase):
a_f: ("top", "a$U$0")
})
def test_assign_names_to_fragments_duplicate(self):
f = Fragment()
f.add_subfragment(a1_f := Fragment(), name="a")
f.add_subfragment(a2_f := Fragment(), name="a")
design = Design(f, ports=[], hierarchy=("top",))
self.assertEqual(design.fragment_names, {
f: ("top",),
a1_f: ("top", "a"),
a2_f: ("top", "a$U$1"),
})
class ElaboratesTo(Elaboratable):
def __init__(self, lower):