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

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

# Mask layers
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(psd)
layer(nsd)

# Mask layer connectivity
connect(poly poly poly_lbl poly_cont)
connect(poly_lbl poly)
connect(diff_cont diff_cont metal1 psd 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(psd diff_cont psd)
connect(nsd diff_cont nsd)

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

# 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))
 )
)
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))
 )
)
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))
 )
)
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))
 )
)

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

 # Circuit boundary
 rect((-1700 -800) (3100 4600))

 # Nets with their geometries
 net(1 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))
  text(poly_lbl IN (-525 -1800))
  rect(poly_cont (-830 -110) (220 220))
 )
 net(2
  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(3 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))
  text(metal1_lbl OUT (-180 1420))
  rect(psd (-275 525) (525 950))
  rect(nsd (-525 -3750) (525 950))
 )
 net(4
  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(nsd (-1675 -925) (550 950))
 )
 net(5
  rect(diff_cont (-110 2490) (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(psd (-1675 -925) (550 950))
 )

 # Outgoing pins and their connections to nets
 pin(1 name(IN))
 pin(2)
 pin(3 name(OUT))
 pin(4)
 pin(5)

 # 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 2)
  terminal(G 1)
  terminal(D 5)
 )
 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 5)
  terminal(G 2)
  terminal(D 3)
 )
 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 2)
  terminal(G 1)
  terminal(D 4)
 )
 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 4)
  terminal(G 2)
  terminal(D 3)
 )

)
circuit(RINGO

 # Circuit boundary
 rect((-1720 -800) (26880 4600))

 # 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))
  text(metal2_lbl FB (-23160 -200))
 )
 net(2 name(OSC)
  rect(via1 (24435 1675) (250 250))
  rect(metal2 (-325 -325) (400 400))
  text(metal2_lbl OSC (-200 -200))
 )
 net(3 name(VSS)
  text(metal2_lbl VSS (0 0))
 )
 net(4 name(VDD)
  text(metal2_lbl VDD (0 2800))
 )
 net(5)
 net(6)
 net(7)
 net(8)
 net(9)
 net(10)
 net(11)
 net(12)
 net(13)
 net(14)
 net(15)
 net(16)
 net(17)
 net(18)
 net(19)
 net(20)
 net(21)
 net(22)

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

 # Subcircuits and their connections
 circuit(1 INV2 location(23760 0)
  pin(0 15)
  pin(1 1)
  pin(2 2)
  pin(3 3)
  pin(4 4)
 )
 circuit(2 INV2 location(0 0)
  pin(0 1)
  pin(1 13)
  pin(2 14)
  pin(3 3)
  pin(4 4)
 )
 circuit(3 INV2 location(2640 0)
  pin(0 14)
  pin(1 12)
  pin(2 22)
  pin(3 3)
  pin(4 4)
 )
 circuit(4 INV2 location(5280 0)
  pin(0 22)
  pin(1 11)
  pin(2 21)
  pin(3 3)
  pin(4 4)
 )
 circuit(5 INV2 location(7920 0)
  pin(0 21)
  pin(1 10)
  pin(2 20)
  pin(3 3)
  pin(4 4)
 )
 circuit(6 INV2 location(10560 0)
  pin(0 20)
  pin(1 9)
  pin(2 19)
  pin(3 3)
  pin(4 4)
 )
 circuit(7 INV2 location(13200 0)
  pin(0 19)
  pin(1 8)
  pin(2 18)
  pin(3 3)
  pin(4 4)
 )
 circuit(8 INV2 location(15840 0)
  pin(0 18)
  pin(1 7)
  pin(2 17)
  pin(3 3)
  pin(4 4)
 )
 circuit(9 INV2 location(18480 0)
  pin(0 17)
  pin(1 6)
  pin(2 16)
  pin(3 3)
  pin(4 4)
 )
 circuit(10 INV2 location(21120 0)
  pin(0 16)
  pin(1 5)
  pin(2 15)
  pin(3 3)
  pin(4 4)
 )

)
