build/generic_platform: add request_all method.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 6 Aug 2020 18:00:07 +0000 (20:00 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 6 Aug 2020 18:00:07 +0000 (20:00 +0200)
litex/build/generic_platform.py

index 21608831be539e04308bc7d77ee83299c016a83a..235eee7e2356082178c5f1f4dbd3e442d407709a 100644 (file)
@@ -5,7 +5,7 @@
 
 import os
 
-from migen.fhdl.structure import Signal
+from migen.fhdl.structure import Signal, Cat
 from migen.genlib.record import Record
 
 from litex.gen.fhdl import verilog
@@ -210,6 +210,17 @@ class ConstraintManager:
         self.matched.append((resource, obj))
         return obj
 
+    def request_all(self, name):
+        r = []
+        while True:
+            try:
+                r.append(self.request(name, len(r)))
+            except ConstraintError:
+                break
+        if not len(r):
+            raise ValueError
+        return Cat(r)
+
     def lookup_request(self, name, number=None, loose=False):
         subname = None
         if ":" in name: name, subname = name.split(":")
@@ -288,6 +299,9 @@ class GenericPlatform:
     def request(self, *args, **kwargs):
         return self.constraint_manager.request(*args, **kwargs)
 
+    def request_all(self, *args, **kwargs):
+        return self.constraint_manager.request_all(*args, **kwargs)
+
     def lookup_request(self, *args, **kwargs):
         return self.constraint_manager.lookup_request(*args, **kwargs)