Jeff DiCorpo | c30047f | 2022-12-12 23:59:37 -0800 | [diff] [blame^] | 1 | ################################################################################################ |
| 2 | # Copyright 2022 GlobalFoundries PDK Authors |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | ################################################################################################ |
| 16 | |
| 17 | #=========================================================================================================================== |
| 18 | #------------------------------------------- GF 0.18um MCU DRC RULE DECK -------------------------------------------------- |
| 19 | #=========================================================================================================================== |
| 20 | require 'time' |
| 21 | require "logger" |
| 22 | |
| 23 | exec_start_time = Time.now |
| 24 | |
| 25 | logger = Logger.new(STDOUT) |
| 26 | |
| 27 | logger.formatter = proc do |severity, datetime, progname, msg| |
| 28 | "#{datetime}: Memory Usage (" + `pmap #{Process.pid} | tail -1`[10,40].strip + ") : #{msg} |
| 29 | " |
| 30 | end |
| 31 | |
| 32 | #================================================ |
| 33 | #----------------- FILE SETUP ------------------- |
| 34 | #================================================ |
| 35 | |
| 36 | # optional for a batch launch : klayout -b -r gf_018mcu.drc -rd input=design.gds -rd report=gp180_drc.lyrdb |
| 37 | |
| 38 | logger.info("Starting running GF180MCU Klayout DRC runset on %s" % [$input]) |
| 39 | logger.info("Ruby Version for klayout: %s" % [RUBY_VERSION]) |
| 40 | |
| 41 | if $input |
| 42 | if $topcell |
| 43 | source($input, $topcell) |
| 44 | else |
| 45 | source($input) |
| 46 | end |
| 47 | end |
| 48 | |
| 49 | if $table_name |
| 50 | table_name = $table_name |
| 51 | else |
| 52 | table_name = "main" |
| 53 | end |
| 54 | |
| 55 | |
| 56 | logger.info("Loading database to memory is complete.") |
| 57 | |
| 58 | if $report |
| 59 | logger.info("GF180MCU Klayout DRC runset output at: %s" % [$report]) |
| 60 | report("DRC Run Report at", $report) |
| 61 | else |
| 62 | logger.info("GF180MCU Klayout DRC runset output at default location." % [File.join(File.dirname(RBA::CellView::active.filename), "gf180_drc.lyrdb")]) |
| 63 | report("DRC Run Report at", File.join(File.dirname(RBA::CellView::active.filename), "gf180_drc.lyrdb")) |
| 64 | end |
| 65 | |
| 66 | #================================================ |
| 67 | #------------------ SWITCHES -------------------- |
| 68 | #================================================ |
| 69 | logger.info("Evaluate switches.") |
| 70 | |
| 71 | # connectivity rules |
| 72 | if $conn_drc == "true" |
| 73 | CONNECTIVITY_RULES = $conn_drc |
| 74 | logger.info("connectivity rules are enabled.") |
| 75 | else |
| 76 | CONNECTIVITY_RULES = false |
| 77 | logger.info("connectivity rules are disabled.") |
| 78 | end # connectivity rules |
| 79 | |
| 80 | # WEDGE |
| 81 | if $wedge == "false" |
| 82 | WEDGE = $wedge |
| 83 | else |
| 84 | WEDGE = "true" |
| 85 | end # WEDGE |
| 86 | |
| 87 | logger.info("Wedge enabled %s" % [WEDGE]) |
| 88 | |
| 89 | # BALL |
| 90 | if $ball == "false" |
| 91 | BALL = $ball |
| 92 | else |
| 93 | BALL = "true" |
| 94 | end # BALL |
| 95 | |
| 96 | logger.info("Ball enabled %s" % [BALL]) |
| 97 | |
| 98 | # GOLD |
| 99 | if $gold == "false" |
| 100 | GOLD = $gold |
| 101 | else |
| 102 | GOLD = "true" |
| 103 | end # GOLD |
| 104 | |
| 105 | logger.info("Gold enabled %s" % [GOLD]) |
| 106 | |
| 107 | if $mim_option |
| 108 | MIM_OPTION = $mim_option |
| 109 | else |
| 110 | MIM_OPTION = "B" |
| 111 | end |
| 112 | |
| 113 | logger.info("MIM Option selected %s" % [MIM_OPTION]) |
| 114 | |
| 115 | # OFFGRID |
| 116 | if $offgrid == "false" |
| 117 | OFFGRID = false |
| 118 | else |
| 119 | OFFGRID = true |
| 120 | end # OFFGRID |
| 121 | |
| 122 | logger.info("Offgrid enabled %s" % [OFFGRID]) |
| 123 | |
| 124 | if $thr |
| 125 | threads($thr) |
| 126 | logger.info("Number of threads to use %s" % [$thr]) |
| 127 | else |
| 128 | threads(%x("nproc")) |
| 129 | logger.info("Number of threads to use #{%x("nproc")}") |
| 130 | end |
| 131 | |
| 132 | #=== PRINT DETAILS === |
| 133 | if $verbose == "true" |
| 134 | logger.info("Verbose mode: #{$verbose}") |
| 135 | verbose(true) |
| 136 | else |
| 137 | verbose(false) |
| 138 | logger.info("Verbose mode: false") |
| 139 | end |
| 140 | |
| 141 | # === TILING MODE === |
| 142 | if $run_mode == "tiling" |
| 143 | tiles(500.um) |
| 144 | tile_borders(10.um) |
| 145 | logger.info("Tiling mode is enabled.") |
| 146 | |
| 147 | elsif $run_mode == "deep" |
| 148 | #=== HIER MODE === |
| 149 | deep |
| 150 | logger.info("deep mode is enabled.") |
| 151 | else |
| 152 | #=== FLAT MODE === |
| 153 | flat |
| 154 | logger.info("flat mode is enabled.") |
| 155 | end # run_mode |
| 156 | |
| 157 | # METAL_TOP |
| 158 | if $metal_top |
| 159 | METAL_TOP = $metal_top |
| 160 | else |
| 161 | METAL_TOP = "9K" |
| 162 | end # METAL_TOP |
| 163 | |
| 164 | logger.info("METAL_TOP Selected is %s" % [METAL_TOP]) |
| 165 | |
| 166 | # METAL_LEVEL |
| 167 | if $metal_level |
| 168 | METAL_LEVEL = $metal_level |
| 169 | else |
| 170 | METAL_LEVEL = "5LM" |
| 171 | end # METAL_LEVEL |
| 172 | |
| 173 | logger.info("METAL_STACK Selected is %s" % [METAL_LEVEL]) |
| 174 | |
| 175 | # FEOL |
| 176 | if $feol == "false" |
| 177 | FEOL = $feol |
| 178 | logger.info("FEOL is disabled.") |
| 179 | else |
| 180 | FEOL = "true" |
| 181 | logger.info("FEOL is enabled.") |
| 182 | end # FEOL |
| 183 | |
| 184 | # BEOL |
| 185 | if $beol == "false" |
| 186 | BEOL = $beol |
| 187 | logger.info("BEOL is disabled.") |
| 188 | else |
| 189 | BEOL = "true" |
| 190 | logger.info("BEOL is enabled.") |
| 191 | end # BEOL |
| 192 | |
| 193 | #================================================ |
| 194 | #------------- LAYERS DEFINITIONS --------------- |
| 195 | #================================================ |
| 196 | polygons_count = 0 |
| 197 | logger.info("Read in polygons from layers.") |
| 198 | |
| 199 | def get_polygons(l, d) |
| 200 | if $run_mode == "deep" |
| 201 | polygons(l, d) |
| 202 | else |
| 203 | polygons(l, d).merged |
| 204 | end |
| 205 | end |
| 206 | |
| 207 | comp = get_polygons(22 , 0 ) |
| 208 | count = comp.count() |
| 209 | logger.info("comp has %d polygons" % [count]) |
| 210 | polygons_count += count |
| 211 | |
| 212 | dnwell = get_polygons(12 , 0 ) |
| 213 | count = dnwell.count() |
| 214 | logger.info("dnwell has %d polygons" % [count]) |
| 215 | polygons_count += count |
| 216 | |
| 217 | nwell = get_polygons(21 , 0 ) |
| 218 | count = nwell.count() |
| 219 | logger.info("nwell has %d polygons" % [count]) |
| 220 | polygons_count += count |
| 221 | |
| 222 | lvpwell = get_polygons(204, 0 ) |
| 223 | count = lvpwell.count() |
| 224 | logger.info("lvpwell has %d polygons" % [count]) |
| 225 | polygons_count += count |
| 226 | |
| 227 | dualgate = get_polygons(55 , 0 ) |
| 228 | count = dualgate.count() |
| 229 | logger.info("dualgate has %d polygons" % [count]) |
| 230 | polygons_count += count |
| 231 | |
| 232 | poly2 = get_polygons(30 , 0 ) |
| 233 | count = poly2.count() |
| 234 | logger.info("poly2 has %d polygons" % [count]) |
| 235 | polygons_count += count |
| 236 | |
| 237 | nplus = get_polygons(32 , 0 ) |
| 238 | count = nplus.count() |
| 239 | logger.info("nplus has %d polygons" % [count]) |
| 240 | polygons_count += count |
| 241 | |
| 242 | pplus = get_polygons(31 , 0 ) |
| 243 | count = pplus.count() |
| 244 | logger.info("pplus has %d polygons" % [count]) |
| 245 | polygons_count += count |
| 246 | |
| 247 | sab = get_polygons(49 , 0 ) |
| 248 | count = sab.count() |
| 249 | logger.info("sab has %d polygons" % [count]) |
| 250 | polygons_count += count |
| 251 | |
| 252 | esd = get_polygons(24 , 0 ) |
| 253 | count = esd.count() |
| 254 | logger.info("esd has %d polygons" % [count]) |
| 255 | polygons_count += count |
| 256 | |
| 257 | resistor = get_polygons(62 , 0 ) |
| 258 | count = resistor.count() |
| 259 | logger.info("resistor has %d polygons" % [count]) |
| 260 | polygons_count += count |
| 261 | |
| 262 | fhres = get_polygons(227, 0 ) |
| 263 | count = fhres.count() |
| 264 | logger.info("fhres has %d polygons" % [count]) |
| 265 | polygons_count += count |
| 266 | |
| 267 | fusetop = get_polygons(75 , 0 ) |
| 268 | count = fusetop.count() |
| 269 | logger.info("fusetop has %d polygons" % [count]) |
| 270 | polygons_count += count |
| 271 | |
| 272 | fusewindow_d = get_polygons(96 , 1 ) |
| 273 | count = fusewindow_d.count() |
| 274 | logger.info("fusewindow_d has %d polygons" % [count]) |
| 275 | polygons_count += count |
| 276 | |
| 277 | polyfuse = get_polygons(220, 0 ) |
| 278 | count = polyfuse.count() |
| 279 | logger.info("polyfuse has %d polygons" % [count]) |
| 280 | polygons_count += count |
| 281 | |
| 282 | mvsd = get_polygons(210, 0 ) |
| 283 | count = mvsd.count() |
| 284 | logger.info("mvsd has %d polygons" % [count]) |
| 285 | polygons_count += count |
| 286 | |
| 287 | mvpsd = get_polygons(11 , 39) |
| 288 | count = mvpsd.count() |
| 289 | logger.info("mvpsd has %d polygons" % [count]) |
| 290 | polygons_count += count |
| 291 | |
| 292 | nat = get_polygons(5 , 0 ) |
| 293 | count = nat.count() |
| 294 | logger.info("nat has %d polygons" % [count]) |
| 295 | polygons_count += count |
| 296 | |
| 297 | comp_dummy = get_polygons(22 , 4 ) |
| 298 | count = comp_dummy.count() |
| 299 | logger.info("comp_dummy has %d polygons" % [count]) |
| 300 | polygons_count += count |
| 301 | |
| 302 | poly2_dummy = get_polygons(30 , 4 ) |
| 303 | count = poly2_dummy.count() |
| 304 | logger.info("poly2_dummy has %d polygons" % [count]) |
| 305 | polygons_count += count |
| 306 | |
| 307 | schottky_diode = get_polygons(241, 0 ) |
| 308 | count = schottky_diode.count() |
| 309 | logger.info("schottky_diode has %d polygons" % [count]) |
| 310 | polygons_count += count |
| 311 | |
| 312 | zener = get_polygons(178, 0 ) |
| 313 | count = zener.count() |
| 314 | logger.info("zener has %d polygons" % [count]) |
| 315 | polygons_count += count |
| 316 | |
| 317 | res_mk = get_polygons(110, 5 ) |
| 318 | count = res_mk.count() |
| 319 | logger.info("res_mk has %d polygons" % [count]) |
| 320 | polygons_count += count |
| 321 | |
| 322 | opc_drc = get_polygons(124, 5 ) |
| 323 | count = opc_drc.count() |
| 324 | logger.info("opc_drc has %d polygons" % [count]) |
| 325 | polygons_count += count |
| 326 | |
| 327 | ndmy = get_polygons(111, 5 ) |
| 328 | count = ndmy.count() |
| 329 | logger.info("ndmy has %d polygons" % [count]) |
| 330 | polygons_count += count |
| 331 | |
| 332 | pmndmy = get_polygons(152, 5 ) |
| 333 | count = pmndmy.count() |
| 334 | logger.info("pmndmy has %d polygons" % [count]) |
| 335 | polygons_count += count |
| 336 | |
| 337 | v5_xtor = get_polygons(112, 1 ) |
| 338 | count = v5_xtor.count() |
| 339 | logger.info("v5_xtor has %d polygons" % [count]) |
| 340 | polygons_count += count |
| 341 | |
| 342 | cap_mk = get_polygons(117, 5 ) |
| 343 | count = cap_mk.count() |
| 344 | logger.info("cap_mk has %d polygons" % [count]) |
| 345 | polygons_count += count |
| 346 | |
| 347 | mos_cap_mk = get_polygons(166, 5 ) |
| 348 | count = mos_cap_mk.count() |
| 349 | logger.info("mos_cap_mk has %d polygons" % [count]) |
| 350 | polygons_count += count |
| 351 | |
| 352 | ind_mk = get_polygons(151, 5 ) |
| 353 | count = ind_mk.count() |
| 354 | logger.info("ind_mk has %d polygons" % [count]) |
| 355 | polygons_count += count |
| 356 | |
| 357 | diode_mk = get_polygons(115, 5 ) |
| 358 | count = diode_mk.count() |
| 359 | logger.info("diode_mk has %d polygons" % [count]) |
| 360 | polygons_count += count |
| 361 | |
| 362 | drc_bjt = get_polygons(127, 5 ) |
| 363 | count = drc_bjt.count() |
| 364 | logger.info("drc_bjt has %d polygons" % [count]) |
| 365 | polygons_count += count |
| 366 | |
| 367 | lvs_bjt = get_polygons(118, 5 ) |
| 368 | count = lvs_bjt.count() |
| 369 | logger.info("lvs_bjt has %d polygons" % [count]) |
| 370 | polygons_count += count |
| 371 | |
| 372 | mim_l_mk = get_polygons(117, 10) |
| 373 | count = mim_l_mk.count() |
| 374 | logger.info("mim_l_mk has %d polygons" % [count]) |
| 375 | polygons_count += count |
| 376 | |
| 377 | latchup_mk = get_polygons(137, 5 ) |
| 378 | count = latchup_mk.count() |
| 379 | logger.info("latchup_mk has %d polygons" % [count]) |
| 380 | polygons_count += count |
| 381 | |
| 382 | guard_ring_mk = get_polygons(167, 5 ) |
| 383 | count = guard_ring_mk.count() |
| 384 | logger.info("guard_ring_mk has %d polygons" % [count]) |
| 385 | polygons_count += count |
| 386 | |
| 387 | otp_mk = get_polygons(173, 5 ) |
| 388 | count = otp_mk.count() |
| 389 | logger.info("otp_mk has %d polygons" % [count]) |
| 390 | polygons_count += count |
| 391 | |
| 392 | mtpmark = get_polygons(122, 5 ) |
| 393 | count = mtpmark.count() |
| 394 | logger.info("mtpmark has %d polygons" % [count]) |
| 395 | polygons_count += count |
| 396 | |
| 397 | neo_ee_mk = get_polygons(88 , 17) |
| 398 | count = neo_ee_mk.count() |
| 399 | logger.info("neo_ee_mk has %d polygons" % [count]) |
| 400 | polygons_count += count |
| 401 | |
| 402 | sramcore = get_polygons(108, 5 ) |
| 403 | count = sramcore.count() |
| 404 | logger.info("sramcore has %d polygons" % [count]) |
| 405 | polygons_count += count |
| 406 | |
| 407 | lvs_rf = get_polygons(100, 5 ) |
| 408 | count = lvs_rf.count() |
| 409 | logger.info("lvs_rf has %d polygons" % [count]) |
| 410 | polygons_count += count |
| 411 | |
| 412 | lvs_drain = get_polygons(100, 7 ) |
| 413 | count = lvs_drain.count() |
| 414 | logger.info("lvs_drain has %d polygons" % [count]) |
| 415 | polygons_count += count |
| 416 | |
| 417 | ind_mk = get_polygons(151, 5 ) |
| 418 | count = ind_mk.count() |
| 419 | logger.info("ind_mk has %d polygons" % [count]) |
| 420 | polygons_count += count |
| 421 | |
| 422 | hvpolyrs = get_polygons(123, 5 ) |
| 423 | count = hvpolyrs.count() |
| 424 | logger.info("hvpolyrs has %d polygons" % [count]) |
| 425 | polygons_count += count |
| 426 | |
| 427 | lvs_io = get_polygons(119, 5 ) |
| 428 | count = lvs_io.count() |
| 429 | logger.info("lvs_io has %d polygons" % [count]) |
| 430 | polygons_count += count |
| 431 | |
| 432 | probe_mk = get_polygons(13 , 17) |
| 433 | count = probe_mk.count() |
| 434 | logger.info("probe_mk has %d polygons" % [count]) |
| 435 | polygons_count += count |
| 436 | |
| 437 | esd_mk = get_polygons(24 , 5 ) |
| 438 | count = esd_mk.count() |
| 439 | logger.info("esd_mk has %d polygons" % [count]) |
| 440 | polygons_count += count |
| 441 | |
| 442 | lvs_source = get_polygons(100, 8 ) |
| 443 | count = lvs_source.count() |
| 444 | logger.info("lvs_source has %d polygons" % [count]) |
| 445 | polygons_count += count |
| 446 | |
| 447 | well_diode_mk = get_polygons(153, 51) |
| 448 | count = well_diode_mk.count() |
| 449 | logger.info("well_diode_mk has %d polygons" % [count]) |
| 450 | polygons_count += count |
| 451 | |
| 452 | ldmos_xtor = get_polygons(226, 0 ) |
| 453 | count = ldmos_xtor.count() |
| 454 | logger.info("ldmos_xtor has %d polygons" % [count]) |
| 455 | polygons_count += count |
| 456 | |
| 457 | plfuse = get_polygons(125, 5 ) |
| 458 | count = plfuse.count() |
| 459 | logger.info("plfuse has %d polygons" % [count]) |
| 460 | polygons_count += count |
| 461 | |
| 462 | efuse_mk = get_polygons(80 , 5 ) |
| 463 | count = efuse_mk.count() |
| 464 | logger.info("efuse_mk has %d polygons" % [count]) |
| 465 | polygons_count += count |
| 466 | |
| 467 | mcell_feol_mk = get_polygons(11 , 17) |
| 468 | count = mcell_feol_mk.count() |
| 469 | logger.info("mcell_feol_mk has %d polygons" % [count]) |
| 470 | polygons_count += count |
| 471 | |
| 472 | ymtp_mk = get_polygons(86 , 17) |
| 473 | count = ymtp_mk.count() |
| 474 | logger.info("ymtp_mk has %d polygons" % [count]) |
| 475 | polygons_count += count |
| 476 | |
| 477 | dev_wf_mk = get_polygons(128, 17) |
| 478 | count = dev_wf_mk.count() |
| 479 | logger.info("dev_wf_mk has %d polygons" % [count]) |
| 480 | polygons_count += count |
| 481 | |
| 482 | comp_label = get_polygons(22 , 10) |
| 483 | count = comp_label.count() |
| 484 | logger.info("comp_label has %d polygons" % [count]) |
| 485 | polygons_count += count |
| 486 | |
| 487 | poly2_label = get_polygons(30 , 10) |
| 488 | count = poly2_label.count() |
| 489 | logger.info("poly2_label has %d polygons" % [count]) |
| 490 | polygons_count += count |
| 491 | |
| 492 | mdiode = get_polygons(116, 5 ) |
| 493 | count = mdiode.count() |
| 494 | logger.info("mdiode has %d polygons" % [count]) |
| 495 | polygons_count += count |
| 496 | |
| 497 | contact = get_polygons(33 , 0 ) |
| 498 | count = contact.count() |
| 499 | logger.info("contact has %d polygons" % [count]) |
| 500 | polygons_count += count |
| 501 | |
| 502 | metal1_drawn = get_polygons(34 , 0 ) |
| 503 | count = metal1_drawn.count() |
| 504 | logger.info("metal1_drawn has %d polygons" % [count]) |
| 505 | polygons_count += count |
| 506 | |
| 507 | metal1_dummy = get_polygons(34 , 4 ) |
| 508 | count = metal1_dummy.count() |
| 509 | logger.info("metal1_dummy has %d polygons" % [count]) |
| 510 | polygons_count += count |
| 511 | |
| 512 | metal1 = metal1_drawn + metal1_dummy |
| 513 | |
| 514 | metal1_label = get_polygons(34 , 10) |
| 515 | count = metal1_label.count() |
| 516 | logger.info("metal1_label has %d polygons" % [count]) |
| 517 | polygons_count += count |
| 518 | |
| 519 | metal1_slot = get_polygons(34 , 3 ) |
| 520 | count = metal1_slot.count() |
| 521 | logger.info("metal1_slot has %d polygons" % [count]) |
| 522 | polygons_count += count |
| 523 | |
| 524 | metal1_blk = get_polygons(34 , 5 ) |
| 525 | count = metal1_blk.count() |
| 526 | logger.info("metal1_blk has %d polygons" % [count]) |
| 527 | polygons_count += count |
| 528 | |
| 529 | via1 = get_polygons(35 , 0 ) |
| 530 | count = via1.count() |
| 531 | logger.info("via1 has %d polygons" % [count]) |
| 532 | polygons_count += count |
| 533 | |
| 534 | |
| 535 | if METAL_LEVEL == "2LM" |
| 536 | metal2_drawn = get_polygons(36 , 0 ) |
| 537 | count = metal2_drawn.count() |
| 538 | logger.info("metal2_drawn has %d polygons" % [count]) |
| 539 | polygons_count += count |
| 540 | |
| 541 | metal2_dummy = get_polygons(36 , 4 ) |
| 542 | count = metal2_dummy.count() |
| 543 | logger.info("metal2_dummy has %d polygons" % [count]) |
| 544 | polygons_count += count |
| 545 | |
| 546 | metal2 = metal2_drawn + metal2_drawn |
| 547 | |
| 548 | metal2_label = get_polygons(36 , 10) |
| 549 | count = metal2_label.count() |
| 550 | logger.info("metal2_label has %d polygons" % [count]) |
| 551 | polygons_count += count |
| 552 | |
| 553 | metal2_slot = get_polygons(36 , 3 ) |
| 554 | count = metal2_slot.count() |
| 555 | logger.info("metal2_slot has %d polygons" % [count]) |
| 556 | polygons_count += count |
| 557 | |
| 558 | metal2_blk = get_polygons(36 , 5 ) |
| 559 | count = metal2_blk.count() |
| 560 | logger.info("metal2_blk has %d polygons" % [count]) |
| 561 | polygons_count += count |
| 562 | |
| 563 | top_via = via1 |
| 564 | topmin1_via = contact |
| 565 | top_metal = metal2 |
| 566 | topmin1_metal = metal1 |
| 567 | |
| 568 | else |
| 569 | metal2_drawn = get_polygons(36 , 0 ) |
| 570 | count = metal2_drawn.count() |
| 571 | logger.info("metal2_drawn has %d polygons" % [count]) |
| 572 | polygons_count += count |
| 573 | |
| 574 | metal2_dummy = get_polygons(36 , 4 ) |
| 575 | count = metal2_dummy.count() |
| 576 | logger.info("metal2_dummy has %d polygons" % [count]) |
| 577 | polygons_count += count |
| 578 | |
| 579 | metal2 = metal2_drawn + metal2_dummy |
| 580 | |
| 581 | metal2_label = get_polygons(36 , 10) |
| 582 | count = metal2_label.count() |
| 583 | logger.info("metal2_label has %d polygons" % [count]) |
| 584 | polygons_count += count |
| 585 | |
| 586 | metal2_slot = get_polygons(36 , 3 ) |
| 587 | count = metal2_slot.count() |
| 588 | logger.info("metal2_slot has %d polygons" % [count]) |
| 589 | polygons_count += count |
| 590 | |
| 591 | metal2_blk = get_polygons(36 , 5 ) |
| 592 | count = metal2_blk.count() |
| 593 | logger.info("metal2_blk has %d polygons" % [count]) |
| 594 | polygons_count += count |
| 595 | |
| 596 | via2 = get_polygons(38 , 0 ) |
| 597 | count = via2.count() |
| 598 | logger.info("via2 has %d polygons" % [count]) |
| 599 | polygons_count += count |
| 600 | |
| 601 | if METAL_LEVEL == "3LM" |
| 602 | metal3_drawn = get_polygons(42 , 0 ) |
| 603 | count = metal3_drawn.count() |
| 604 | logger.info("metal3_drawn has %d polygons" % [count]) |
| 605 | polygons_count += count |
| 606 | |
| 607 | metal3_dummy = get_polygons(42 , 4 ) |
| 608 | count = metal3_dummy.count() |
| 609 | logger.info("metal3_dummy has %d polygons" % [count]) |
| 610 | polygons_count += count |
| 611 | |
| 612 | metal3 = metal3_drawn + metal3_dummy |
| 613 | |
| 614 | metal3_label = get_polygons(42 , 10) |
| 615 | count = metal3_label.count() |
| 616 | logger.info("metal3_label has %d polygons" % [count]) |
| 617 | polygons_count += count |
| 618 | |
| 619 | metal3_slot = get_polygons(42 , 3 ) |
| 620 | count = metal3_slot.count() |
| 621 | logger.info("metal3_slot has %d polygons" % [count]) |
| 622 | polygons_count += count |
| 623 | |
| 624 | metal3_blk = get_polygons(42 , 5 ) |
| 625 | count = metal3_blk.count() |
| 626 | logger.info("metal3_blk has %d polygons" % [count]) |
| 627 | polygons_count += count |
| 628 | |
| 629 | top_via = via2 |
| 630 | topmin1_via = via1 |
| 631 | top_metal = metal3 |
| 632 | topmin1_metal = metal2 |
| 633 | else |
| 634 | metal3_drawn = get_polygons(42 , 0 ) |
| 635 | count = metal3_drawn.count() |
| 636 | logger.info("metal3_drawn has %d polygons" % [count]) |
| 637 | polygons_count += count |
| 638 | |
| 639 | metal3_dummy = get_polygons(42 , 4 ) |
| 640 | count = metal3_dummy.count() |
| 641 | logger.info("metal3_dummy has %d polygons" % [count]) |
| 642 | polygons_count += count |
| 643 | |
| 644 | metal3 = metal3_drawn + metal3_dummy |
| 645 | |
| 646 | metal3_label = get_polygons(42 , 10) |
| 647 | count = metal3_label.count() |
| 648 | logger.info("metal3_label has %d polygons" % [count]) |
| 649 | polygons_count += count |
| 650 | |
| 651 | metal3_slot = get_polygons(42 , 3 ) |
| 652 | count = metal3_slot.count() |
| 653 | logger.info("metal3_slot has %d polygons" % [count]) |
| 654 | polygons_count += count |
| 655 | |
| 656 | metal3_blk = get_polygons(42 , 5 ) |
| 657 | count = metal3_blk.count() |
| 658 | logger.info("metal3_blk has %d polygons" % [count]) |
| 659 | polygons_count += count |
| 660 | |
| 661 | via3 = get_polygons(40 , 0 ) |
| 662 | |
| 663 | if METAL_LEVEL == "4LM" |
| 664 | metal4_drawn = get_polygons(46 , 0 ) |
| 665 | count = metal4_drawn.count() |
| 666 | logger.info("metal4_drawn has %d polygons" % [count]) |
| 667 | polygons_count += count |
| 668 | |
| 669 | metal4_dummy = get_polygons(46 , 4 ) |
| 670 | count = metal4_dummy.count() |
| 671 | logger.info("metal4_dummy has %d polygons" % [count]) |
| 672 | polygons_count += count |
| 673 | |
| 674 | metal4 = metal4_drawn + metal4_dummy |
| 675 | |
| 676 | metal4_label = get_polygons(46 , 10) |
| 677 | count = metal4_label.count() |
| 678 | logger.info("metal4_label has %d polygons" % [count]) |
| 679 | polygons_count += count |
| 680 | |
| 681 | metal4_slot = get_polygons(46 , 3 ) |
| 682 | count = metal4_slot.count() |
| 683 | logger.info("metal4_slot has %d polygons" % [count]) |
| 684 | polygons_count += count |
| 685 | |
| 686 | metal4_blk = get_polygons(46 , 5 ) |
| 687 | count = metal4_blk.count() |
| 688 | logger.info("metal4_blk has %d polygons" % [count]) |
| 689 | polygons_count += count |
| 690 | |
| 691 | top_via = via3 |
| 692 | topmin1_via = via2 |
| 693 | top_metal = metal4 |
| 694 | topmin1_metal = metal3 |
| 695 | else |
| 696 | metal4_drawn = get_polygons(46 , 0 ) |
| 697 | count = metal4_drawn.count() |
| 698 | logger.info("metal4_drawn has %d polygons" % [count]) |
| 699 | polygons_count += count |
| 700 | |
| 701 | metal4_dummy = get_polygons(46 , 4 ) |
| 702 | count = metal4_dummy.count() |
| 703 | logger.info("metal4_dummy has %d polygons" % [count]) |
| 704 | polygons_count += count |
| 705 | |
| 706 | metal4 = metal4_drawn + metal4_dummy |
| 707 | |
| 708 | metal4_label = get_polygons(46 , 10) |
| 709 | count = metal4_label.count() |
| 710 | logger.info("metal4_label has %d polygons" % [count]) |
| 711 | polygons_count += count |
| 712 | |
| 713 | metal4_slot = get_polygons(46 , 3 ) |
| 714 | count = metal4_slot.count() |
| 715 | logger.info("metal4_slot has %d polygons" % [count]) |
| 716 | polygons_count += count |
| 717 | |
| 718 | metal4_blk = get_polygons(46 , 5 ) |
| 719 | count = metal4_blk.count() |
| 720 | logger.info("metal4_blk has %d polygons" % [count]) |
| 721 | polygons_count += count |
| 722 | |
| 723 | via4 = get_polygons(41 , 0 ) |
| 724 | count = via4.count() |
| 725 | logger.info("via4 has %d polygons" % [count]) |
| 726 | polygons_count += count |
| 727 | |
| 728 | if METAL_LEVEL == "5LM" |
| 729 | metal5_drawn = get_polygons(81 , 0 ) |
| 730 | count = metal5_drawn.count() |
| 731 | logger.info("metal5_drawn has %d polygons" % [count]) |
| 732 | polygons_count += count |
| 733 | |
| 734 | metal5_dummy = get_polygons(81 , 4 ) |
| 735 | count = metal5_dummy.count() |
| 736 | logger.info("metal5_dummy has %d polygons" % [count]) |
| 737 | polygons_count += count |
| 738 | |
| 739 | metal5 = metal5_drawn + metal5_dummy |
| 740 | |
| 741 | metal5_label = get_polygons(81 , 10) |
| 742 | count = metal5_label.count() |
| 743 | logger.info("metal5_label has %d polygons" % [count]) |
| 744 | polygons_count += count |
| 745 | |
| 746 | metal5_slot = get_polygons(81 , 3 ) |
| 747 | count = metal5_slot.count() |
| 748 | logger.info("metal5_slot has %d polygons" % [count]) |
| 749 | polygons_count += count |
| 750 | |
| 751 | metal5_blk = get_polygons(81 , 5 ) |
| 752 | count = metal5_blk.count() |
| 753 | logger.info("metal5_blk has %d polygons" % [count]) |
| 754 | polygons_count += count |
| 755 | |
| 756 | top_via = via4 |
| 757 | topmin1_via = via3 |
| 758 | top_metal = metal5 |
| 759 | topmin1_metal = metal4 |
| 760 | else |
| 761 | ## 6LM |
| 762 | metal5_drawn = get_polygons(81 , 0 ) |
| 763 | count = metal5_drawn.count() |
| 764 | logger.info("metal5_drawn has %d polygons" % [count]) |
| 765 | polygons_count += count |
| 766 | |
| 767 | metal5_dummy = get_polygons(81 , 4 ) |
| 768 | count = metal5_dummy.count() |
| 769 | logger.info("metal5_dummy has %d polygons" % [count]) |
| 770 | polygons_count += count |
| 771 | |
| 772 | metal5 = metal5_drawn + metal5_dummy |
| 773 | |
| 774 | metal5_label = get_polygons(81 , 10) |
| 775 | count = metal5_label.count() |
| 776 | logger.info("metal5_label has %d polygons" % [count]) |
| 777 | polygons_count += count |
| 778 | |
| 779 | metal5_slot = get_polygons(81 , 3 ) |
| 780 | count = metal5_slot.count() |
| 781 | logger.info("metal5_slot has %d polygons" % [count]) |
| 782 | polygons_count += count |
| 783 | |
| 784 | metal5_blk = get_polygons(81 , 5 ) |
| 785 | count = metal5_blk.count() |
| 786 | logger.info("metal5_blk has %d polygons" % [count]) |
| 787 | polygons_count += count |
| 788 | |
| 789 | via5 = get_polygons(82 , 0 ) |
| 790 | count = via5.count() |
| 791 | logger.info("via5 has %d polygons" % [count]) |
| 792 | polygons_count += count |
| 793 | |
| 794 | |
| 795 | metaltop_drawn = get_polygons(53 , 0 ) |
| 796 | count = metaltop_drawn.count() |
| 797 | logger.info("metaltop_drawn has %d polygons" % [count]) |
| 798 | polygons_count += count |
| 799 | |
| 800 | metaltop_dummy = get_polygons(53 , 4 ) |
| 801 | count = metaltop_dummy.count() |
| 802 | logger.info("metaltop_dummy has %d polygons" % [count]) |
| 803 | polygons_count += count |
| 804 | |
| 805 | metaltop = metaltop_drawn + metaltop_dummy |
| 806 | |
| 807 | metaltop_label = get_polygons(53 , 10) |
| 808 | count = metaltop_label.count() |
| 809 | logger.info("metaltop_label has %d polygons" % [count]) |
| 810 | polygons_count += count |
| 811 | |
| 812 | metaltop_slot = get_polygons(53 , 3 ) |
| 813 | count = metaltop_slot.count() |
| 814 | logger.info("metaltop_slot has %d polygons" % [count]) |
| 815 | polygons_count += count |
| 816 | |
| 817 | metalt_blk = get_polygons(53 , 5 ) |
| 818 | count = metalt_blk.count() |
| 819 | logger.info("metalt_blk has %d polygons" % [count]) |
| 820 | polygons_count += count |
| 821 | |
| 822 | top_via = via5 |
| 823 | topmin1_via = via4 |
| 824 | top_metal = metaltop |
| 825 | topmin1_metal = metal5 |
| 826 | end |
| 827 | end |
| 828 | end |
| 829 | end |
| 830 | |
| 831 | pad = get_polygons(37 , 0 ) |
| 832 | count = pad.count() |
| 833 | logger.info("pad has %d polygons" % [count]) |
| 834 | polygons_count += count |
| 835 | |
| 836 | ubmpperi = get_polygons(183, 0 ) |
| 837 | count = ubmpperi.count() |
| 838 | logger.info("ubmpperi has %d polygons" % [count]) |
| 839 | polygons_count += count |
| 840 | |
| 841 | ubmparray = get_polygons(184, 0 ) |
| 842 | count = ubmparray.count() |
| 843 | logger.info("ubmparray has %d polygons" % [count]) |
| 844 | polygons_count += count |
| 845 | |
| 846 | ubmeplate = get_polygons(185, 0 ) |
| 847 | count = ubmeplate.count() |
| 848 | logger.info("ubmeplate has %d polygons" % [count]) |
| 849 | polygons_count += count |
| 850 | |
| 851 | metal1_res = get_polygons(110, 11) |
| 852 | count = metal1_res.count() |
| 853 | logger.info("metal1_res has %d polygons" % [count]) |
| 854 | polygons_count += count |
| 855 | |
| 856 | metal2_res = get_polygons(110, 12) |
| 857 | count = metal2_res.count() |
| 858 | logger.info("metal2_res has %d polygons" % [count]) |
| 859 | polygons_count += count |
| 860 | |
| 861 | metal3_res = get_polygons(110, 13) |
| 862 | count = metal3_res.count() |
| 863 | logger.info("metal3_res has %d polygons" % [count]) |
| 864 | polygons_count += count |
| 865 | |
| 866 | metal4_res = get_polygons(110, 14) |
| 867 | count = metal4_res.count() |
| 868 | logger.info("metal4_res has %d polygons" % [count]) |
| 869 | polygons_count += count |
| 870 | |
| 871 | metal5_res = get_polygons(110, 15) |
| 872 | count = metal5_res.count() |
| 873 | logger.info("metal5_res has %d polygons" % [count]) |
| 874 | polygons_count += count |
| 875 | |
| 876 | metal6_res = get_polygons(110, 16) |
| 877 | count = metal6_res.count() |
| 878 | logger.info("metal6_res has %d polygons" % [count]) |
| 879 | polygons_count += count |
| 880 | |
| 881 | pr_bndry = get_polygons(0 , 0 ) |
| 882 | count = pr_bndry.count() |
| 883 | logger.info("pr_bndry has %d polygons" % [count]) |
| 884 | polygons_count += count |
| 885 | |
| 886 | border = get_polygons(63 , 0 ) |
| 887 | count = border.count() |
| 888 | logger.info("border has %d polygons" % [count]) |
| 889 | polygons_count += count |
| 890 | logger.info("Total no. of polygons in the design is #{polygons_count}") |
| 891 | |
| 892 | logger.info("Starting deriving base layers.") |
| 893 | #===================================================== |
| 894 | #------------- BASE LAYERS DERIVATIONS --------------- |
| 895 | #===================================================== |
| 896 | |
| 897 | ncomp = comp & nplus |
| 898 | pcomp = comp & pplus |
| 899 | tgate = poly2 & comp |
| 900 | ngate = nplus & tgate |
| 901 | pgate = pplus & tgate |
| 902 | natcompsd = (nat & comp.interacting(poly2)) - tgate |
| 903 | |
| 904 | nom_gate = tgate.not(dualgate) |
| 905 | thick_gate = tgate.and(dualgate) |
| 906 | |
| 907 | ngate_56V = ngate.and(dualgate) |
| 908 | pgate_56V = pgate.and(dualgate) |
| 909 | |
| 910 | ngate_5V = ngate_56V.and(v5_xtor) |
| 911 | pgate_5V = pgate_56V.and(v5_xtor) |
| 912 | |
| 913 | ngate_6V = ngate_56V.not(v5_xtor) |
| 914 | pgate_6V = pgate_56V.not(v5_xtor) |
| 915 | |
| 916 | lvpwell_dn = lvpwell.interacting(dnwell) |
| 917 | lvpwell_out = lvpwell.not_interacting(dnwell) |
| 918 | |
| 919 | |
| 920 | #================================================ |
| 921 | #------------- LAYERS CONNECTIONS --------------- |
| 922 | #================================================ |
| 923 | |
| 924 | if CONNECTIVITY_RULES |
| 925 | |
| 926 | logger.info("Construct connectivity for the design.") |
| 927 | |
| 928 | connect(dnwell, ncomp) |
| 929 | connect(ncomp, contact) |
| 930 | connect(pcomp, contact) |
| 931 | |
| 932 | connect(lvpwell_out, pcomp) |
| 933 | connect(lvpwell_dn, pcomp) |
| 934 | |
| 935 | connect(nwell, ncomp) |
| 936 | connect(natcompsd, contact) |
| 937 | connect(mvsd, ncomp) |
| 938 | connect(mvpsd, pcomp) |
| 939 | connect(contact, metal1) |
| 940 | connect(metal1, via1) |
| 941 | connect(via1, metal2) |
| 942 | if METAL_LEVEL != "2LM" |
| 943 | connect(metal2, via2) |
| 944 | connect(via2, metal3) |
| 945 | |
| 946 | if METAL_LEVEL != "3LM" |
| 947 | connect(metal3, via3) |
| 948 | connect(via3, metal4) |
| 949 | |
| 950 | if METAL_LEVEL != "4LM" |
| 951 | connect(metal4, via4) |
| 952 | connect(via4, metal5) |
| 953 | |
| 954 | if METAL_LEVEL != "5LM" |
| 955 | connect(metal5, via5) |
| 956 | connect(via5, metaltop) |
| 957 | end |
| 958 | end |
| 959 | end |
| 960 | end |
| 961 | |
| 962 | end #CONNECTIVITY_RULES |
| 963 | |
| 964 | #================================================ |
| 965 | #------------ PRE-DEFINED FUNCTIONS ------------- |
| 966 | #================================================ |
| 967 | |
| 968 | def conn_space(layer,conn_val,not_conn_val, mode) |
| 969 | if conn_val > not_conn_val |
| 970 | raise "ERROR : Wrong connectivity implementation" |
| 971 | end |
| 972 | connected_output = layer.space(conn_val.um, mode).polygons(0.001) |
| 973 | unconnected_errors_unfiltered = layer.space(not_conn_val.um, mode) |
| 974 | singularity_errors = layer.space(0.001.um) |
| 975 | # Filter out the errors arising from the same net |
| 976 | unconnected_errors = DRC::DRCLayer::new(self, RBA::EdgePairs::new) |
| 977 | unconnected_errors_unfiltered.data.each do |ep| |
| 978 | net1 = l2n_data.probe_net(layer.data, ep.first.p1) |
| 979 | net2 = l2n_data.probe_net(layer.data, ep.second.p1) |
| 980 | if !net1 || !net2 |
| 981 | puts "Should not happen ..." |
| 982 | elsif net1.circuit != net2.circuit || net1.cluster_id != net2.cluster_id |
| 983 | # unconnected |
| 984 | unconnected_errors.data.insert(ep) |
| 985 | end |
| 986 | end |
| 987 | unconnected_output = unconnected_errors.polygons.or(singularity_errors.polygons(0.001)) |
| 988 | return connected_output, unconnected_output |
| 989 | end |
| 990 | |
| 991 | def conn_separation(layer1, layer2, conn_val,not_conn_val, mode) |
| 992 | if conn_val > not_conn_val |
| 993 | raise "ERROR : Wrong connectivity implementation" |
| 994 | end |
| 995 | connected_output = layer1.separation(layer2, conn_val.um, mode).polygons(0.001) |
| 996 | unconnected_errors_unfiltered = layer1.separation(layer2, not_conn_val.um, mode) |
| 997 | # Filter out the errors arising from the same net |
| 998 | unconnected_errors = DRC::DRCLayer::new(self, RBA::EdgePairs::new) |
| 999 | unconnected_errors_unfiltered.data.each do |ep| |
| 1000 | net1 = l2n_data.probe_net(layer1.data, ep.first.p1) |
| 1001 | net2 = l2n_data.probe_net(layer2.data, ep.second.p1) |
| 1002 | if !net1 || !net2 |
| 1003 | puts "Should not happen ..." |
| 1004 | elsif net1.circuit != net2.circuit || net1.cluster_id != net2.cluster_id |
| 1005 | # unconnected |
| 1006 | unconnected_errors.data.insert(ep) |
| 1007 | end |
| 1008 | end |
| 1009 | unconnected_output = unconnected_errors.polygons(0.001) |
| 1010 | return connected_output, unconnected_output |
| 1011 | end |
| 1012 | |
| 1013 | # === IMPLICIT EXTRACTION === |
| 1014 | if CONNECTIVITY_RULES |
| 1015 | logger.info("Connectivity rules enabled, Netlist object will be generated.") |
| 1016 | netlist |
| 1017 | end #CONNECTIVITY_RULES |
| 1018 | |
| 1019 | # === LAYOUT EXTENT === |
| 1020 | CHIP = extent.sized(0.0) |
| 1021 | logger.info("Total area of the design is #{CHIP.area()} um^2.") |
| 1022 | |
| 1023 | #================================================ |
| 1024 | #----------------- MAIN RUNSET ------------------ |
| 1025 | #================================================ |
| 1026 | |
| 1027 | logger.info("Starting GF180MCU DRC rules.") |
| 1028 | if FEOL |
| 1029 | logger.info("Running all FEOL rules") |
| 1030 | end #FEOL |
| 1031 | |
| 1032 | if BEOL |
| 1033 | logger.info("Running all BEOL rules") |
| 1034 | end #BEOL |
| 1035 | |
| 1036 | |
| 1037 | ################################################################################################ |
| 1038 | # Copyright 2022 GlobalFoundries PDK Authors |
| 1039 | # |
| 1040 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 1041 | # you may not use this file except in compliance with the License. |
| 1042 | # You may obtain a copy of the License at |
| 1043 | # |
| 1044 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 1045 | # |
| 1046 | # Unless required by applicable law or agreed to in writing, software |
| 1047 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 1048 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 1049 | # See the License for the specific language governing permissions and |
| 1050 | # limitations under the License. |
| 1051 | ################################################################################################ |
| 1052 | |
| 1053 | #=========================================================================================================================== |
| 1054 | #------------------------------------------- GF 0.18um MCU DRC RULE DECK -------------------------------------------------- |
| 1055 | #=========================================================================================================================== |
| 1056 | require 'time' |
| 1057 | require "logger" |
| 1058 | |
| 1059 | exec_start_time = Time.now |
| 1060 | |
| 1061 | logger = Logger.new(STDOUT) |
| 1062 | |
| 1063 | logger.formatter = proc do |severity, datetime, progname, msg| |
| 1064 | "#{datetime}: Memory Usage (" + `pmap #{Process.pid} | tail -1`[10,40].strip + ") : #{msg} |
| 1065 | " |
| 1066 | end |
| 1067 | |
| 1068 | #================================================ |
| 1069 | #----------------- FILE SETUP ------------------- |
| 1070 | #================================================ |
| 1071 | |
| 1072 | # optional for a batch launch : klayout -b -r gf_018mcu.drc -rd input=design.gds -rd report=gp180_drc.lyrdb |
| 1073 | |
| 1074 | logger.info("Starting running GF180MCU Klayout DRC runset on %s" % [$input]) |
| 1075 | logger.info("Ruby Version for klayout: %s" % [RUBY_VERSION]) |
| 1076 | |
| 1077 | if $input |
| 1078 | if $topcell |
| 1079 | source($input, $topcell) |
| 1080 | else |
| 1081 | source($input) |
| 1082 | end |
| 1083 | end |
| 1084 | |
| 1085 | if $table_name |
| 1086 | table_name = $table_name |
| 1087 | else |
| 1088 | table_name = "main" |
| 1089 | end |
| 1090 | |
| 1091 | |
| 1092 | logger.info("Loading database to memory is complete.") |
| 1093 | |
| 1094 | if $report |
| 1095 | logger.info("GF180MCU Klayout DRC runset output at: %s" % [$report]) |
| 1096 | report("DRC Run Report at", $report) |
| 1097 | else |
| 1098 | logger.info("GF180MCU Klayout DRC runset output at default location." % [File.join(File.dirname(RBA::CellView::active.filename), "gf180_drc.lyrdb")]) |
| 1099 | report("DRC Run Report at", File.join(File.dirname(RBA::CellView::active.filename), "gf180_drc.lyrdb")) |
| 1100 | end |
| 1101 | |
| 1102 | #================================================ |
| 1103 | #------------------ SWITCHES -------------------- |
| 1104 | #================================================ |
| 1105 | logger.info("Evaluate switches.") |
| 1106 | |
| 1107 | # connectivity rules |
| 1108 | if $conn_drc == "true" |
| 1109 | CONNECTIVITY_RULES = $conn_drc |
| 1110 | logger.info("connectivity rules are enabled.") |
| 1111 | else |
| 1112 | CONNECTIVITY_RULES = false |
| 1113 | logger.info("connectivity rules are disabled.") |
| 1114 | end # connectivity rules |
| 1115 | |
| 1116 | # WEDGE |
| 1117 | if $wedge == "false" |
| 1118 | WEDGE = $wedge |
| 1119 | else |
| 1120 | WEDGE = "true" |
| 1121 | end # WEDGE |
| 1122 | |
| 1123 | logger.info("Wedge enabled %s" % [WEDGE]) |
| 1124 | |
| 1125 | # BALL |
| 1126 | if $ball == "false" |
| 1127 | BALL = $ball |
| 1128 | else |
| 1129 | BALL = "true" |
| 1130 | end # BALL |
| 1131 | |
| 1132 | logger.info("Ball enabled %s" % [BALL]) |
| 1133 | |
| 1134 | # GOLD |
| 1135 | if $gold == "false" |
| 1136 | GOLD = $gold |
| 1137 | else |
| 1138 | GOLD = "true" |
| 1139 | end # GOLD |
| 1140 | |
| 1141 | logger.info("Gold enabled %s" % [GOLD]) |
| 1142 | |
| 1143 | if $mim_option |
| 1144 | MIM_OPTION = $mim_option |
| 1145 | else |
| 1146 | MIM_OPTION = "B" |
| 1147 | end |
| 1148 | |
| 1149 | logger.info("MIM Option selected %s" % [MIM_OPTION]) |
| 1150 | |
| 1151 | # OFFGRID |
| 1152 | if $offgrid == "false" |
| 1153 | OFFGRID = false |
| 1154 | else |
| 1155 | OFFGRID = true |
| 1156 | end # OFFGRID |
| 1157 | |
| 1158 | logger.info("Offgrid enabled %s" % [OFFGRID]) |
| 1159 | |
| 1160 | if $thr |
| 1161 | threads($thr) |
| 1162 | logger.info("Number of threads to use %s" % [$thr]) |
| 1163 | else |
| 1164 | threads(%x("nproc")) |
| 1165 | logger.info("Number of threads to use #{%x("nproc")}") |
| 1166 | end |
| 1167 | |
| 1168 | #=== PRINT DETAILS === |
| 1169 | if $verbose == "true" |
| 1170 | logger.info("Verbose mode: #{$verbose}") |
| 1171 | verbose(true) |
| 1172 | else |
| 1173 | verbose(false) |
| 1174 | logger.info("Verbose mode: false") |
| 1175 | end |
| 1176 | |
| 1177 | # === TILING MODE === |
| 1178 | if $run_mode == "tiling" |
| 1179 | tiles(500.um) |
| 1180 | tile_borders(10.um) |
| 1181 | logger.info("Tiling mode is enabled.") |
| 1182 | |
| 1183 | elsif $run_mode == "deep" |
| 1184 | #=== HIER MODE === |
| 1185 | deep |
| 1186 | logger.info("deep mode is enabled.") |
| 1187 | else |
| 1188 | #=== FLAT MODE === |
| 1189 | flat |
| 1190 | logger.info("flat mode is enabled.") |
| 1191 | end # run_mode |
| 1192 | |
| 1193 | # METAL_TOP |
| 1194 | if $metal_top |
| 1195 | METAL_TOP = $metal_top |
| 1196 | else |
| 1197 | METAL_TOP = "9K" |
| 1198 | end # METAL_TOP |
| 1199 | |
| 1200 | logger.info("METAL_TOP Selected is %s" % [METAL_TOP]) |
| 1201 | |
| 1202 | # METAL_LEVEL |
| 1203 | if $metal_level |
| 1204 | METAL_LEVEL = $metal_level |
| 1205 | else |
| 1206 | METAL_LEVEL = "5LM" |
| 1207 | end # METAL_LEVEL |
| 1208 | |
| 1209 | logger.info("METAL_STACK Selected is %s" % [METAL_LEVEL]) |
| 1210 | |
| 1211 | # FEOL |
| 1212 | if $feol == "false" |
| 1213 | FEOL = $feol |
| 1214 | logger.info("FEOL is disabled.") |
| 1215 | else |
| 1216 | FEOL = "true" |
| 1217 | logger.info("FEOL is enabled.") |
| 1218 | end # FEOL |
| 1219 | |
| 1220 | # BEOL |
| 1221 | if $beol == "false" |
| 1222 | BEOL = $beol |
| 1223 | logger.info("BEOL is disabled.") |
| 1224 | else |
| 1225 | BEOL = "true" |
| 1226 | logger.info("BEOL is enabled.") |
| 1227 | end # BEOL |
| 1228 | |
| 1229 | #================================================ |
| 1230 | #------------- LAYERS DEFINITIONS --------------- |
| 1231 | #================================================ |
| 1232 | polygons_count = 0 |
| 1233 | logger.info("Read in polygons from layers.") |
| 1234 | |
| 1235 | def get_polygons(l, d) |
| 1236 | if $run_mode == "deep" |
| 1237 | polygons(l, d) |
| 1238 | else |
| 1239 | polygons(l, d).merged |
| 1240 | end |
| 1241 | end |
| 1242 | |
| 1243 | comp = get_polygons(22 , 0 ) |
| 1244 | count = comp.count() |
| 1245 | logger.info("comp has %d polygons" % [count]) |
| 1246 | polygons_count += count |
| 1247 | |
| 1248 | dnwell = get_polygons(12 , 0 ) |
| 1249 | count = dnwell.count() |
| 1250 | logger.info("dnwell has %d polygons" % [count]) |
| 1251 | polygons_count += count |
| 1252 | |
| 1253 | nwell = get_polygons(21 , 0 ) |
| 1254 | count = nwell.count() |
| 1255 | logger.info("nwell has %d polygons" % [count]) |
| 1256 | polygons_count += count |
| 1257 | |
| 1258 | lvpwell = get_polygons(204, 0 ) |
| 1259 | count = lvpwell.count() |
| 1260 | logger.info("lvpwell has %d polygons" % [count]) |
| 1261 | polygons_count += count |
| 1262 | |
| 1263 | dualgate = get_polygons(55 , 0 ) |
| 1264 | count = dualgate.count() |
| 1265 | logger.info("dualgate has %d polygons" % [count]) |
| 1266 | polygons_count += count |
| 1267 | |
| 1268 | poly2 = get_polygons(30 , 0 ) |
| 1269 | count = poly2.count() |
| 1270 | logger.info("poly2 has %d polygons" % [count]) |
| 1271 | polygons_count += count |
| 1272 | |
| 1273 | nplus = get_polygons(32 , 0 ) |
| 1274 | count = nplus.count() |
| 1275 | logger.info("nplus has %d polygons" % [count]) |
| 1276 | polygons_count += count |
| 1277 | |
| 1278 | pplus = get_polygons(31 , 0 ) |
| 1279 | count = pplus.count() |
| 1280 | logger.info("pplus has %d polygons" % [count]) |
| 1281 | polygons_count += count |
| 1282 | |
| 1283 | sab = get_polygons(49 , 0 ) |
| 1284 | count = sab.count() |
| 1285 | logger.info("sab has %d polygons" % [count]) |
| 1286 | polygons_count += count |
| 1287 | |
| 1288 | esd = get_polygons(24 , 0 ) |
| 1289 | count = esd.count() |
| 1290 | logger.info("esd has %d polygons" % [count]) |
| 1291 | polygons_count += count |
| 1292 | |
| 1293 | resistor = get_polygons(62 , 0 ) |
| 1294 | count = resistor.count() |
| 1295 | logger.info("resistor has %d polygons" % [count]) |
| 1296 | polygons_count += count |
| 1297 | |
| 1298 | fhres = get_polygons(227, 0 ) |
| 1299 | count = fhres.count() |
| 1300 | logger.info("fhres has %d polygons" % [count]) |
| 1301 | polygons_count += count |
| 1302 | |
| 1303 | fusetop = get_polygons(75 , 0 ) |
| 1304 | count = fusetop.count() |
| 1305 | logger.info("fusetop has %d polygons" % [count]) |
| 1306 | polygons_count += count |
| 1307 | |
| 1308 | fusewindow_d = get_polygons(96 , 1 ) |
| 1309 | count = fusewindow_d.count() |
| 1310 | logger.info("fusewindow_d has %d polygons" % [count]) |
| 1311 | polygons_count += count |
| 1312 | |
| 1313 | polyfuse = get_polygons(220, 0 ) |
| 1314 | count = polyfuse.count() |
| 1315 | logger.info("polyfuse has %d polygons" % [count]) |
| 1316 | polygons_count += count |
| 1317 | |
| 1318 | mvsd = get_polygons(210, 0 ) |
| 1319 | count = mvsd.count() |
| 1320 | logger.info("mvsd has %d polygons" % [count]) |
| 1321 | polygons_count += count |
| 1322 | |
| 1323 | mvpsd = get_polygons(11 , 39) |
| 1324 | count = mvpsd.count() |
| 1325 | logger.info("mvpsd has %d polygons" % [count]) |
| 1326 | polygons_count += count |
| 1327 | |
| 1328 | nat = get_polygons(5 , 0 ) |
| 1329 | count = nat.count() |
| 1330 | logger.info("nat has %d polygons" % [count]) |
| 1331 | polygons_count += count |
| 1332 | |
| 1333 | comp_dummy = get_polygons(22 , 4 ) |
| 1334 | count = comp_dummy.count() |
| 1335 | logger.info("comp_dummy has %d polygons" % [count]) |
| 1336 | polygons_count += count |
| 1337 | |
| 1338 | poly2_dummy = get_polygons(30 , 4 ) |
| 1339 | count = poly2_dummy.count() |
| 1340 | logger.info("poly2_dummy has %d polygons" % [count]) |
| 1341 | polygons_count += count |
| 1342 | |
| 1343 | schottky_diode = get_polygons(241, 0 ) |
| 1344 | count = schottky_diode.count() |
| 1345 | logger.info("schottky_diode has %d polygons" % [count]) |
| 1346 | polygons_count += count |
| 1347 | |
| 1348 | zener = get_polygons(178, 0 ) |
| 1349 | count = zener.count() |
| 1350 | logger.info("zener has %d polygons" % [count]) |
| 1351 | polygons_count += count |
| 1352 | |
| 1353 | res_mk = get_polygons(110, 5 ) |
| 1354 | count = res_mk.count() |
| 1355 | logger.info("res_mk has %d polygons" % [count]) |
| 1356 | polygons_count += count |
| 1357 | |
| 1358 | opc_drc = get_polygons(124, 5 ) |
| 1359 | count = opc_drc.count() |
| 1360 | logger.info("opc_drc has %d polygons" % [count]) |
| 1361 | polygons_count += count |
| 1362 | |
| 1363 | ndmy = get_polygons(111, 5 ) |
| 1364 | count = ndmy.count() |
| 1365 | logger.info("ndmy has %d polygons" % [count]) |
| 1366 | polygons_count += count |
| 1367 | |
| 1368 | pmndmy = get_polygons(152, 5 ) |
| 1369 | count = pmndmy.count() |
| 1370 | logger.info("pmndmy has %d polygons" % [count]) |
| 1371 | polygons_count += count |
| 1372 | |
| 1373 | v5_xtor = get_polygons(112, 1 ) |
| 1374 | count = v5_xtor.count() |
| 1375 | logger.info("v5_xtor has %d polygons" % [count]) |
| 1376 | polygons_count += count |
| 1377 | |
| 1378 | cap_mk = get_polygons(117, 5 ) |
| 1379 | count = cap_mk.count() |
| 1380 | logger.info("cap_mk has %d polygons" % [count]) |
| 1381 | polygons_count += count |
| 1382 | |
| 1383 | mos_cap_mk = get_polygons(166, 5 ) |
| 1384 | count = mos_cap_mk.count() |
| 1385 | logger.info("mos_cap_mk has %d polygons" % [count]) |
| 1386 | polygons_count += count |
| 1387 | |
| 1388 | ind_mk = get_polygons(151, 5 ) |
| 1389 | count = ind_mk.count() |
| 1390 | logger.info("ind_mk has %d polygons" % [count]) |
| 1391 | polygons_count += count |
| 1392 | |
| 1393 | diode_mk = get_polygons(115, 5 ) |
| 1394 | count = diode_mk.count() |
| 1395 | logger.info("diode_mk has %d polygons" % [count]) |
| 1396 | polygons_count += count |
| 1397 | |
| 1398 | drc_bjt = get_polygons(127, 5 ) |
| 1399 | count = drc_bjt.count() |
| 1400 | logger.info("drc_bjt has %d polygons" % [count]) |
| 1401 | polygons_count += count |
| 1402 | |
| 1403 | lvs_bjt = get_polygons(118, 5 ) |
| 1404 | count = lvs_bjt.count() |
| 1405 | logger.info("lvs_bjt has %d polygons" % [count]) |
| 1406 | polygons_count += count |
| 1407 | |
| 1408 | mim_l_mk = get_polygons(117, 10) |
| 1409 | count = mim_l_mk.count() |
| 1410 | logger.info("mim_l_mk has %d polygons" % [count]) |
| 1411 | polygons_count += count |
| 1412 | |
| 1413 | latchup_mk = get_polygons(137, 5 ) |
| 1414 | count = latchup_mk.count() |
| 1415 | logger.info("latchup_mk has %d polygons" % [count]) |
| 1416 | polygons_count += count |
| 1417 | |
| 1418 | guard_ring_mk = get_polygons(167, 5 ) |
| 1419 | count = guard_ring_mk.count() |
| 1420 | logger.info("guard_ring_mk has %d polygons" % [count]) |
| 1421 | polygons_count += count |
| 1422 | |
| 1423 | otp_mk = get_polygons(173, 5 ) |
| 1424 | count = otp_mk.count() |
| 1425 | logger.info("otp_mk has %d polygons" % [count]) |
| 1426 | polygons_count += count |
| 1427 | |
| 1428 | mtpmark = get_polygons(122, 5 ) |
| 1429 | count = mtpmark.count() |
| 1430 | logger.info("mtpmark has %d polygons" % [count]) |
| 1431 | polygons_count += count |
| 1432 | |
| 1433 | neo_ee_mk = get_polygons(88 , 17) |
| 1434 | count = neo_ee_mk.count() |
| 1435 | logger.info("neo_ee_mk has %d polygons" % [count]) |
| 1436 | polygons_count += count |
| 1437 | |
| 1438 | sramcore = get_polygons(108, 5 ) |
| 1439 | count = sramcore.count() |
| 1440 | logger.info("sramcore has %d polygons" % [count]) |
| 1441 | polygons_count += count |
| 1442 | |
| 1443 | lvs_rf = get_polygons(100, 5 ) |
| 1444 | count = lvs_rf.count() |
| 1445 | logger.info("lvs_rf has %d polygons" % [count]) |
| 1446 | polygons_count += count |
| 1447 | |
| 1448 | lvs_drain = get_polygons(100, 7 ) |
| 1449 | count = lvs_drain.count() |
| 1450 | logger.info("lvs_drain has %d polygons" % [count]) |
| 1451 | polygons_count += count |
| 1452 | |
| 1453 | ind_mk = get_polygons(151, 5 ) |
| 1454 | count = ind_mk.count() |
| 1455 | logger.info("ind_mk has %d polygons" % [count]) |
| 1456 | polygons_count += count |
| 1457 | |
| 1458 | hvpolyrs = get_polygons(123, 5 ) |
| 1459 | count = hvpolyrs.count() |
| 1460 | logger.info("hvpolyrs has %d polygons" % [count]) |
| 1461 | polygons_count += count |
| 1462 | |
| 1463 | lvs_io = get_polygons(119, 5 ) |
| 1464 | count = lvs_io.count() |
| 1465 | logger.info("lvs_io has %d polygons" % [count]) |
| 1466 | polygons_count += count |
| 1467 | |
| 1468 | probe_mk = get_polygons(13 , 17) |
| 1469 | count = probe_mk.count() |
| 1470 | logger.info("probe_mk has %d polygons" % [count]) |
| 1471 | polygons_count += count |
| 1472 | |
| 1473 | esd_mk = get_polygons(24 , 5 ) |
| 1474 | count = esd_mk.count() |
| 1475 | logger.info("esd_mk has %d polygons" % [count]) |
| 1476 | polygons_count += count |
| 1477 | |
| 1478 | lvs_source = get_polygons(100, 8 ) |
| 1479 | count = lvs_source.count() |
| 1480 | logger.info("lvs_source has %d polygons" % [count]) |
| 1481 | polygons_count += count |
| 1482 | |
| 1483 | well_diode_mk = get_polygons(153, 51) |
| 1484 | count = well_diode_mk.count() |
| 1485 | logger.info("well_diode_mk has %d polygons" % [count]) |
| 1486 | polygons_count += count |
| 1487 | |
| 1488 | ldmos_xtor = get_polygons(226, 0 ) |
| 1489 | count = ldmos_xtor.count() |
| 1490 | logger.info("ldmos_xtor has %d polygons" % [count]) |
| 1491 | polygons_count += count |
| 1492 | |
| 1493 | plfuse = get_polygons(125, 5 ) |
| 1494 | count = plfuse.count() |
| 1495 | logger.info("plfuse has %d polygons" % [count]) |
| 1496 | polygons_count += count |
| 1497 | |
| 1498 | efuse_mk = get_polygons(80 , 5 ) |
| 1499 | count = efuse_mk.count() |
| 1500 | logger.info("efuse_mk has %d polygons" % [count]) |
| 1501 | polygons_count += count |
| 1502 | |
| 1503 | mcell_feol_mk = get_polygons(11 , 17) |
| 1504 | count = mcell_feol_mk.count() |
| 1505 | logger.info("mcell_feol_mk has %d polygons" % [count]) |
| 1506 | polygons_count += count |
| 1507 | |
| 1508 | ymtp_mk = get_polygons(86 , 17) |
| 1509 | count = ymtp_mk.count() |
| 1510 | logger.info("ymtp_mk has %d polygons" % [count]) |
| 1511 | polygons_count += count |
| 1512 | |
| 1513 | dev_wf_mk = get_polygons(128, 17) |
| 1514 | count = dev_wf_mk.count() |
| 1515 | logger.info("dev_wf_mk has %d polygons" % [count]) |
| 1516 | polygons_count += count |
| 1517 | |
| 1518 | comp_label = get_polygons(22 , 10) |
| 1519 | count = comp_label.count() |
| 1520 | logger.info("comp_label has %d polygons" % [count]) |
| 1521 | polygons_count += count |
| 1522 | |
| 1523 | poly2_label = get_polygons(30 , 10) |
| 1524 | count = poly2_label.count() |
| 1525 | logger.info("poly2_label has %d polygons" % [count]) |
| 1526 | polygons_count += count |
| 1527 | |
| 1528 | mdiode = get_polygons(116, 5 ) |
| 1529 | count = mdiode.count() |
| 1530 | logger.info("mdiode has %d polygons" % [count]) |
| 1531 | polygons_count += count |
| 1532 | |
| 1533 | contact = get_polygons(33 , 0 ) |
| 1534 | count = contact.count() |
| 1535 | logger.info("contact has %d polygons" % [count]) |
| 1536 | polygons_count += count |
| 1537 | |
| 1538 | metal1_drawn = get_polygons(34 , 0 ) |
| 1539 | count = metal1_drawn.count() |
| 1540 | logger.info("metal1_drawn has %d polygons" % [count]) |
| 1541 | polygons_count += count |
| 1542 | |
| 1543 | metal1_dummy = get_polygons(34 , 4 ) |
| 1544 | count = metal1_dummy.count() |
| 1545 | logger.info("metal1_dummy has %d polygons" % [count]) |
| 1546 | polygons_count += count |
| 1547 | |
| 1548 | metal1 = metal1_drawn + metal1_dummy |
| 1549 | |
| 1550 | metal1_label = get_polygons(34 , 10) |
| 1551 | count = metal1_label.count() |
| 1552 | logger.info("metal1_label has %d polygons" % [count]) |
| 1553 | polygons_count += count |
| 1554 | |
| 1555 | metal1_slot = get_polygons(34 , 3 ) |
| 1556 | count = metal1_slot.count() |
| 1557 | logger.info("metal1_slot has %d polygons" % [count]) |
| 1558 | polygons_count += count |
| 1559 | |
| 1560 | metal1_blk = get_polygons(34 , 5 ) |
| 1561 | count = metal1_blk.count() |
| 1562 | logger.info("metal1_blk has %d polygons" % [count]) |
| 1563 | polygons_count += count |
| 1564 | |
| 1565 | via1 = get_polygons(35 , 0 ) |
| 1566 | count = via1.count() |
| 1567 | logger.info("via1 has %d polygons" % [count]) |
| 1568 | polygons_count += count |
| 1569 | |
| 1570 | |
| 1571 | if METAL_LEVEL == "2LM" |
| 1572 | metal2_drawn = get_polygons(36 , 0 ) |
| 1573 | count = metal2_drawn.count() |
| 1574 | logger.info("metal2_drawn has %d polygons" % [count]) |
| 1575 | polygons_count += count |
| 1576 | |
| 1577 | metal2_dummy = get_polygons(36 , 4 ) |
| 1578 | count = metal2_dummy.count() |
| 1579 | logger.info("metal2_dummy has %d polygons" % [count]) |
| 1580 | polygons_count += count |
| 1581 | |
| 1582 | metal2 = metal2_drawn + metal2_drawn |
| 1583 | |
| 1584 | metal2_label = get_polygons(36 , 10) |
| 1585 | count = metal2_label.count() |
| 1586 | logger.info("metal2_label has %d polygons" % [count]) |
| 1587 | polygons_count += count |
| 1588 | |
| 1589 | metal2_slot = get_polygons(36 , 3 ) |
| 1590 | count = metal2_slot.count() |
| 1591 | logger.info("metal2_slot has %d polygons" % [count]) |
| 1592 | polygons_count += count |
| 1593 | |
| 1594 | metal2_blk = get_polygons(36 , 5 ) |
| 1595 | count = metal2_blk.count() |
| 1596 | logger.info("metal2_blk has %d polygons" % [count]) |
| 1597 | polygons_count += count |
| 1598 | |
| 1599 | top_via = via1 |
| 1600 | topmin1_via = contact |
| 1601 | top_metal = metal2 |
| 1602 | topmin1_metal = metal1 |
| 1603 | |
| 1604 | else |
| 1605 | metal2_drawn = get_polygons(36 , 0 ) |
| 1606 | count = metal2_drawn.count() |
| 1607 | logger.info("metal2_drawn has %d polygons" % [count]) |
| 1608 | polygons_count += count |
| 1609 | |
| 1610 | metal2_dummy = get_polygons(36 , 4 ) |
| 1611 | count = metal2_dummy.count() |
| 1612 | logger.info("metal2_dummy has %d polygons" % [count]) |
| 1613 | polygons_count += count |
| 1614 | |
| 1615 | metal2 = metal2_drawn + metal2_dummy |
| 1616 | |
| 1617 | metal2_label = get_polygons(36 , 10) |
| 1618 | count = metal2_label.count() |
| 1619 | logger.info("metal2_label has %d polygons" % [count]) |
| 1620 | polygons_count += count |
| 1621 | |
| 1622 | metal2_slot = get_polygons(36 , 3 ) |
| 1623 | count = metal2_slot.count() |
| 1624 | logger.info("metal2_slot has %d polygons" % [count]) |
| 1625 | polygons_count += count |
| 1626 | |
| 1627 | metal2_blk = get_polygons(36 , 5 ) |
| 1628 | count = metal2_blk.count() |
| 1629 | logger.info("metal2_blk has %d polygons" % [count]) |
| 1630 | polygons_count += count |
| 1631 | |
| 1632 | via2 = get_polygons(38 , 0 ) |
| 1633 | count = via2.count() |
| 1634 | logger.info("via2 has %d polygons" % [count]) |
| 1635 | polygons_count += count |
| 1636 | |
| 1637 | if METAL_LEVEL == "3LM" |
| 1638 | metal3_drawn = get_polygons(42 , 0 ) |
| 1639 | count = metal3_drawn.count() |
| 1640 | logger.info("metal3_drawn has %d polygons" % [count]) |
| 1641 | polygons_count += count |
| 1642 | |
| 1643 | metal3_dummy = get_polygons(42 , 4 ) |
| 1644 | count = metal3_dummy.count() |
| 1645 | logger.info("metal3_dummy has %d polygons" % [count]) |
| 1646 | polygons_count += count |
| 1647 | |
| 1648 | metal3 = metal3_drawn + metal3_dummy |
| 1649 | |
| 1650 | metal3_label = get_polygons(42 , 10) |
| 1651 | count = metal3_label.count() |
| 1652 | logger.info("metal3_label has %d polygons" % [count]) |
| 1653 | polygons_count += count |
| 1654 | |
| 1655 | metal3_slot = get_polygons(42 , 3 ) |
| 1656 | count = metal3_slot.count() |
| 1657 | logger.info("metal3_slot has %d polygons" % [count]) |
| 1658 | polygons_count += count |
| 1659 | |
| 1660 | metal3_blk = get_polygons(42 , 5 ) |
| 1661 | count = metal3_blk.count() |
| 1662 | logger.info("metal3_blk has %d polygons" % [count]) |
| 1663 | polygons_count += count |
| 1664 | |
| 1665 | top_via = via2 |
| 1666 | topmin1_via = via1 |
| 1667 | top_metal = metal3 |
| 1668 | topmin1_metal = metal2 |
| 1669 | else |
| 1670 | metal3_drawn = get_polygons(42 , 0 ) |
| 1671 | count = metal3_drawn.count() |
| 1672 | logger.info("metal3_drawn has %d polygons" % [count]) |
| 1673 | polygons_count += count |
| 1674 | |
| 1675 | metal3_dummy = get_polygons(42 , 4 ) |
| 1676 | count = metal3_dummy.count() |
| 1677 | logger.info("metal3_dummy has %d polygons" % [count]) |
| 1678 | polygons_count += count |
| 1679 | |
| 1680 | metal3 = metal3_drawn + metal3_dummy |
| 1681 | |
| 1682 | metal3_label = get_polygons(42 , 10) |
| 1683 | count = metal3_label.count() |
| 1684 | logger.info("metal3_label has %d polygons" % [count]) |
| 1685 | polygons_count += count |
| 1686 | |
| 1687 | metal3_slot = get_polygons(42 , 3 ) |
| 1688 | count = metal3_slot.count() |
| 1689 | logger.info("metal3_slot has %d polygons" % [count]) |
| 1690 | polygons_count += count |
| 1691 | |
| 1692 | metal3_blk = get_polygons(42 , 5 ) |
| 1693 | count = metal3_blk.count() |
| 1694 | logger.info("metal3_blk has %d polygons" % [count]) |
| 1695 | polygons_count += count |
| 1696 | |
| 1697 | via3 = get_polygons(40 , 0 ) |
| 1698 | |
| 1699 | if METAL_LEVEL == "4LM" |
| 1700 | metal4_drawn = get_polygons(46 , 0 ) |
| 1701 | count = metal4_drawn.count() |
| 1702 | logger.info("metal4_drawn has %d polygons" % [count]) |
| 1703 | polygons_count += count |
| 1704 | |
| 1705 | metal4_dummy = get_polygons(46 , 4 ) |
| 1706 | count = metal4_dummy.count() |
| 1707 | logger.info("metal4_dummy has %d polygons" % [count]) |
| 1708 | polygons_count += count |
| 1709 | |
| 1710 | metal4 = metal4_drawn + metal4_dummy |
| 1711 | |
| 1712 | metal4_label = get_polygons(46 , 10) |
| 1713 | count = metal4_label.count() |
| 1714 | logger.info("metal4_label has %d polygons" % [count]) |
| 1715 | polygons_count += count |
| 1716 | |
| 1717 | metal4_slot = get_polygons(46 , 3 ) |
| 1718 | count = metal4_slot.count() |
| 1719 | logger.info("metal4_slot has %d polygons" % [count]) |
| 1720 | polygons_count += count |
| 1721 | |
| 1722 | metal4_blk = get_polygons(46 , 5 ) |
| 1723 | count = metal4_blk.count() |
| 1724 | logger.info("metal4_blk has %d polygons" % [count]) |
| 1725 | polygons_count += count |
| 1726 | |
| 1727 | top_via = via3 |
| 1728 | topmin1_via = via2 |
| 1729 | top_metal = metal4 |
| 1730 | topmin1_metal = metal3 |
| 1731 | else |
| 1732 | metal4_drawn = get_polygons(46 , 0 ) |
| 1733 | count = metal4_drawn.count() |
| 1734 | logger.info("metal4_drawn has %d polygons" % [count]) |
| 1735 | polygons_count += count |
| 1736 | |
| 1737 | metal4_dummy = get_polygons(46 , 4 ) |
| 1738 | count = metal4_dummy.count() |
| 1739 | logger.info("metal4_dummy has %d polygons" % [count]) |
| 1740 | polygons_count += count |
| 1741 | |
| 1742 | metal4 = metal4_drawn + metal4_dummy |
| 1743 | |
| 1744 | metal4_label = get_polygons(46 , 10) |
| 1745 | count = metal4_label.count() |
| 1746 | logger.info("metal4_label has %d polygons" % [count]) |
| 1747 | polygons_count += count |
| 1748 | |
| 1749 | metal4_slot = get_polygons(46 , 3 ) |
| 1750 | count = metal4_slot.count() |
| 1751 | logger.info("metal4_slot has %d polygons" % [count]) |
| 1752 | polygons_count += count |
| 1753 | |
| 1754 | metal4_blk = get_polygons(46 , 5 ) |
| 1755 | count = metal4_blk.count() |
| 1756 | logger.info("metal4_blk has %d polygons" % [count]) |
| 1757 | polygons_count += count |
| 1758 | |
| 1759 | via4 = get_polygons(41 , 0 ) |
| 1760 | count = via4.count() |
| 1761 | logger.info("via4 has %d polygons" % [count]) |
| 1762 | polygons_count += count |
| 1763 | |
| 1764 | if METAL_LEVEL == "5LM" |
| 1765 | metal5_drawn = get_polygons(81 , 0 ) |
| 1766 | count = metal5_drawn.count() |
| 1767 | logger.info("metal5_drawn has %d polygons" % [count]) |
| 1768 | polygons_count += count |
| 1769 | |
| 1770 | metal5_dummy = get_polygons(81 , 4 ) |
| 1771 | count = metal5_dummy.count() |
| 1772 | logger.info("metal5_dummy has %d polygons" % [count]) |
| 1773 | polygons_count += count |
| 1774 | |
| 1775 | metal5 = metal5_drawn + metal5_dummy |
| 1776 | |
| 1777 | metal5_label = get_polygons(81 , 10) |
| 1778 | count = metal5_label.count() |
| 1779 | logger.info("metal5_label has %d polygons" % [count]) |
| 1780 | polygons_count += count |
| 1781 | |
| 1782 | metal5_slot = get_polygons(81 , 3 ) |
| 1783 | count = metal5_slot.count() |
| 1784 | logger.info("metal5_slot has %d polygons" % [count]) |
| 1785 | polygons_count += count |
| 1786 | |
| 1787 | metal5_blk = get_polygons(81 , 5 ) |
| 1788 | count = metal5_blk.count() |
| 1789 | logger.info("metal5_blk has %d polygons" % [count]) |
| 1790 | polygons_count += count |
| 1791 | |
| 1792 | top_via = via4 |
| 1793 | topmin1_via = via3 |
| 1794 | top_metal = metal5 |
| 1795 | topmin1_metal = metal4 |
| 1796 | else |
| 1797 | ## 6LM |
| 1798 | metal5_drawn = get_polygons(81 , 0 ) |
| 1799 | count = metal5_drawn.count() |
| 1800 | logger.info("metal5_drawn has %d polygons" % [count]) |
| 1801 | polygons_count += count |
| 1802 | |
| 1803 | metal5_dummy = get_polygons(81 , 4 ) |
| 1804 | count = metal5_dummy.count() |
| 1805 | logger.info("metal5_dummy has %d polygons" % [count]) |
| 1806 | polygons_count += count |
| 1807 | |
| 1808 | metal5 = metal5_drawn + metal5_dummy |
| 1809 | |
| 1810 | metal5_label = get_polygons(81 , 10) |
| 1811 | count = metal5_label.count() |
| 1812 | logger.info("metal5_label has %d polygons" % [count]) |
| 1813 | polygons_count += count |
| 1814 | |
| 1815 | metal5_slot = get_polygons(81 , 3 ) |
| 1816 | count = metal5_slot.count() |
| 1817 | logger.info("metal5_slot has %d polygons" % [count]) |
| 1818 | polygons_count += count |
| 1819 | |
| 1820 | metal5_blk = get_polygons(81 , 5 ) |
| 1821 | count = metal5_blk.count() |
| 1822 | logger.info("metal5_blk has %d polygons" % [count]) |
| 1823 | polygons_count += count |
| 1824 | |
| 1825 | via5 = get_polygons(82 , 0 ) |
| 1826 | count = via5.count() |
| 1827 | logger.info("via5 has %d polygons" % [count]) |
| 1828 | polygons_count += count |
| 1829 | |
| 1830 | |
| 1831 | metaltop_drawn = get_polygons(53 , 0 ) |
| 1832 | count = metaltop_drawn.count() |
| 1833 | logger.info("metaltop_drawn has %d polygons" % [count]) |
| 1834 | polygons_count += count |
| 1835 | |
| 1836 | metaltop_dummy = get_polygons(53 , 4 ) |
| 1837 | count = metaltop_dummy.count() |
| 1838 | logger.info("metaltop_dummy has %d polygons" % [count]) |
| 1839 | polygons_count += count |
| 1840 | |
| 1841 | metaltop = metaltop_drawn + metaltop_dummy |
| 1842 | |
| 1843 | metaltop_label = get_polygons(53 , 10) |
| 1844 | count = metaltop_label.count() |
| 1845 | logger.info("metaltop_label has %d polygons" % [count]) |
| 1846 | polygons_count += count |
| 1847 | |
| 1848 | metaltop_slot = get_polygons(53 , 3 ) |
| 1849 | count = metaltop_slot.count() |
| 1850 | logger.info("metaltop_slot has %d polygons" % [count]) |
| 1851 | polygons_count += count |
| 1852 | |
| 1853 | metalt_blk = get_polygons(53 , 5 ) |
| 1854 | count = metalt_blk.count() |
| 1855 | logger.info("metalt_blk has %d polygons" % [count]) |
| 1856 | polygons_count += count |
| 1857 | |
| 1858 | top_via = via5 |
| 1859 | topmin1_via = via4 |
| 1860 | top_metal = metaltop |
| 1861 | topmin1_metal = metal5 |
| 1862 | end |
| 1863 | end |
| 1864 | end |
| 1865 | end |
| 1866 | |
| 1867 | pad = get_polygons(37 , 0 ) |
| 1868 | count = pad.count() |
| 1869 | logger.info("pad has %d polygons" % [count]) |
| 1870 | polygons_count += count |
| 1871 | |
| 1872 | ubmpperi = get_polygons(183, 0 ) |
| 1873 | count = ubmpperi.count() |
| 1874 | logger.info("ubmpperi has %d polygons" % [count]) |
| 1875 | polygons_count += count |
| 1876 | |
| 1877 | ubmparray = get_polygons(184, 0 ) |
| 1878 | count = ubmparray.count() |
| 1879 | logger.info("ubmparray has %d polygons" % [count]) |
| 1880 | polygons_count += count |
| 1881 | |
| 1882 | ubmeplate = get_polygons(185, 0 ) |
| 1883 | count = ubmeplate.count() |
| 1884 | logger.info("ubmeplate has %d polygons" % [count]) |
| 1885 | polygons_count += count |
| 1886 | |
| 1887 | metal1_res = get_polygons(110, 11) |
| 1888 | count = metal1_res.count() |
| 1889 | logger.info("metal1_res has %d polygons" % [count]) |
| 1890 | polygons_count += count |
| 1891 | |
| 1892 | metal2_res = get_polygons(110, 12) |
| 1893 | count = metal2_res.count() |
| 1894 | logger.info("metal2_res has %d polygons" % [count]) |
| 1895 | polygons_count += count |
| 1896 | |
| 1897 | metal3_res = get_polygons(110, 13) |
| 1898 | count = metal3_res.count() |
| 1899 | logger.info("metal3_res has %d polygons" % [count]) |
| 1900 | polygons_count += count |
| 1901 | |
| 1902 | metal4_res = get_polygons(110, 14) |
| 1903 | count = metal4_res.count() |
| 1904 | logger.info("metal4_res has %d polygons" % [count]) |
| 1905 | polygons_count += count |
| 1906 | |
| 1907 | metal5_res = get_polygons(110, 15) |
| 1908 | count = metal5_res.count() |
| 1909 | logger.info("metal5_res has %d polygons" % [count]) |
| 1910 | polygons_count += count |
| 1911 | |
| 1912 | metal6_res = get_polygons(110, 16) |
| 1913 | count = metal6_res.count() |
| 1914 | logger.info("metal6_res has %d polygons" % [count]) |
| 1915 | polygons_count += count |
| 1916 | |
| 1917 | pr_bndry = get_polygons(0 , 0 ) |
| 1918 | count = pr_bndry.count() |
| 1919 | logger.info("pr_bndry has %d polygons" % [count]) |
| 1920 | polygons_count += count |
| 1921 | |
| 1922 | border = get_polygons(63 , 0 ) |
| 1923 | count = border.count() |
| 1924 | logger.info("border has %d polygons" % [count]) |
| 1925 | polygons_count += count |
| 1926 | logger.info("Total no. of polygons in the design is #{polygons_count}") |
| 1927 | |
| 1928 | logger.info("Starting deriving base layers.") |
| 1929 | #===================================================== |
| 1930 | #------------- BASE LAYERS DERIVATIONS --------------- |
| 1931 | #===================================================== |
| 1932 | |
| 1933 | ncomp = comp & nplus |
| 1934 | pcomp = comp & pplus |
| 1935 | tgate = poly2 & comp |
| 1936 | ngate = nplus & tgate |
| 1937 | pgate = pplus & tgate |
| 1938 | natcompsd = (nat & comp.interacting(poly2)) - tgate |
| 1939 | |
| 1940 | nom_gate = tgate.not(dualgate) |
| 1941 | thick_gate = tgate.and(dualgate) |
| 1942 | |
| 1943 | ngate_56V = ngate.and(dualgate) |
| 1944 | pgate_56V = pgate.and(dualgate) |
| 1945 | |
| 1946 | ngate_5V = ngate_56V.and(v5_xtor) |
| 1947 | pgate_5V = pgate_56V.and(v5_xtor) |
| 1948 | |
| 1949 | ngate_6V = ngate_56V.not(v5_xtor) |
| 1950 | pgate_6V = pgate_56V.not(v5_xtor) |
| 1951 | |
| 1952 | lvpwell_dn = lvpwell.interacting(dnwell) |
| 1953 | lvpwell_out = lvpwell.not_interacting(dnwell) |
| 1954 | |
| 1955 | |
| 1956 | #================================================ |
| 1957 | #------------- LAYERS CONNECTIONS --------------- |
| 1958 | #================================================ |
| 1959 | |
| 1960 | if CONNECTIVITY_RULES |
| 1961 | |
| 1962 | logger.info("Construct connectivity for the design.") |
| 1963 | |
| 1964 | connect(dnwell, ncomp) |
| 1965 | connect(ncomp, contact) |
| 1966 | connect(pcomp, contact) |
| 1967 | |
| 1968 | connect(lvpwell_out, pcomp) |
| 1969 | connect(lvpwell_dn, pcomp) |
| 1970 | |
| 1971 | connect(nwell, ncomp) |
| 1972 | connect(natcompsd, contact) |
| 1973 | connect(mvsd, ncomp) |
| 1974 | connect(mvpsd, pcomp) |
| 1975 | connect(contact, metal1) |
| 1976 | connect(metal1, via1) |
| 1977 | connect(via1, metal2) |
| 1978 | if METAL_LEVEL != "2LM" |
| 1979 | connect(metal2, via2) |
| 1980 | connect(via2, metal3) |
| 1981 | |
| 1982 | if METAL_LEVEL != "3LM" |
| 1983 | connect(metal3, via3) |
| 1984 | connect(via3, metal4) |
| 1985 | |
| 1986 | if METAL_LEVEL != "4LM" |
| 1987 | connect(metal4, via4) |
| 1988 | connect(via4, metal5) |
| 1989 | |
| 1990 | if METAL_LEVEL != "5LM" |
| 1991 | connect(metal5, via5) |
| 1992 | connect(via5, metaltop) |
| 1993 | end |
| 1994 | end |
| 1995 | end |
| 1996 | end |
| 1997 | |
| 1998 | end #CONNECTIVITY_RULES |
| 1999 | |
| 2000 | #================================================ |
| 2001 | #------------ PRE-DEFINED FUNCTIONS ------------- |
| 2002 | #================================================ |
| 2003 | |
| 2004 | def conn_space(layer,conn_val,not_conn_val, mode) |
| 2005 | if conn_val > not_conn_val |
| 2006 | raise "ERROR : Wrong connectivity implementation" |
| 2007 | end |
| 2008 | connected_output = layer.space(conn_val.um, mode).polygons(0.001) |
| 2009 | unconnected_errors_unfiltered = layer.space(not_conn_val.um, mode) |
| 2010 | singularity_errors = layer.space(0.001.um) |
| 2011 | # Filter out the errors arising from the same net |
| 2012 | unconnected_errors = DRC::DRCLayer::new(self, RBA::EdgePairs::new) |
| 2013 | unconnected_errors_unfiltered.data.each do |ep| |
| 2014 | net1 = l2n_data.probe_net(layer.data, ep.first.p1) |
| 2015 | net2 = l2n_data.probe_net(layer.data, ep.second.p1) |
| 2016 | if !net1 || !net2 |
| 2017 | puts "Should not happen ..." |
| 2018 | elsif net1.circuit != net2.circuit || net1.cluster_id != net2.cluster_id |
| 2019 | # unconnected |
| 2020 | unconnected_errors.data.insert(ep) |
| 2021 | end |
| 2022 | end |
| 2023 | unconnected_output = unconnected_errors.polygons.or(singularity_errors.polygons(0.001)) |
| 2024 | return connected_output, unconnected_output |
| 2025 | end |
| 2026 | |
| 2027 | def conn_separation(layer1, layer2, conn_val,not_conn_val, mode) |
| 2028 | if conn_val > not_conn_val |
| 2029 | raise "ERROR : Wrong connectivity implementation" |
| 2030 | end |
| 2031 | connected_output = layer1.separation(layer2, conn_val.um, mode).polygons(0.001) |
| 2032 | unconnected_errors_unfiltered = layer1.separation(layer2, not_conn_val.um, mode) |
| 2033 | # Filter out the errors arising from the same net |
| 2034 | unconnected_errors = DRC::DRCLayer::new(self, RBA::EdgePairs::new) |
| 2035 | unconnected_errors_unfiltered.data.each do |ep| |
| 2036 | net1 = l2n_data.probe_net(layer1.data, ep.first.p1) |
| 2037 | net2 = l2n_data.probe_net(layer2.data, ep.second.p1) |
| 2038 | if !net1 || !net2 |
| 2039 | puts "Should not happen ..." |
| 2040 | elsif net1.circuit != net2.circuit || net1.cluster_id != net2.cluster_id |
| 2041 | # unconnected |
| 2042 | unconnected_errors.data.insert(ep) |
| 2043 | end |
| 2044 | end |
| 2045 | unconnected_output = unconnected_errors.polygons(0.001) |
| 2046 | return connected_output, unconnected_output |
| 2047 | end |
| 2048 | |
| 2049 | # === IMPLICIT EXTRACTION === |
| 2050 | if CONNECTIVITY_RULES |
| 2051 | logger.info("Connectivity rules enabled, Netlist object will be generated.") |
| 2052 | netlist |
| 2053 | end #CONNECTIVITY_RULES |
| 2054 | |
| 2055 | # === LAYOUT EXTENT === |
| 2056 | CHIP = extent.sized(0.0) |
| 2057 | logger.info("Total area of the design is #{CHIP.area()} um^2.") |
| 2058 | |
| 2059 | #================================================ |
| 2060 | #----------------- MAIN RUNSET ------------------ |
| 2061 | #================================================ |
| 2062 | |
| 2063 | logger.info("Starting GF180MCU DRC rules.") |
| 2064 | if FEOL |
| 2065 | logger.info("Running all FEOL rules") |
| 2066 | end #FEOL |
| 2067 | |
| 2068 | if BEOL |
| 2069 | logger.info("Running all BEOL rules") |
| 2070 | end #BEOL |
| 2071 | |
| 2072 | |
| 2073 | ################################################################################################ |
| 2074 | # Copyright 2022 GlobalFoundries PDK Authors |
| 2075 | # |
| 2076 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 2077 | # you may not use this file except in compliance with the License. |
| 2078 | # You may obtain a copy of the License at |
| 2079 | # |
| 2080 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 2081 | # |
| 2082 | # Unless required by applicable law or agreed to in writing, software |
| 2083 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 2084 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 2085 | # See the License for the specific language governing permissions and |
| 2086 | # limitations under the License. |
| 2087 | ################################################################################################ |
| 2088 | |
| 2089 | |
| 2090 | |
| 2091 | exec_end_time = Time.now |
| 2092 | run_time = exec_end_time - exec_start_time |
| 2093 | logger.info("%s DRC Total Run time %f seconds" % [table_name, run_time]) |
| 2094 | |
| 2095 | |