Efinic ConstraintManager improve delete method

This commit is contained in:
Franck Jullien 2021-09-28 18:04:27 +02:00
parent 06ff638f7a
commit 32f4d246f4
1 changed files with 12 additions and 7 deletions

View File

@ -192,12 +192,17 @@ class ConstraintManager:
def delete(self, signal):
for res, obj in self.matched:
if isinstance(signal, Record):
if isinstance(obj, Signal):
continue
else:
if isinstance(obj, Record):
continue
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 obj == signal:
self.matched.remove((res, obj))