#%l2n-klayout
top(RINGO)
unit(0.001)

# Layer section
# This section lists the mask layers (drawing or derived) and their connections.

# Mask layers
layer(rbulk)
layer(nwell '1/0')
layer(poly '3/0')
layer(poly_lbl '3/1')
layer(diff_cont '4/0')
layer(poly_cont '5/0')
layer(metal1 '6/0')
layer(metal1_lbl '6/1')
layer(via1 '7/0')
layer(metal2 '8/0')
layer(metal2_lbl '8/1')
layer(ntie)
layer(psd)
layer(ptie)
layer(nsd)

# Mask layer connectivity
connect(nwell nwell ntie)
connect(poly poly poly_lbl poly_cont)
connect(poly_lbl poly)
connect(diff_cont diff_cont metal1 ntie psd ptie nsd)
connect(poly_cont poly poly_cont metal1)
connect(metal1 diff_cont poly_cont metal1 metal1_lbl via1)
connect(metal1_lbl metal1)
connect(via1 metal1 via1 metal2)
connect(metal2 via1 metal2 metal2_lbl)
connect(metal2_lbl metal2)
connect(ntie nwell diff_cont ntie)
connect(psd diff_cont psd)
connect(ptie diff_cont ptie)
connect(nsd diff_cont nsd)

# Global nets and connectivity
global(rbulk BULK)
global(ptie BULK)

# Device class section
class(PMOS MOS4)
class(NMOS MOS4)

# Device abstracts section
# Device abstracts list the pin shapes of the devices.
device(D$PMOS PMOS
 terminal(S
  rect(psd (-650 -475) (525 950))
 )
 terminal(G
  rect(poly (-125 -475) (250 950))
 )
 terminal(D
  rect(psd (125 -475) (550 950))
 )
 terminal(B
  rect(nwell (-125 -475) (250 950))
 )
)
device(D$PMOS$1 PMOS
 terminal(S
  rect(psd (-675 -475) (550 950))
 )
 terminal(G
  rect(poly (-125 -475) (250 950))
 )
 terminal(D
  rect(psd (125 -475) (525 950))
 )
 terminal(B
  rect(nwell (-125 -475) (250 950))
 )
)
device(D$NMOS NMOS
 terminal(S
  rect(nsd (-650 -475) (525 950))
 )
 terminal(G
  rect(poly (-125 -475) (250 950))
 )
 terminal(D
  rect(nsd (125 -475) (550 950))
 )
 terminal(B
  rect(rbulk (-125 -475) (250 950))
 )
)
device(D$NMOS$1 NMOS
 terminal(S
  rect(nsd (-675 -475) (550 950))
 )
 terminal(G
  rect(poly (-125 -475) (250 950))
 )
 terminal(D
  rect(nsd (125 -475) (525 950))
 )
 terminal(B
  rect(rbulk (-125 -475) (250 950))
 )
)

# Circuit section
# Circuits are the hierarchical building blocks of the netlist.
circuit(INV2

 # Circuit boundary
 rect((-1700 -1640) (3100 6220))

 # Nets with their geometries
 net(1 name($1)
  rect(nwell (-1400 1800) (2800 2780))
  rect(diff_cont (-1510 -650) (220 220))
  rect(ntie (-510 -450) (800 680))
 )
 net(2 name(IN)
  rect(poly (-525 -250) (250 2500))
  rect(poly (-1425 -630) (1300 360))
  rect(poly (-125 -2780) (250 1600))
  rect(poly (-250 1200) (250 1600))
  rect(poly_lbl (-525 -1800) (0 0))
  rect(poly_cont (-830 -110) (220 220))
 )
 net(3 name($3)
  rect(poly (275 -250) (250 2500))
  rect(poly (-305 -1430) (360 360))
  rect(poly (-305 820) (250 1600))
  rect(poly (-250 -4400) (250 1600))
  rect(diff_cont (-1435 1690) (220 220))
  rect(diff_cont (-220 180) (220 220))
  rect(diff_cont (-220 -3420) (220 220))
  rect(diff_cont (-220 180) (220 220))
  rect(poly_cont (980 580) (220 220))
  rect(metal1 (-1310 -290) (1380 360))
  rect(metal1 (-1560 -1600) (360 2840))
  rect(metal1 (-360 0) (360 760))
  rect(metal1 (-360 -3560) (360 760))
  rect(psd (-430 1945) (525 950))
  rect(nsd (-525 -3750) (525 950))
 )
 net(4 name(OUT)
  rect(diff_cont (690 2890) (220 220))
  rect(diff_cont (-220 -620) (220 220))
  rect(diff_cont (-220 -2620) (220 220))
  rect(diff_cont (-220 -620) (220 220))
  polygon(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
  rect(metal1 (-680 2400) (360 760))
  rect(metal1 (-360 -3560) (360 760))
  rect(metal1_lbl (-180 1420) (0 0))
  rect(psd (-275 525) (525 950))
  rect(nsd (-525 -3750) (525 950))
 )
 net(5 name(VSS)
  rect(diff_cont (-110 -310) (220 220))
  rect(diff_cont (-220 180) (220 220))
  rect(diff_cont (-220 -220) (220 220))
  rect(diff_cont (-220 -620) (220 220))
  rect(metal1 (-290 -290) (360 760))
  rect(metal1 (-360 -760) (360 760))
  rect(via1 (-305 -705) (250 250))
  rect(via1 (-250 150) (250 250))
  rect(metal2 (-1525 -775) (2800 900))
  rect(metal2_lbl (-160 -540) (0 0))
  rect(nsd (-1515 -385) (550 950))
 )
 net(6 name(VDD)
  rect(diff_cont (-110 2890) (220 220))
  rect(diff_cont (-220 -620) (220 220))
  rect(diff_cont (-220 -220) (220 220))
  rect(diff_cont (-220 180) (220 220))
  rect(metal1 (-290 -690) (360 760))
  rect(metal1 (-360 -760) (360 760))
  rect(via1 (-305 -705) (250 250))
  rect(via1 (-250 150) (250 250))
  rect(metal2 (-1525 -775) (2800 900))
  rect(metal2_lbl (-150 -450) (0 0))
  rect(psd (-1525 -475) (550 950))
 )
 net(7 name(BULK)
  rect(diff_cont (-110 -1360) (220 220))
  rect(ptie (-510 -450) (800 680))
 )

 # Outgoing pins and their connections to nets
 pin(1)
 pin(2 name(IN))
 pin(3)
 pin(4 name(OUT))
 pin(5 name(VSS))
 pin(6 name(VDD))
 pin(7 name(BULK))

 # Devices and their connections
 device(1 D$PMOS
  location(-400 2800)
  param(L 0.25)
  param(W 0.95)
  param(AS 0.49875)
  param(AD 0.26125)
  param(PS 2.95)
  param(PD 1.5)
  terminal(S 3)
  terminal(G 2)
  terminal(D 6)
  terminal(B 1)
 )
 device(2 D$PMOS$1
  location(400 2800)
  param(L 0.25)
  param(W 0.95)
  param(AS 0.26125)
  param(AD 0.49875)
  param(PS 1.5)
  param(PD 2.95)
  terminal(S 6)
  terminal(G 3)
  terminal(D 4)
  terminal(B 1)
 )
 device(3 D$NMOS
  location(-400 0)
  param(L 0.25)
  param(W 0.95)
  param(AS 0.49875)
  param(AD 0.26125)
  param(PS 2.95)
  param(PD 1.5)
  terminal(S 3)
  terminal(G 2)
  terminal(D 5)
  terminal(B 7)
 )
 device(4 D$NMOS$1
  location(400 0)
  param(L 0.25)
  param(W 0.95)
  param(AS 0.26125)
  param(AD 0.49875)
  param(PS 1.5)
  param(PD 2.95)
  terminal(S 5)
  terminal(G 3)
  terminal(D 4)
  terminal(B 7)
 )

)
circuit(INV2PAIR

 # Circuit boundary
 rect((0 -840) (5740 6220))

 # Nets with their geometries
 net(1 name(BULK))
 net(2 name($I8))
 net(3 name($I7))
 net(4 name($I6))
 net(5 name($I5))
 net(6 name($I4))
 net(7 name($I3))
 net(8 name($I2))
 net(9 name($I1))

 # Outgoing pins and their connections to nets
 pin(1 name(BULK))
 pin(2)
 pin(4)
 pin(5)
 pin(7)
 pin(8)
 pin(9)

 # Subcircuits and their connections
 circuit(1 INV2 location(1700 800)
  pin(0 9)
  pin(1 7)
  pin(2 3)
  pin(3 6)
  pin(4 5)
  pin(5 4)
  pin(6 1)
 )
 circuit(2 INV2 location(4340 800)
  pin(0 9)
  pin(1 6)
  pin(2 2)
  pin(3 8)
  pin(4 5)
  pin(5 4)
  pin(6 1)
 )

)
circuit(RINGO

 # Circuit boundary
 rect((-1720 -1640) (26880 6220))

 # Nets with their geometries
 net(1 name(FB)
  rect(metal1 (-1700 1620) (360 360))
  rect(via1 (-305 -305) (250 250))
  rect(via1 (24230 -250) (250 250))
  rect(metal2 (-24805 -325) (24880 400))
  rect(metal2_lbl (-23160 -200) (0 0))
 )
 net(2 name(OSC)
  rect(via1 (24435 1675) (250 250))
  rect(metal2 (-325 -325) (400 400))
  rect(metal2_lbl (-200 -200) (0 0))
 )
 net(3 name(VDD)
  rect(metal1 (-180 3100) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal2_lbl (-23940 -1420) (0 0))
 )
 net(4 name(VSS)
  rect(metal1 (-180 -1420) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal1 (2280 -1120) (360 1120))
  rect(metal2_lbl (-23940 300) (0 0))
 )
 net(5 name($I25))
 net(6 name($I24))
 net(7 name($I23))
 net(8 name($I22))
 net(9 name($I17))
 net(10 name($I16))
 net(11 name($I15))
 net(12 name($I14))

 # Outgoing pins and their connections to nets
 pin(1 name(FB))
 pin(2 name(OSC))
 pin(3 name(VDD))
 pin(4 name(VSS))

 # Subcircuits and their connections
 circuit(1 INV2PAIR location(19420 -800)
  pin(0 4)
  pin(1 1)
  pin(2 3)
  pin(3 4)
  pin(4 10)
  pin(5 2)
  pin(6 3)
 )
 circuit(2 INV2PAIR location(-1700 -800)
  pin(0 4)
  pin(1 8)
  pin(2 3)
  pin(3 4)
  pin(4 1)
  pin(5 9)
  pin(6 3)
 )
 circuit(3 INV2PAIR location(14140 -800)
  pin(0 4)
  pin(1 5)
  pin(2 3)
  pin(3 4)
  pin(4 11)
  pin(5 10)
  pin(6 3)
 )
 circuit(4 INV2PAIR location(8860 -800)
  pin(0 4)
  pin(1 6)
  pin(2 3)
  pin(3 4)
  pin(4 12)
  pin(5 11)
  pin(6 3)
 )
 circuit(5 INV2PAIR location(3580 -800)
  pin(0 4)
  pin(1 7)
  pin(2 3)
  pin(3 4)
  pin(4 9)
  pin(5 12)
  pin(6 3)
 )

)
