|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
from .circuit import Node, Line |
|
|
|
|
|
|
|
|
|
from . import bench |
|
|
|
|
|
|
|
|
|
def add_and_connect(circuit, name, kind, in1=None, in2=None, out=None): |
|
|
|
|
n = Node(circuit, name, kind) |
|
|
|
@ -66,6 +66,23 @@ class TechLib:
@@ -66,6 +66,23 @@ class TechLib:
|
|
|
|
|
if 'MUX' in kind and pin == 'S': return False |
|
|
|
|
return pin in ('Q', 'QN', 'Z', 'ZN', 'Y', 'CO', 'S', 'SO', 'C1') |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def substitute_nonsim_cells(circuit): |
|
|
|
|
tmap = {'ISOLAND': bench.parse('input(iso, d) output(q) not_iso=not(iso) q=and(not_iso, d)'), |
|
|
|
|
'AO221' : bench.parse('input(in1, in2, in3, in4, in5) output(q) a=ao22(in1, in2, in3, in4) q=or(a, in5)'), |
|
|
|
|
'AOI221' : bench.parse('input(in1, in2, in3, in4, in5) output(qn) a=ao22(in1, in2, in3, in4) qn=nor(a, in5)'), |
|
|
|
|
'OA221' : bench.parse('input(in1, in2, in3, in4, in5) output(q) a=oa22(in1, in2, in3, in4) q=and(a, in5)'), |
|
|
|
|
'OAI221' : bench.parse('input(in1, in2, in3, in4, in5) output(qn) a=oa22(in1, in2, in3, in4) qn=nand(a, in5)'), |
|
|
|
|
'AO222' : bench.parse('input(in1, in2, in3, in4, in5, in6) output(q) a=ao22(in1, in2, in3, in4) q=ao21(in5, in6, a)'), |
|
|
|
|
'AOI222' : bench.parse('input(in1, in2, in3, in4, in5, in6) output(qn) a=ao22(in1, in2, in3, in4) qn=aoi21(in5, in6, a)'), |
|
|
|
|
'OA222' : bench.parse('input(in1, in2, in3, in4, in5, in6) output(q) a=oa22(in1, in2, in3, in4) q=oa21(in5, in6, a)'), |
|
|
|
|
'OAI222' : bench.parse('input(in1, in2, in3, in4, in5, in6) output(qn) a=oa22(in1, in2, in3, in4) qn=oai21(in5, in6, a)'), |
|
|
|
|
} |
|
|
|
|
for n in list(circuit.nodes): |
|
|
|
|
for k, v in tmap.items(): |
|
|
|
|
if n.kind.startswith(k): |
|
|
|
|
circuit.substitute(n, v) |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def split_complex_gates(circuit): |
|
|
|
|
node_list = circuit.nodes |
|
|
|
|