gen/build: use name_override for all IOs defined in Platform file (avoid random naming of IOs)

This commit is contained in:
Florent Kermarrec 2015-11-30 18:15:48 +01:00
parent 53c86e34f4
commit a716c562f0
2 changed files with 12 additions and 5 deletions

View File

@ -161,10 +161,14 @@ class ConstraintManager:
def request(self, name, number=None): def request(self, name, number=None):
resource = _lookup(self.available, name, number) resource = _lookup(self.available, name, number)
rt = _resource_type(resource) rt = _resource_type(resource)
if isinstance(rt, int): if number is None:
obj = Signal(rt, name_override=resource[0]) resource_name = name
else: else:
obj = Record(rt, name=resource[0]) resource_name = name + str(number)
if isinstance(rt, int):
obj = Signal(rt, name_override=resource_name)
else:
obj = Record(rt, name=resource_name, use_name_override=True)
for element in resource[2:]: for element in resource[2:]:
if isinstance(element, PlatformInfo): if isinstance(element, PlatformInfo):

View File

@ -86,7 +86,7 @@ def layout_partial(layout, *elements):
class Record: class Record:
def __init__(self, layout, name=None): def __init__(self, layout, name=None, use_name_override=False):
self.name = get_obj_var_name(name, "") self.name = get_obj_var_name(name, "")
self.layout = layout self.layout = layout
@ -100,7 +100,10 @@ class Record:
fname, fsize, fdirection = f fname, fsize, fdirection = f
else: else:
fname, fsize = f fname, fsize = f
finst = Signal(fsize, name=prefix + fname) if use_name_override:
finst = Signal(fsize, name_override=prefix + fname)
else:
finst = Signal(fsize, name=prefix + fname)
elif isinstance(f[1], list): # case 3 elif isinstance(f[1], list): # case 3
fname, fsublayout = f fname, fsublayout = f
finst = Record(fsublayout, prefix + fname) finst = Record(fsublayout, prefix + fname)