gen/build: use name_override for all IOs defined in Platform file (avoid random namin...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 30 Nov 2015 17:15:48 +0000 (18:15 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 30 Nov 2015 17:26:33 +0000 (18:26 +0100)
litex/build/generic_platform.py
litex/gen/genlib/record.py

index a5a12fe12c0d2f7fb41ec4171652c68b2b36bcd2..d96e3d761235121e257b01f53d60aa832cde0183 100644 (file)
@@ -161,10 +161,14 @@ class ConstraintManager:
     def request(self, name, number=None):
         resource = _lookup(self.available, name, number)
         rt = _resource_type(resource)
+        if number is None:
+            resource_name = name
+        else:
+            resource_name = name + str(number)
         if isinstance(rt, int):
-            obj = Signal(rt, name_override=resource[0])
+            obj = Signal(rt, name_override=resource_name)
         else:
-            obj = Record(rt, name=resource[0])
+            obj = Record(rt, name=resource_name, use_name_override=True)
 
         for element in resource[2:]:
             if isinstance(element, PlatformInfo):
index 0038b069759c2f19ba1147b28efdfda6380ef4e8..f31a2c24a4fcc16b595804a7459dd4af48b931bc 100644 (file)
@@ -86,7 +86,7 @@ def layout_partial(layout, *elements):
 
 
 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.layout = layout
 
@@ -100,7 +100,10 @@ class Record:
                     fname, fsize, fdirection = f
                 else:
                     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
                 fname, fsublayout = f
                 finst = Record(fsublayout, prefix + fname)