improve substitute, update notebook output
This commit is contained in:
1 parent
c32584fc76
commit
47ee8d5878
2 files changed
+19
-21
No files matched your search
@@ -667,10 +667,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[0:__fork__\"a\" >3 >9,\n",
|
||||
" 1:__fork__\"b\" >4 >10,\n",
|
||||
" 2:__fork__\"s\" <5 ,\n",
|
||||
" 4:DFF\"cin\" <1 >0]"
|
||||
"[0:__fork__\"a\" >3 >9, 1:__fork__\"b\" >4 >10, 2:__fork__\"s\" <5, 4:DFF\"cin\" <1 >0]"
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
@@ -1312,10 +1309,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[0:__fork__\"a\" >3 >9,\n",
|
||||
" 1:__fork__\"b\" >4 >10,\n",
|
||||
" 2:__fork__\"s\" <5 ,\n",
|
||||
" 4:DFF\"cin\" <1 >0]"
|
||||
"[0:__fork__\"a\" >3 >9, 1:__fork__\"b\" >4 >10, 2:__fork__\"s\" <5, 4:DFF\"cin\" <1 >0]"
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
@@ -2045,10 +2039,10 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Waveforms : 64293.5 kiB\n",
|
||||
"Waveforms : 64294.0 kiB\n",
|
||||
"State Allocation Table : 129.3 kiB\n",
|
||||
"Circuit Timing : 1034.1 kiB\n",
|
||||
"Circuit Netlist : 750.8 kiB\n",
|
||||
"Circuit Netlist : 1126.1 kiB\n",
|
||||
"Sequential State : 726.0 kiB\n"
|
||||
]
|
||||
}
|
||||
|
||||
+15
-11
@@ -343,7 +343,7 @@ class Circuit:
|
||||
the signal lines are connected appropriately. The number and arrangement
|
||||
of the input and output ports must match the pins of the replaced node.
|
||||
"""
|
||||
impl_in_lines = [n.outs[0] for n in impl.io_nodes if len(n.outs) > 0]
|
||||
impl_in_lines = [n.outs[0] for n in impl.io_nodes if len(n.ins) == 0]
|
||||
impl_out_lines = [n.ins[0] for n in impl.io_nodes if len(n.ins) > 0]
|
||||
node_in_lines = list(node.ins) + [None] * (len(impl_in_lines)-len(node.ins))
|
||||
node_out_lines = list(node.outs) + [None] * (len(impl_out_lines)-len(node.outs))
|
||||
@@ -354,24 +354,28 @@ class Circuit:
|
||||
node.remove()
|
||||
node_map = dict()
|
||||
ios = set(impl.io_nodes)
|
||||
for n in impl.nodes:
|
||||
for n in impl.nodes: # add all nodes to main circuit
|
||||
if n not in ios:
|
||||
node_map[n] = Node(self, node.name + '~' + n.name, n.kind)
|
||||
for l in impl.lines:
|
||||
if l in in_lines_map:
|
||||
ll = in_lines_map[l]
|
||||
if ll is not None:
|
||||
elif len(n.outs) > 0 and len(n.ins) > 0: # output is also read by impl. circuit, need to add a fork.
|
||||
node_map[n] = Node(self, node.name + '~' + n.name)
|
||||
for l in impl.lines: # add all internal lines to main circuit
|
||||
if l.reader in node_map and l.driver in node_map:
|
||||
Line(self, (node_map[l.driver], l.driver_pin), (node_map[l.reader], l.reader_pin))
|
||||
for l, ll in in_lines_map.items(): # connect inputs
|
||||
if ll is None: continue
|
||||
ll.reader = node_map[l.reader]
|
||||
ll.reader_pin = l.reader_pin
|
||||
ll.reader.ins[ll.reader_pin] = ll
|
||||
elif l in out_lines_map:
|
||||
ll = out_lines_map[l]
|
||||
if ll is not None:
|
||||
for l, ll in out_lines_map.items(): # connect outputs
|
||||
if ll is None: continue
|
||||
if len(l.reader.outs) > 0: # output is also read by impl. circuit, connect to fork.
|
||||
ll.driver = node_map[l.reader]
|
||||
ll.driver_pin = len(l.reader.outs)
|
||||
else:
|
||||
ll.driver = node_map[l.driver]
|
||||
ll.driver_pin = l.driver_pin
|
||||
ll.driver.outs[ll.driver_pin] = ll
|
||||
else:
|
||||
Line(self, (node_map[l.driver], l.driver_pin), (node_map[l.reader], l.reader_pin))
|
||||
|
||||
def copy(self):
|
||||
"""Returns a deep copy of the circuit.
|
||||
|
||||
Reference in new issue
Block a user