gen/fhdl/namer: Add all_numbers to HierarchyNode to avoid hasattr use.

This commit is contained in:
Florent Kermarrec 2023-11-06 15:36:08 +01:00
parent 3df23a27f5
commit 9ce29224a1
1 changed files with 2 additions and 1 deletions

View File

@ -26,6 +26,7 @@ class HierarchyNode:
self.use_name = False self.use_name = False
self.use_number = False self.use_number = False
self.children = {} self.children = {}
self.all_numbers = []
def update(self, name, number, use_number, current_base=None): def update(self, name, number, use_number, current_base=None):
""" """
@ -140,7 +141,7 @@ def build_signal_name_dict_from_tree(tree, signals):
# Navigate the tree according to the signal's path. # Navigate the tree according to the signal's path.
treepos = treepos.children.get((step_name, step_n)) or treepos.children.get(step_name) treepos = treepos.children.get((step_name, step_n)) or treepos.children.get(step_name)
# Check if the number is part of the name based on the tree node. # Check if the number is part of the name based on the tree node.
use_number = step_n in treepos.all_numbers if hasattr(treepos, 'all_numbers') else False use_number = step_n in treepos.all_numbers
# If the tree node's name is to be used, add it to the elements. # If the tree node's name is to be used, add it to the elements.
if treepos.use_name: if treepos.use_name: