back.rtlil: give predictable names to anonymous subfragments.

This is required for applying constraints to clocks in anonymous
subfragments in build.plat.
This commit is contained in:
whitequark 2019-09-23 12:48:02 +00:00
parent fd625619f1
commit 7777b7b98c

View file

@ -13,9 +13,16 @@ __all__ = ["convert", "convert_fragment"]
class _Namer:
def __init__(self):
super().__init__()
self._anon = 0
self._index = 0
self._names = set()
def anonymous(self):
name = "U$${}".format(self._anon)
assert name not in self._names
self._anon += 1
return name
def _make_name(self, name, local):
if name is None:
self._index += 1
@ -772,6 +779,9 @@ def _convert_fragment(builder, fragment, name_map, hierarchy):
if not subfragment.ports:
continue
if sub_name is None:
sub_name = module.anonymous()
sub_params = OrderedDict()
if hasattr(subfragment, "parameters"):
for param_name, param_value in subfragment.parameters.items():