Skip to content

Commit

Permalink
back.rtlil: put hierarchy in module name instead of an attribute.
Browse files Browse the repository at this point in the history
The attribute sees essentially no use and the information is much
better served by putting it in the module name. In addition this
means that the entire tree can be renamed simply by renaming the top
module.

Tools like GTKWave show the names of the instances, not the modules,
so they are not affected by the longer names.
  • Loading branch information
whitequark committed Sep 12, 2023
1 parent 797cffd commit 7ff2e44
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions amaranth/back/rtlil.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,10 @@ def _convert_fragment(builder, fragment, name_map, hierarchy):
else:
return "\\{}".format(fragment.type), port_map

module_name = hierarchy[-1] or "anonymous"
module_name = ".".join(name or "anonymous" for name in hierarchy)
module_attrs = OrderedDict()
if len(hierarchy) == 1:
module_attrs["top"] = 1
module_attrs["amaranth.hierarchy"] = ".".join(name or "anonymous" for name in hierarchy)

with builder.module(module_name, attrs=module_attrs) as module:
compiler_state = _ValueCompilerState(module)
Expand Down

0 comments on commit 7ff2e44

Please sign in to comment.