From 0b9ffb6adbd175fd6e3e4c6a04ec002844b8c9df Mon Sep 17 00:00:00 2001 From: Jevin Sweval Date: Sat, 21 May 2022 13:46:01 -0700 Subject: [PATCH] Add request_remaining("name") that returns unallocated pins. Improve error reporting on request_all(). --- litex/build/generic_platform.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/litex/build/generic_platform.py b/litex/build/generic_platform.py index 3526a9501..3054103c0 100644 --- a/litex/build/generic_platform.py +++ b/litex/build/generic_platform.py @@ -230,7 +230,18 @@ class ConstraintManager: except ConstraintError: break if not len(r): - raise ValueError + raise ValueError(f"Could not request some pin(s) named '{name}'") + return Cat(r) + + def request_remaining(self, name): + r = [] + while True: + try: + r.append(self.request(name)) + except ConstraintError: + break + if not len(r): + raise ValueError(f"Could not request any pins named '{name}'") return Cat(r) def lookup_request(self, name, number=None, loose=False): @@ -321,6 +332,9 @@ class GenericPlatform: def request_all(self, *args, **kwargs): return self.constraint_manager.request_all(*args, **kwargs) + def request_remaining(self, *args, **kwargs): + return self.constraint_manager.request_remaining(*args, **kwargs) + def lookup_request(self, *args, **kwargs): return self.constraint_manager.lookup_request(*args, **kwargs)