From: Florent Kermarrec Date: Thu, 6 Aug 2020 18:00:07 +0000 (+0200) Subject: build/generic_platform: add request_all method. X-Git-Tag: 24jan2021_ls180~10 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=14c9166429d44b3c98a1ed93dde9ceaac7c0ca43;p=litex.git build/generic_platform: add request_all method. --- diff --git a/litex/build/generic_platform.py b/litex/build/generic_platform.py index 21608831..235eee7e 100644 --- a/litex/build/generic_platform.py +++ b/litex/build/generic_platform.py @@ -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)