| # 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. |
| |
| #============================================================================================================================================================= |
| #------------------------------------------------------------- GF 0.18um MCU DRC RULE DECK (SAB) ------------------------------------------------------------- |
| #============================================================================================================================================================= |
| |
| require 'time' |
| require "logger" |
| |
| exec_start_time = Time.now |
| |
| logger = Logger.new(STDOUT) |
| |
| logger.formatter = proc do |severity, datetime, progname, msg| |
| "#{datetime}: Memory Usage (" + `pmap #{Process.pid} | tail -1`[10,40].strip + ") : #{msg} |
| " |
| end |
| |
| #================================================ |
| #----------------- FILE SETUP ------------------- |
| #================================================ |
| |
| # optional for a batch launch : klayout -b -r gf180mcu.drc -rd input=design.gds -rd report=gf180mcu_main.lyrdb |
| |
| logger.info("Starting running GF180MCU Klayout DRC runset on %s" % [$input]) |
| |
| if $input |
| if $topcell |
| source($input, $topcell) |
| else |
| source($input) |
| end |
| end |
| |
| logger.info("Loading database to memory is complete.") |
| |
| if $report |
| logger.info("GF180MCU Klayout DRC runset output at: %s" % [$report]) |
| report("DRC Run Report at", $report) |
| else |
| logger.info("GF180MCU Klayout DRC runset output at default location." % [File.join(File.dirname(RBA::CellView::active.filename), "gf180_drc.lyrdb").path]) |
| report("DRC Run Report at", File.join(File.dirname(RBA::CellView::active.filename), "gf180_drc.lyrdb")) |
| end |
| |
| if $thr |
| logger.info("Number of threads to use %s" % [$thr]) |
| threads($thr) |
| else |
| logger.info("Number of threads to use 16") |
| threads(16) |
| end |
| |
| # === TILING MODE === |
| if $run_mode == "tiling" |
| # use a tile size of 1mm - not used in deep mode- |
| # tiles(500.um) |
| # use a tile border of 10 micron: |
| # tile_borders(10.um) |
| tiles(1000) |
| logger.info("Tiling mode is enabled.") |
| |
| elsif $run_mode == "deep" |
| #=== HIER MODE === |
| deep |
| logger.info("deep mode is enabled.") |
| |
| elsif $run_mode == "flat" |
| #=== FLAT MODE === |
| flat |
| logger.info("flat mode is enabled.") |
| |
| else |
| #=== FLAT MODE === |
| flat |
| logger.info("flat mode is enabled.") |
| |
| end # run_mode |
| |
| #================================================ |
| #------------- LAYERS DEFINITIONS --------------- |
| #================================================ |
| |
| v5_xtor = polygons(112, 1 ) |
| dualgate = polygons(55 , 0 ) |
| poly2 = polygons(30 , 0 ) |
| nplus = polygons(32 , 0 ) |
| pplus = polygons(31 , 0 ) |
| comp = polygons(22 , 0 ) |
| nwell = polygons(21 , 0 ) |
| sab = polygons(49 , 0 ) |
| esd = polygons(24 , 0 ) |
| contact = polygons(33 , 0 ) |
| otp_mk = polygons(173, 5 ) |
| lvs_io = polygons(119, 5 ) |
| esd_mk = polygons(24 , 5 ) |
| |
| logger.info("Starting deriving base layers.") |
| #================================================ |
| #------------- LAYERS DERIVATIONS --------------- |
| #================================================ |
| |
| ncomp = comp & nplus |
| pcomp = comp & pplus |
| tgate = poly2 & comp |
| ngate = nplus & tgate |
| pgate = pplus & tgate |
| |
| #================================================ |
| #------------------ SWITCHES -------------------- |
| #================================================ |
| logger.info("Evaluate switches.") |
| |
| # FEOL |
| if $feol == "false" |
| FEOL = $feol |
| logger.info("FEOL is disabled.") |
| else |
| FEOL = "true" |
| logger.info("FEOL is enabled.") |
| end # FEOL |
| |
| # BEOL |
| if $beol == "false" |
| BEOL = $beol |
| logger.info("BEOL is disabled.") |
| else |
| BEOL = "true" |
| logger.info("BEOL is enabled.") |
| end # BEOL |
| |
| # connectivity rules |
| if $conn_drc == "true" |
| CONNECTIVITY_RULES = $conn_drc |
| logger.info("connectivity rules are enabled.") |
| else |
| CONNECTIVITY_RULES = false |
| logger.info("connectivity rules are disabled.") |
| end # connectivity rules |
| |
| # METAL_TOP |
| if $metal_top |
| METAL_TOP = $metal_top |
| else |
| METAL_TOP = "9K" |
| end # METAL_TOP |
| |
| logger.info("METAL_TOP Selected is %s" % [METAL_TOP]) |
| |
| # METAL_LEVEL |
| if $metal_level |
| METAL_LEVEL = $metal_level |
| else |
| METAL_LEVEL = "6LM" |
| end # METAL_LEVEL |
| |
| logger.info("METAL_STACK Selected is %s" % [METAL_LEVEL]) |
| |
| # WEDGE |
| if $wedge == "false" |
| WEDGE = $wedge |
| else |
| WEDGE = "true" |
| end # WEDGE |
| |
| logger.info("Wedge enabled %s" % [WEDGE]) |
| |
| # BALL |
| if $ball == "false" |
| BALL = $ball |
| else |
| BALL = "true" |
| end # BALL |
| |
| logger.info("Ball enabled %s" % [BALL]) |
| |
| # GOLD |
| if $gold == "false" |
| GOLD = $gold |
| else |
| GOLD = "true" |
| end # GOLD |
| |
| logger.info("Gold enabled %s" % [GOLD]) |
| |
| if $mim_option |
| MIM_OPTION = $mim_option |
| else |
| MIM_OPTION = "Nan" |
| end |
| |
| logger.info("MIM Option selected %s" % [MIM_OPTION]) |
| |
| # OFFGRID |
| if $offgrid == "false" |
| OFFGRID = false |
| else |
| OFFGRID = true |
| end # OFFGRID |
| |
| logger.info("Offgrid enabled %s" % [OFFGRID]) |
| |
| #================================================ |
| #----------------------SAB----------------------- |
| #================================================ |
| |
| |
| if FEOL |
| logger.info("FEOL section") |
| |
| # Rule SB.1: min. sab width is 0.42µm |
| logger.info("Executing rule SB.1") |
| sb1_l1 = sab.width(0.42.um, euclidian).polygons(0.001) |
| sb1_l1.output("SB.1", "SB.1 : min. sab width : 0.42µm") |
| sb1_l1.forget |
| |
| # Rule SB.2: min. sab spacing is 0.42µm |
| logger.info("Executing rule SB.2") |
| sb2_l1 = sab.outside(otp_mk).space(0.42.um, euclidian).polygons(0.001) |
| sb2_l1.output("SB.2", "SB.2 : min. sab spacing : 0.42µm") |
| sb2_l1.forget |
| |
| # Rule SB.3: Space from salicide block to unrelated COMP. is 0.22µm |
| logger.info("Executing rule SB.3") |
| sb3_l1 = sab.outside(comp).outside(otp_mk).separation(comp.outside(sab), 0.22.um, euclidian).polygons(0.001) |
| sb3_l1.output("SB.3", "SB.3 : Space from salicide block to unrelated COMP. : 0.22µm") |
| sb3_l1.forget |
| |
| # Rule SB.4: Space from salicide block to contact. |
| logger.info("Executing rule SB.4") |
| sb4_l1 = sab.outside(otp_mk).separation(contact, 0.15.um, euclidian).polygons(0.001).or(sab.outside(otp_mk).and(contact)) |
| sb4_l1.output("SB.4", "SB.4 : Space from salicide block to contact.") |
| sb4_l1.forget |
| |
| # Rule SB.5a: Space from salicide block to unrelated Poly2 on field. is 0.3µm |
| logger.info("Executing rule SB.5a") |
| sb5a_l1 = sab.outside(poly2.not(comp)).outside(otp_mk).separation(poly2.not(comp).outside(sab), 0.3.um, euclidian).polygons(0.001) |
| sb5a_l1.output("SB.5a", "SB.5a : Space from salicide block to unrelated Poly2 on field. : 0.3µm") |
| sb5a_l1.forget |
| |
| # Rule SB.5b: Space from salicide block to unrelated Poly2 on COMP. is 0.28µm |
| logger.info("Executing rule SB.5b") |
| sb5b_l1 = sab.outside(tgate).outside(otp_mk).separation(tgate.outside(sab), 0.28.um, euclidian).polygons(0.001) |
| sb5b_l1.output("SB.5b", "SB.5b : Space from salicide block to unrelated Poly2 on COMP. : 0.28µm") |
| sb5b_l1.forget |
| |
| # Rule SB.6: Salicide block extension beyond related COMP. is 0.22µm |
| logger.info("Executing rule SB.6") |
| sb6_l1 = sab.enclosing(comp, 0.22.um, euclidian).polygons(0.001) |
| sb6_l1.output("SB.6", "SB.6 : Salicide block extension beyond related COMP. : 0.22µm") |
| sb6_l1.forget |
| |
| # Rule SB.7: COMP extension beyond related salicide block. is 0.22µm |
| logger.info("Executing rule SB.7") |
| sb7_l1 = comp.enclosing(sab, 0.22.um, euclidian).polygons |
| sb7_l1.output("SB.7", "SB.7 : COMP extension beyond related salicide block. : 0.22µm") |
| sb7_l1.forget |
| |
| # Rule SB.8: Non-salicided contacts are forbidden. |
| logger.info("Executing rule SB.8") |
| sb8_l1 = contact.inside(sab) |
| sb8_l1.output("SB.8", "SB.8 : Non-salicided contacts are forbidden.") |
| sb8_l1.forget |
| |
| # Rule SB.9: Salicide block extension beyond unsalicided Poly2. is 0.22µm |
| logger.info("Executing rule SB.9") |
| sb9_l1 = sab.outside(otp_mk).enclosing(poly2.and(sab), 0.22.um, euclidian).polygons |
| sb9_l1.output("SB.9", "SB.9 : Salicide block extension beyond unsalicided Poly2. : 0.22µm") |
| sb9_l1.forget |
| |
| # Rule SB.10: Poly2 extension beyond related salicide block. is 0.22µm |
| logger.info("Executing rule SB.10") |
| sb10_l1 = poly2.enclosing(sab, 0.22.um, euclidian).polygons(0.001) |
| sb10_l1.output("SB.10", "SB.10 : Poly2 extension beyond related salicide block. : 0.22µm") |
| sb10_l1.forget |
| |
| # Rule SB.11: Overlap with COMP. is 0.22µm |
| logger.info("Executing rule SB.11") |
| sb11_l1 = sab.outside(otp_mk).overlap(comp, 0.22.um, euclidian).polygons |
| sb11_l1.output("SB.11", "SB.11 : Overlap with COMP. : 0.22µm") |
| sb11_l1.forget |
| |
| # Rule SB.12: Overlap with Poly2 outside ESD_MK. is 0.22µm |
| logger.info("Executing rule SB.12") |
| sb12_l1 = sab.outside(otp_mk).outside(esd_mk).overlap(poly2.outside(otp_mk).outside(esd_mk), 0.22.um, euclidian).polygons |
| sb12_l1.output("SB.12", "SB.12 : Overlap with Poly2 outside ESD_MK. : 0.22µm") |
| sb12_l1.forget |
| |
| # Rule SB.13: Min. area (um2). is 2µm² |
| logger.info("Executing rule SB.13") |
| sb13_l1 = sab.outside(otp_mk).with_area(nil, 2.um) |
| sb13_l1.output("SB.13", "SB.13 : Min. area (um2). : 2µm²") |
| sb13_l1.forget |
| # Rule SB.14a: Space from unsalicided Nplus Poly2 to unsalicided Pplus Poly2. (Unsalicided Nplus Poly2 must not fall within a square of 0.56um x 0.56um at unsalicided Pplus Poly2 corners). is 0.56µm |
| logger.info("Executing rule SB.14a") |
| sb14a_l1 = poly2.and(nplus).and(sab).separation(poly2.and(pplus).and(sab), 0.56.um, square).polygons |
| sb14a_l1.output("SB.14a", "SB.14a : Space from unsalicided Nplus Poly2 to unsalicided Pplus Poly2. (Unsalicided Nplus Poly2 must not fall within a square of 0.56um x 0.56um at unsalicided Pplus Poly2 corners). : 0.56µm") |
| sb14a_l1.forget |
| |
| # Rule SB.14b: Space from unsalicided Nplus Poly2 to P-channel gate. (Unsalicided Nplus Poly2 must not fall within a square of 0.56um x 0.56um at P-channel gate corners). is 0.56µm |
| logger.info("Executing rule SB.14b") |
| sb14b_l1 = poly2.and(nplus).and(sab).separation(pgate, 0.56.um, square).polygons |
| sb14b_l1.output("SB.14b", "SB.14b : Space from unsalicided Nplus Poly2 to P-channel gate. (Unsalicided Nplus Poly2 must not fall within a square of 0.56um x 0.56um at P-channel gate corners). : 0.56µm") |
| sb14b_l1.forget |
| |
| # Rule SB.15a: Space from unsalicided Poly2 to unrelated Nplus/Pplus. is 0.18µm |
| logger.info("Executing rule SB.15a") |
| sb15a_l1 = poly2.and(sab).separation(nplus.or(pplus), 0.18.um, euclidian).polygons(0.001) |
| sb15a_l1.output("SB.15a", "SB.15a : Space from unsalicided Poly2 to unrelated Nplus/Pplus. : 0.18µm") |
| sb15a_l1.forget |
| |
| sb_15b_1 = poly2.interacting(nplus.or(pplus)).and(sab).edges.not(poly2.edges.and(sab)).separation(nplus.or(pplus).edges, 0.32.um, projection).polygons(0.001) |
| sb_15b_2 = poly2.interacting(nplus.or(pplus)).and(sab).separation(nplus.or(pplus), 0.32.um, projection).polygons(0.001) |
| # Rule SB.15b: Space from unsalicided Poly2 to unrelated Nplus/Pplus along Poly2 line. is 0.32µm |
| logger.info("Executing rule SB.15b") |
| sb15b_l1 = sb_15b_1.and(sb_15b_2).outside(otp_mk) |
| sb15b_l1.output("SB.15b", "SB.15b : Space from unsalicided Poly2 to unrelated Nplus/Pplus along Poly2 line. : 0.32µm") |
| sb15b_l1.forget |
| |
| sb_15b_1.forget |
| sb_15b_2.forget |
| # Rule SB.16: SAB layer cannot exist on 3.3V and 5V/6V CMOS transistors' Poly and COMP area of the core circuit (Excluding the transistors used for ESD purpose). It can only exist on CMOS transistors marked by LVS_IO, OTP_MK, ESD_MK layers. |
| logger.info("Executing rule SB.16") |
| sb16_l1 = sab.outside(otp_mk).outside(otp_mk.or(lvs_io).or(esd_mk)).not_outside(ngate.or(pgate.and(nwell))) |
| sb16_l1.output("SB.16", "SB.16 : SAB layer cannot exist on 3.3V and 5V/6V CMOS transistors' Poly and COMP area of the core circuit (Excluding the transistors used for ESD purpose). It can only exist on CMOS transistors marked by LVS_IO, OTP_MK, ESD_MK layers.") |
| sb16_l1.forget |
| |
| |
| end #FEOL |
| |
| |
| exec_end_time = Time.now |
| run_time = exec_end_time - exec_start_time |
| logger.info("DRC Run time %f seconds" % [run_time]) |
| |