From 32f4d246f48d0ddc8fce3eedebaf0a16f115e3be Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Tue, 28 Sep 2021 18:04:27 +0200 Subject: [PATCH] Efinic ConstraintManager improve delete method --- litex/build/generic_platform.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/litex/build/generic_platform.py b/litex/build/generic_platform.py index 12461ed62..6b0d4c66a 100644 --- a/litex/build/generic_platform.py +++ b/litex/build/generic_platform.py @@ -192,14 +192,19 @@ class ConstraintManager: def delete(self, signal): for res, obj in self.matched: - if isinstance(signal, Record): - if isinstance(obj, Signal): - continue + if isinstance(obj, Record): + for pos, (name, item) in enumerate(vars(obj).items()): + if isinstance(item, Signal): + if item == signal: + # Two first pos are name and layout + del obj.layout[pos-2] + delattr(obj, name) + if len(obj.layout) == 0: + self.matched.remove((res, obj)) + break else: - if isinstance(obj, Record): - continue - if obj == signal: - self.matched.remove((res, obj)) + if obj == signal: + self.matched.remove((res, obj)) def request(self, name, number=None, loose=False): resource = _lookup(self.available, name, number, loose)