|
|
|
@ -5,23 +5,6 @@ from .circuit import Node, Line
@@ -5,23 +5,6 @@ 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) |
|
|
|
|
if in1 is not None: |
|
|
|
|
n.ins[0] = in1 |
|
|
|
|
in1.reader = n |
|
|
|
|
in1.reader_pin = 0 |
|
|
|
|
if in2 is not None: |
|
|
|
|
n.ins[1] = in2 |
|
|
|
|
in2.reader = n |
|
|
|
|
in2.reader_pin = 1 |
|
|
|
|
if out is not None: |
|
|
|
|
n.outs[0] = out |
|
|
|
|
out.driver = n |
|
|
|
|
out.driver_pin = 0 |
|
|
|
|
return n |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TechLib: |
|
|
|
|
"""Provides some information specific to standard cell libraries necessary |
|
|
|
|
for loading gate-level designs. :py:class:`~kyupy.circuit.Node` objects do not |
|
|
|
@ -74,30 +57,6 @@ class TechLib:
@@ -74,30 +57,6 @@ 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)'), |
|
|
|
|
'HADD' : bench.parse('input(a,b) output(s,co) co=xor(a,b) s=and(a,b)'), |
|
|
|
|
'FADD' : bench.parse('input(a,b,ci) output(s,co) ab=xor(a,b) co=xor(ab,ci) s=ao22(ab,ci,a,b)'), |
|
|
|
|
} |
|
|
|
|
for n in list(circuit.nodes): |
|
|
|
|
if n.kind.startswith('DFFSSR'): |
|
|
|
|
n.kind = 'DFFX1' |
|
|
|
|
n_and0 = add_and_connect(circuit, n.name + '~and0', 'AND2', n.ins[0], n.ins[2], None) |
|
|
|
|
Line(circuit, n_and0, (n, 0)) |
|
|
|
|
else: |
|
|
|
|
for k, v in tmap.items(): |
|
|
|
|
if n.kind.startswith(k): |
|
|
|
|
circuit.substitute(n, v) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TechLibNew: |
|
|
|
|
def __init__(self, lib_src): |
|
|
|
@ -273,7 +232,7 @@ OAI222X{1,2}$ input(IN1,IN2,IN3,IN4,IN5,IN6) output(QN) A=OA22(IN1,IN2,IN3,IN4)
@@ -273,7 +232,7 @@ OAI222X{1,2}$ input(IN1,IN2,IN3,IN4,IN5,IN6) output(QN) A=OA22(IN1,IN2,IN3,IN4)
|
|
|
|
|
MUX41X{1,2}$ input(IN1,IN2,IN3,IN4,S0,S1) output(Q) A=MUX21(IN1,IN2,S0) B=MUX21(IN3,IN4,S0) Q=MUX21(A,B,S1) ; |
|
|
|
|
|
|
|
|
|
DEC24X{1,2}$ input(IN1,IN2) output(Q0,Q1,Q2,Q3) IN1B=INV1(IN1) IN2B=INV1(IN2) Q0=NOR2(IN1,IN2) Q1=AND(IN1,IN2B) Q2=AND(IN1B,IN2) Q3=AND(IN1,IN2) ; |
|
|
|
|
FADDX{1,2}$ input(A,B,CI) output(S,CO) AB=XOR2(A,B) CO=XOR(AB,CI) S=AO22(AB,CI,A,B) ; |
|
|
|
|
FADDX{1,2}$ input(A,B,CI) output(S,CO) AB=XOR2(A,B) CO=XOR2(AB,CI) S=AO22(AB,CI,A,B) ; |
|
|
|
|
HADDX{1,2}$ input(A0,B0) output(SO,C1) C1=XOR2(A0,B0) SO=AND2(A0,B0) ; |
|
|
|
|
|
|
|
|
|
{,AO}DFFARX{1,2}$ input(D,CLK,RSTB) output(Q,QN) DR=AND2(D,RSTB) Q=DFF(DR,CLK) QN=INV1(Q) ; |
|
|
|
@ -364,7 +323,7 @@ OAI222X{1,2}$ input(A1,A2,A3,A4,A5,A6) output(Y) A=OA22(A1,A2,A3,A4) Y=OAI21(A5,
@@ -364,7 +323,7 @@ OAI222X{1,2}$ input(A1,A2,A3,A4,A5,A6) output(Y) A=OA22(A1,A2,A3,A4) Y=OAI21(A5,
|
|
|
|
|
MUX41X{1,2}$ input(A1,A2,A3,A4,S0,S1) output(Y) A=MUX21(A1,A2,S0) B=MUX21(A3,A4,S0) Y=MUX21(A,B,S1) ; |
|
|
|
|
|
|
|
|
|
DEC24X{1,2}$ input(A0,A1) output(Y0,Y1,Y2,Y3) A0B=INV1(A0) A1B=INV1(A1) Y0=NOR2(A0,A1) Y1=AND(A0,A1B) Y2=AND(A0B,A1) Y3=AND(A0,A1) ; |
|
|
|
|
FADDX{1,2}$ input(A,B,CI) output(S,CO) AB=XOR2(A,B) CO=XOR(AB,CI) S=AO22(AB,CI,A,B) ; |
|
|
|
|
FADDX{1,2}$ input(A,B,CI) output(S,CO) AB=XOR2(A,B) CO=XOR2(AB,CI) S=AO22(AB,CI,A,B) ; |
|
|
|
|
HADDX{1,2}$ input(A0,B0) output(SO,C1) C1=XOR2(A0,B0) SO=AND2(A0,B0) ; |
|
|
|
|
|
|
|
|
|
{,AO}DFFARX{1,2}$ input(D,CLK,RSTB) output(Q,QN) DR=AND2(D,RSTB) Q=DFF(DR,CLK) QN=INV1(Q) ; |
|
|
|
@ -407,7 +366,7 @@ AOI22X1 input(A0,A1,B0,B1) output(Y) Y=AOI22(A0,A1,B0,B1) ;
@@ -407,7 +366,7 @@ AOI22X1 input(A0,A1,B0,B1) output(Y) Y=AOI22(A0,A1,B0,B1) ;
|
|
|
|
|
OAI21X1 input(A0,A1,B0) output(Y) Y=OAI21(A0,A1,B0) ; |
|
|
|
|
OAI22X1 input(A0,A1,B0,B1) output(Y) Y=OAI22(A0,A1,B0,B1) ; |
|
|
|
|
OAI33X1 input(A0,A1,A2,B0,B1,B2) output(Y) AA=OR2(A0,A1) BB=OR2(B0,B1) Y=OAI22(AA,A2,BB,B2) ; |
|
|
|
|
ADDFX1 input(A,B,CI) output(CO,S) AB=XOR2(A,B) CO=XOR(AB,CI) S=AO22(AB,CI,A,B) ; |
|
|
|
|
ADDFX1 input(A,B,CI) output(CO,S) AB=XOR2(A,B) CO=XOR2(AB,CI) S=AO22(AB,CI,A,B) ; |
|
|
|
|
ADDHX1 input(A,B) output(CO,S) CO=XOR2(A,B) S=AND2(A,B) ; |
|
|
|
|
|
|
|
|
|
DFFX1 input(CK,D) output(Q,QN) Q=DFF(D,CK) QN=INV1(Q) ; |
|
|
|
|