************************************************************************

.GLOBAL gnd!  vdd!

.SUBCKT inv in out
*.PININFO in:I out:O
MM1 out in gnd! gnd! N_18 W=470.00n L=180.00n
MM0 out in vdd! vdd! P_18 W=950.00n L=180.00n
.ENDS

.SUBCKT nand3 a b c out
*.PININFO a:I b:I c:I out:O
MM4 out c vdd! vdd! P_18 W=1.00u L=180.00n
MM0 out a vdd! vdd! P_18 W=1.00u L=180.00n
MM1 out b vdd! vdd! P_18 W=1.00u L=180.00n
MM5 net21 c gnd! gnd! N_18 W=500.00n L=180.00n
MM2 out a net29 gnd! N_18 W=500.00n L=180.00n
MM3 net29 b net21 gnd! N_18 W=500.00n L=180.00n
.ENDS

.SUBCKT and3 a b c out
*.PININFO a:I b:I c:I out:O
XI1 net10 out / inv
XI0 a b c net10 / nand3
.ENDS

.SUBCKT nand2 a b out
*.PININFO a:I b:I out:O
MM3 net4 b gnd! gnd! N_18 W=500n L=180.00n
MM0 out a net4 gnd! N_18 W=500n L=180.00n
MM2 out a vdd! vdd! P_18 W=1u L=180.00n
MM1 out b vdd! vdd! P_18 W=1u L=180.00n
.ENDS

.SUBCKT and2 a b out
*.PININFO a:I b:I out:O
XI1 a b net4 / nand2
XI0 net4 out / inv
.ENDS

.SUBCKT JK_FF CLK J K Q QB
*.PININFO CLK:I J:I K:I Q:O QB:O
XI3 CLK K Q net9 / nand3
XI2 QB J CLK net13 / nand3
XI1 Q net9 QB / nand2
XI0 net13 QB Q / nand2
.ENDS

.SUBCKT 4bits_SBDC CLK J K Q1 Q2 Q3 Q4 Q4B
*.PININFO CLK:I J:I K:I Q1:O Q2:O Q3:O Q4:O Q4B:O
XI5 net31 net26 net044 net13 / and3
XI4 net31 net26 net18 / and2
XI3 CLK net13 net13 Q4 Q4B / JK_FF
XI2 CLK net18 net18 Q3 net044 / JK_FF
XI1 CLK net31 net31 Q2 net26 / JK_FF
XI0 CLK J K Q1 net31 / JK_FF
.ENDS

