def __init__(self, comb=None, sync=None, instances=None, memories=None, sim=None):
if comb is None: comb = []
if sync is None: sync = dict()
- if instances is None: instances = []
- if memories is None: memories = []
+ if instances is None: instances = set()
+ if memories is None: memories = set()
if sim is None: sim = []
if isinstance(sync, list):
self.comb = comb
self.sync = sync
- self.instances = instances
- self.memories = memories
+ self.instances = set(instances)
+ self.memories = set(memories)
self.sim = sim
for k, v in other.sync.items():
newsync[k].extend(v)
return Fragment(self.comb + other.comb, newsync,
- self.instances + other.instances,
- self.memories + other.memories,
+ self.instances | other.instances,
+ self.memories | other.memories,
self.sim + other.sim)
def rename_clock_domain(self, old, new):
def list_inst_ios(i, ins, outs, inouts):
if isinstance(i, Fragment):
return list_inst_ios(i.instances, ins, outs, inouts)
- elif isinstance(i, list):
+ elif isinstance(i, set):
if i:
return set.union(*(list_inst_ios(e, ins, outs, inouts) for e in i))
else:
self._memories = set(v for v in self.buses.values() if isinstance(v, Memory))
def get_fragment(self):
- return Fragment(memories=list(self._memories))
+ return Fragment(memories=self._memories)
(_WAIT_COMPLETE, _WAIT_POLL) = range(2)