avoid holes in forks, update intro
This commit is contained in:
1 parent
b3dbe9765a
commit
5be82da49a
2 files changed
+1381
-404
No files matched your search
+1373
-402
File diff suppressed because it is too large.
Load diff
@@ -176,7 +176,11 @@ class Line:
|
||||
To keep the indices consecutive, the line with the highest index within the circuit
|
||||
will be assigned the index of the removed line.
|
||||
"""
|
||||
if self.driver is not None: self.driver.outs[self.driver_pin] = None
|
||||
if self.driver is not None:
|
||||
self.driver.outs[self.driver_pin] = None
|
||||
if self.driver.kind == '__fork__': # squeeze outputs
|
||||
del self.driver.outs[self.driver_pin]
|
||||
for i, l in enumerate(self.driver.outs): l.driver_pin = i
|
||||
if self.reader is not None: self.reader.ins[self.reader_pin] = None
|
||||
if self.circuit is not None: del self.circuit.lines[self.index]
|
||||
self.driver = None
|
||||
@@ -564,6 +568,7 @@ class Circuit:
|
||||
from graphviz import Digraph
|
||||
dot = Digraph(format=format, graph_attr={'rankdir': 'LR', 'splines': 'true'})
|
||||
|
||||
s_dict = dict((n, i) for i, n in enumerate(self.s_nodes))
|
||||
node_level = np.zeros(len(self.nodes), dtype=np.uint32)
|
||||
level_nodes = defaultdict(list)
|
||||
for n, lv in self.topological_order_with_level():
|
||||
@@ -576,7 +581,8 @@ class Circuit:
|
||||
for n in level_nodes[lv]:
|
||||
ins = '|'.join([f'<i{i}>{i}' for i in range(len(n.ins))])
|
||||
outs = '|'.join([f'<o{i}>{i}' for i in range(len(n.outs))])
|
||||
s.node(name=str(n.index), label = f'{{{{{ins}}}|{n.index}\n{n.kind}\n{n.name}|{{{outs}}}}}', shape='record')
|
||||
io = f' [{s_dict[n]}]' if n in s_dict else ''
|
||||
s.node(name=str(n.index), label = f'{{{{{ins}}}|{n.index}{io}\n{n.kind}\n{n.name}|{{{outs}}}}}', shape='record')
|
||||
|
||||
for l in self.lines:
|
||||
driver, reader = f'{l.driver.index}:o{l.driver_pin}', f'{l.reader.index}:i{l.reader_pin}'
|
||||
|
||||
Reference in new issue
Block a user