Efinic ConstraintManager improve delete method
This commit is contained in:
parent
06ff638f7a
commit
32f4d246f4
|
@ -192,14 +192,19 @@ class ConstraintManager:
|
||||||
|
|
||||||
def delete(self, signal):
|
def delete(self, signal):
|
||||||
for res, obj in self.matched:
|
for res, obj in self.matched:
|
||||||
if isinstance(signal, Record):
|
if isinstance(obj, Record):
|
||||||
if isinstance(obj, Signal):
|
for pos, (name, item) in enumerate(vars(obj).items()):
|
||||||
continue
|
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:
|
else:
|
||||||
if isinstance(obj, Record):
|
if obj == signal:
|
||||||
continue
|
self.matched.remove((res, obj))
|
||||||
if obj == signal:
|
|
||||||
self.matched.remove((res, obj))
|
|
||||||
|
|
||||||
def request(self, name, number=None, loose=False):
|
def request(self, name, number=None, loose=False):
|
||||||
resource = _lookup(self.available, name, number, loose)
|
resource = _lookup(self.available, name, number, loose)
|
||||||
|
|
Loading…
Reference in New Issue