blob: 7295fc4108cfbc025c451dcd4522292a758e519b [file] [log] [blame]
################################################################################################
# Copyright 2022 GlobalFoundries PDK Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################################
#================================================
#------------- LAYERS DEFINITIONS ---------------
#================================================
polygons_count = 0
logger.info("Read in polygons from layers.")
comp = polygons(22 , 0 ).merged
count = comp.count()
logger.info("comp has %d polygons" % [count])
polygons_count += count
dnwell = polygons(12 , 0 ).merged
count = dnwell.count()
logger.info("dnwell has %d polygons" % [count])
polygons_count += count
nwell = polygons(21 , 0 ).merged
count = nwell.count()
logger.info("nwell has %d polygons" % [count])
polygons_count += count
dualgate = polygons(55 , 0 ).merged
count = dualgate.count()
logger.info("dualgate has %d polygons" % [count])
polygons_count += count
otpgate = polygons(225 , 0 ).merged
count = otpgate.count()
logger.info("otpgate has %d polygons" % [count])
polygons_count += count
poly2 = polygons(30 , 0 ).merged
count = poly2.count()
logger.info("poly2 has %d polygons" % [count])
polygons_count += count
nplus = polygons(32 , 0 ).merged
count = nplus.count()
logger.info("nplus has %d polygons" % [count])
polygons_count += count
pplus = polygons(31 , 0 ).merged
count = pplus.count()
logger.info("pplus has %d polygons" % [count])
polygons_count += count
sab = polygons(49 , 0 ).merged
count = sab.count()
logger.info("sab has %d polygons" % [count])
polygons_count += count
esd = polygons(24 , 0 ).merged
count = esd.count()
logger.info("esd has %d polygons" % [count])
polygons_count += count
resistor = polygons(62 , 0 ).merged
count = resistor.count()
logger.info("resistor has %d polygons" % [count])
polygons_count += count
fusetop = polygons(75 , 0 ).merged
count = fusetop.count()
logger.info("fusetop has %d polygons" % [count])
polygons_count += count
fusetop2 = polygons(215 , 0 ).merged
count = fusetop2.count()
logger.info("fusetop2 has %d polygons" % [count])
polygons_count += count
nat = polygons(5 , 0 ).merged
count = nat.count()
logger.info("nat has %d polygons" % [count])
polygons_count += count
lvt = polygons(87 , 0 ).merged
count = lvt.count()
logger.info("lvt has %d polygons" % [count])
polygons_count += count
comp_dummy = polygons(22 , 4 ).merged
count = comp_dummy.count()
logger.info("comp_dummy has %d polygons" % [count])
polygons_count += count
poly2_dummy = polygons(30 , 4 ).merged
count = poly2_dummy.count()
logger.info("poly2_dummy has %d polygons" % [count])
polygons_count += count
res_mk = polygons(110, 5 ).merged
count = res_mk.count()
logger.info("res_mk has %d polygons" % [count])
polygons_count += count
res_mk_type1 = polygons(26, 17 ).merged
count = res_mk_type1.count()
logger.info("res_mk_type1 has %d polygons" % [count])
polygons_count += count
ndmy = polygons(111, 5 ).merged
count = ndmy.count()
logger.info("ndmy has %d polygons" % [count])
polygons_count += count
ind_mk = polygons(151, 5 ).merged
count = ind_mk.count()
logger.info("ind_mk has %d polygons" % [count])
polygons_count += count
diode_mk = polygons(115, 5 ).merged
count = diode_mk.count()
logger.info("diode_mk has %d polygons" % [count])
polygons_count += count
lvs_bjt = polygons(118, 5 ).merged
count = lvs_bjt.count()
logger.info("lvs_bjt has %d polygons" % [count])
polygons_count += count
guard_ring_mk = polygons(167, 5 ).merged
count = guard_ring_mk.count()
logger.info("guard_ring_mk has %d polygons" % [count])
polygons_count += count
sramcore_1 = polygons(101, 5 ).merged
sramcore_2 = polygons(102, 5 ).merged
sramcore_3 = polygons(103, 5 ).merged
sramcore_4 = polygons(105, 5 ).merged
sramcore_5 = polygons(108, 5 ).merged
sramcore = sramcore_1.or(sramcore_2).or(sramcore_3).or(sramcore_4).or(sramcore_5)
count = sramcore.count()
logger.info("sramcore has %d polygons" % [count])
polygons_count += count
lvs_rf = polygons(100, 5 ).merged
count = lvs_rf.count()
logger.info("lvs_rf has %d polygons" % [count])
polygons_count += count
lvs_drain = polygons(100, 7 ).merged
count = lvs_drain.count()
logger.info("lvs_drain has %d polygons" % [count])
polygons_count += count
lvs_io = polygons(119, 5 ).merged
count = lvs_io.count()
logger.info("lvs_io has %d polygons" % [count])
polygons_count += count
probe_mk = polygons(13 , 17).merged
count = probe_mk.count()
logger.info("probe_mk has %d polygons" % [count])
polygons_count += count
lvs_source = polygons(100, 8 ).merged
count = lvs_source.count()
logger.info("lvs_source has %d polygons" % [count])
polygons_count += count
well_diode_mk = polygons(153, 51).merged
count = well_diode_mk.count()
logger.info("well_diode_mk has %d polygons" % [count])
polygons_count += count
plfuse = polygons(125, 5 ).merged
count = plfuse.count()
logger.info("plfuse has %d polygons" % [count])
polygons_count += count
efuse_mk = polygons(80 , 5 ).merged
count = efuse_mk.count()
logger.info("efuse_mk has %d polygons" % [count])
polygons_count += count
mcell_feol_mk = polygons(11 , 17).merged
count = mcell_feol_mk.count()
logger.info("mcell_feol_mk has %d polygons" % [count])
polygons_count += count
comp_label = polygons(22 , 10).merged
count = comp_label.count()
logger.info("comp_label has %d polygons" % [count])
polygons_count += count
poly2_label = polygons(30 , 10).merged
count = poly2_label.count()
logger.info("poly2_label has %d polygons" % [count])
polygons_count += count
mdiode = polygons(116, 5 ).merged
count = mdiode.count()
logger.info("mdiode has %d polygons" % [count])
polygons_count += count
contact = polygons(33 , 0 ).merged
count = contact.count()
logger.info("contact has %d polygons" % [count])
polygons_count += count
metal1_drawn = polygons(34, 0).merged
count = metal1_drawn.count
logger.info("metal1_drawn has #{count} polygons")
polygons_count += count
metal1_dummy = polygons(34, 4).merged
count = metal1_dummy.count
logger.info("metal1_dummy has #{count} polygons")
polygons_count += count
metal1 = metal1_drawn + metal1_dummy
metal1_label = polygons(34, 10).merged
count = metal1_label.count
logger.info("metal1_label has #{count} polygons")
polygons_count += count
metal1_slot = polygons(34, 3).merged
count = metal1_slot.count
logger.info("metal1_slot has #{count} polygons")
polygons_count += count
metal1_blk = polygons(34, 5).merged
count = metal1_blk.count
logger.info("metal1_blk has #{count} polygons")
polygons_count += count
via1 = polygons(35, 0).merged
count = via1.count
logger.info("via1 has #{count} polygons")
polygons_count += count
metal2_drawn = polygons(36, 0).merged
count = metal2_drawn.count
logger.info("metal2_drawn has #{count} polygons")
polygons_count += count
metal2_dummy = polygons(36, 4).merged
count = metal2_dummy.count
logger.info("metal2_dummy has #{count} polygons")
polygons_count += count
metal2 = metal2_drawn + metal2_dummy
metal2_label = polygons(36, 10).merged
count = metal2_label.count
logger.info("metal2_label has #{count} polygons")
polygons_count += count
metal2_slot = polygons(36, 3).merged
count = metal2_slot.count
logger.info("metal2_slot has #{count} polygons")
polygons_count += count
metal2_blk = polygons(36, 5).merged
count = metal2_blk.count
logger.info("metal2_blk has #{count} polygons")
polygons_count += count
if METAL_LEVEL == '2LM'
top_via = via1
topmin1_via = contact
top_metal = metal2
topmin1_metal = metal1
else
via2 = polygons(38, 0).merged
count = via2.count
logger.info("via2 has #{count} polygons")
polygons_count += count
metal3_drawn = polygons(42, 0).merged
count = metal3_drawn.count
logger.info("metal3_drawn has #{count} polygons")
polygons_count += count
metal3_dummy = polygons(42, 4).merged
count = metal3_dummy.count
logger.info("metal3_dummy has #{count} polygons")
polygons_count += count
metal3 = metal3_drawn + metal3_dummy
metal3_label = polygons(42, 10).merged
count = metal3_label.count
logger.info("metal3_label has #{count} polygons")
polygons_count += count
metal3_slot = polygons(42, 3).merged
count = metal3_slot.count
logger.info("metal3_slot has #{count} polygons")
polygons_count += count
metal3_blk = polygons(42, 5).merged
count = metal3_blk.count
logger.info("metal3_blk has #{count} polygons")
polygons_count += count
if METAL_LEVEL == '3LM'
top_via = via2
topmin1_via = via1
top_metal = metal3
topmin1_metal = metal2
topmin2_metal = metal1
else
via3 = polygons(40, 0).merged
count = via3.count
logger.info("via3 has #{count} polygons")
polygons_count += count
metal4_drawn = polygons(46, 0).merged
count = metal4_drawn.count
logger.info("metal4_drawn has #{count} polygons")
polygons_count += count
metal4_dummy = polygons(46, 4).merged
count = metal4_dummy.count
logger.info("metal4_dummy has #{count} polygons")
polygons_count += count
metal4 = metal4_drawn + metal4_dummy
metal4_label = polygons(46, 10).merged
count = metal4_label.count
logger.info("metal4_label has #{count} polygons")
polygons_count += count
metal4_slot = polygons(46, 3).merged
count = metal4_slot.count
logger.info("metal4_slot has #{count} polygons")
polygons_count += count
metal4_blk = polygons(46, 5).merged
count = metal4_blk.count
logger.info("metal4_blk has #{count} polygons")
polygons_count += count
if METAL_LEVEL == '4LM'
top_via = via3
topmin1_via = via2
top_metal = metal4
topmin1_metal = metal3
topmin2_metal = metal2
else
via4 = polygons(41, 0).merged
count = via4.count
logger.info("via4 has #{count} polygons")
polygons_count += count
case METAL_LEVEL
when '5LM'
metal5_drawn = polygons(81, 0).merged
count = metal5_drawn.count
logger.info("metal5_drawn has #{count} polygons")
polygons_count += count
metal5_dummy = polygons(81, 4).merged
count = metal5_dummy.count
logger.info("metal5_dummy has #{count} polygons")
polygons_count += count
metal5 = metal5_drawn + metal5_dummy
metal5_label = polygons(81, 10).merged
count = metal5_label.count
logger.info("metal5_label has #{count} polygons")
polygons_count += count
metal5_slot = polygons(81, 3).merged
count = metal5_slot.count
logger.info("metal5_slot has #{count} polygons")
polygons_count += count
metal5_blk = polygons(81, 5).merged
count = metal5_blk.count
logger.info("metal5_blk has #{count} polygons")
polygons_count += count
top_via = via4
topmin1_via = via3
top_metal = metal5
topmin1_metal = metal4
topmin2_metal = metal3
when '6LM'
metal5_drawn = polygons(81, 0).merged
count = metal5_drawn.count
logger.info("metal5_drawn has #{count} polygons")
polygons_count += count
metal5_dummy = polygons(81, 4).merged
count = metal5_dummy.count
logger.info("metal5_dummy has #{count} polygons")
polygons_count += count
metal5 = metal5_drawn + metal5_dummy
metal5_label = polygons(81, 10).merged
count = metal5_label.count
logger.info("metal5_label has #{count} polygons")
polygons_count += count
metal5_slot = polygons(81, 3).merged
count = metal5_slot.count
logger.info("metal5_slot has #{count} polygons")
polygons_count += count
metal5_blk = polygons(81, 5).merged
count = metal5_blk.count
logger.info("metal5_blk has #{count} polygons")
polygons_count += count
via5 = polygons(82, 0).merged
count = via5.count
logger.info("via5 has #{count} polygons")
polygons_count += count
metaltop_drawn = polygons(53, 0).merged
count = metaltop_drawn.count
logger.info("metaltop_drawn has #{count} polygons")
polygons_count += count
metaltop_dummy = polygons(53, 4).merged
count = metaltop_dummy.count
logger.info("metaltop_dummy has #{count} polygons")
polygons_count += count
metaltop = metaltop_drawn + metaltop_dummy
metaltop_label = polygons(53, 10).merged
count = metaltop_label.count
logger.info("metaltop_label has #{count} polygons")
polygons_count += count
metaltop_slot = polygons(53, 3).merged
count = metaltop_slot.count
logger.info("metaltop_slot has #{count} polygons")
polygons_count += count
metalt_blk = polygons(53, 5).merged
count = metalt_blk.count
logger.info("metalt_blk has #{count} polygons")
polygons_count += count
top_via = via5
topmin1_via = via4
top_metal = metaltop
topmin1_metal = metal5
topmin2_metal = metal4
else
logger.error("Unknown metal stack #{METAL_LEVEL}")
raise
end
end
end
end
metalrdl = polygons(171 , 0 ).merged
count = metalrdl.count()
logger.info("metalrdl has %d polygons" % [count])
polygons_count += count
metalrdl_label = polygons(171 , 10 ).merged
count = metalrdl_label.count()
logger.info("metalrdl_label has %d polygons" % [count])
polygons_count += count
viardl = polygons(170 , 0 ).merged
count = viardl.count()
logger.info("viardl has %d polygons" % [count])
polygons_count += count
piscap = polygons(120 , 0 ).merged
count = piscap.count()
logger.info("piscap has %d polygons" % [count])
polygons_count += count
lvs_cap = polygons(117 , 5 ).merged
count = lvs_cap.count()
logger.info("lvs_cap has %d polygons" % [count])
polygons_count += count
pad = polygons(37 , 0 ).merged
count = pad.count()
logger.info("pad has %d polygons" % [count])
polygons_count += count
pad_label = polygons(37 , 10 ).merged
count = pad_label.count()
logger.info("pad_label has %d polygons" % [count])
polygons_count += count
ubmpperi = polygons(183, 0 ).merged
count = ubmpperi.count()
logger.info("ubmpperi has %d polygons" % [count])
polygons_count += count
ubmparray = polygons(184, 0 ).merged
count = ubmparray.count()
logger.info("ubmparray has %d polygons" % [count])
polygons_count += count
ubmeplate = polygons(185, 0 ).merged
count = ubmeplate.count()
logger.info("ubmeplate has %d polygons" % [count])
polygons_count += count
pr_bndry = polygons(0 , 0 ).merged
count = pr_bndry.count()
logger.info("pr_bndry has %d polygons" % [count])
polygons_count += count
logger.info("Total no. of polygons in the design is #{polygons_count}")
logger.info("Starting deriving base layers.")
#=== BULK LAYER ===
sub = polygon_layer