;*******************************************************************************  
;*******************************************************************************  
;***********************                          ******************************  
;***********************      D   I   V    A      ******************************  
;***********************                          ******************************  
;*******************************************************************************  
;*******************************************************************************  
;******                                                                   ******  
;******       E X T R A C T -  D R C        INPUT  COMMAND  FILE          ******  
;******                                                                   ******  
;******          B I C M O S - 5    TLM   MOS / BIPOLAR   TECHNOLOGY      ****** 
;******                 ============================                      ******  
;******                                                                   ******  
;******   0.5 um poly - N EPI  - 3 metal - basic process + 2nd poly       ****** 
;******                                                  + niso + hipo    ****** 
;******                                                                   ******  
;******   UPDATE     :  4 Septem 96                                       ****** 
;******                                                                   ******  
;******   SOURCE : CENTRAL R&D  CROLLES                                   ******  
;******            MASTER VERSION : 6_2                                   ******  
;******                                                                   ******  
;******   REFERENCED DOCUMENTS :                                          ******  
;******                          UDCS Nb 0092806  REV.A - XX.JUL.95       ****** 
;******                        ( BICMOS5 DESIGN RULE MANUAL )             ****** 
;******                                                                   ******  
;*******************************************************************************  
;******                                                                   ******  
;******   OVERVIEW :                                                      ******  
;******                                                                   ******  
;******   This DRC-EXTRACT file has been developped for usage in          ******  
;******   UNICAD-2 ( or pure CADENCE FRAMEWORK II ) system.               ******  
;******                                                                   ******  
;******   Inside the BICMOS5 DESIGN KIT which provides the whole design   ****** 
;******   environment for CADENCE FRAMEWORK II, this file is called       ******  
;******   "bc5b5XX.drcExtract_##" and is present in the current version   ****** 
;******   of the Design Kit .                                             ******  
;******                                                                   ******  
;*******************************************************************************  
;******                                                                   ******  
;******   MODIFICATIONS :                                                 ******  
;******                                                                   ******  
;******     21aug95 :                                                     ****** 
;******              ACCORDING TO THE PROCESS ENGINEER REQUIREMENT        ****** 
;******                                                                   ****** 
;******      - the rule 14.8 defined by "poly3 distance to poly1   1.0"   ****** 
;******        is checked; this rule will be added in the next BICMOS5    ****** 
;******        DRM release.                                               ****** 
;******      - the rule entitled "nlddprot distance to N+ sinker active"  ****** 
;******        is referenced by 83.10 i.o 83.8 which is already used.     ****** 
;******     15sep95 :                                                     ****** 
;******      - bond pads rules checks modified and aligned on the UDCS    ****** 
;******        document 0018063 "EWS and Assembly Rules", rev. J,         ****** 
;******        chapter 7.4.4 "Rules for Bonding Pads and Testing Pads".   ****** 
;******        Rules related to this chapter are referenced 31.pX in      ****** 
;******        the file.                                                  ****** 
;******     21sep95 :                                                     ****** 
;******      - switches "nodiode" and "mdiode" renamed "diodno" and       ****** 
;******        "diodm" repectively to be compatible with the name         ****** 
;******        convention used in the DRACULA file.                       ****** 
;******     03oct95 :                                                     ****** 
;******      - rule 20.3 check modified to avoid false errors in case of  ****** 
;******        nwell guard-ring drawn without niso.                       ****** 
;******     17oct95 :                                                     ****** 
;******      - error message related to rule 14.imp5 corrected.           ****** 
;******     20oct95 :                                                     ****** 
;******      - rules 20.imp2, 20.imp3 and 20.imp4 added:                  ****** 
;******        niso under nwell or rnwell or nepi not allowed.            ****** 
;******     23oct95 :                                                     ****** 
;******      - implicites rules related to shorted circuits modified      ****** 
;******        to avoid to consider vias on pads when switch "nopad"      ****** 
;******        is activated.                                              ****** 
;******     26oct95 :                                                     ****** 
;******      - rule 25.0 added : "via1 over poly2 of POLY2/POLY capacitor ****** 
;******        forbidden".                                                ****** 
;******     27oct95 :                                                     ****** 
;******      - definition of derived layer "pad" modified                 ****** 
;******     28nov95 :                                                     ****** 
;******      - name of ivpcell for shielded devices changed.              ****** 
;******     04dec95 :                                                     ****** 
;******      - rule 31.18 and rule 31.p20 added.                          ****** 
;******     02jan96 :                                                     ****** 
;******      - switch "erc" added.                                        ****** 
;******      - improved check for rules 1.2 and 1.3                       ****** 
;******      - check of shorted circuit with marker "mshort" improved     ****** 
;******      - rule 12.8 check : value changed (2.0 instead of 3.0)       ****** 
;******      - rule 31.imp1 added.                                        ****** 
;******      - rules 31.pX renamed 31.AX                                  ****** 
;******      - rule "via1 is forbidden over poly2 capacitor plate"        ****** 
;******        removed.                                                   ****** 
;******     20feb96 :                                                     ****** 
;******      - vertical pnp custom device recognition added               ****** 
;******     08mar96 :                                                     ****** 
;******      - rule 9.imp1 check improved.                                ****** 
;******     12mar96 :                                                     ****** 
;******      - rule 20.imp2 removed; redundant with rule 20.imp1.         ****** 
;******      - rule 20.3 check improved.                                  ****** 
;******     19apr96 :                                                     ****** 
;******      - sheet and contact resistances values for N+ act, P+ act,   ****** 
;******        P+ poly and N+ poly resistors updated.                     ****** 
;******     24apr96 :                                                     ****** 
;******      - npn bipolar transistors n2e, n2a, n10e, n10a recognition   ****** 
;******        added.                                                     ****** 
;******      - rpldd resistor recognition improved to allow its extraction****** 
;******        when polyem of rpldd resistor is connected as required     ****** 
;******        in this process.                                           ****** 
;******     13may96 :                                                     ****** 
;******      - addition of nwell resistor (DRC & EXTRACT)                 ****** 
;******     22may96 :                                                     ****** 
;******      -  poly2/poly/N+sink sandwich capacitor extraction added.    ****** 
;******     26jun96 :                                                     ******  
;******      - nwell resistor recognition improved to allow nwell resistor******  
;******        extraction in case of terminals have unsalicided areas.    ******  
;******      - rule check 31.imp2 modified to avoid false error in case of******  
;******        rnwell under pads.                                         ******  
;******      - diode management improved to allow N+/pwell diode          ******  
;******        extraction on heads of rnwell resistors and in case of     ******  
;******        N+ active crossing pwell/nwell boundary by using marker    ******  
;******        mdiode on the N+ active area defining the diode            ******  
;******        to be extracted. By default, for these particular          ******  
;******        configuration no diodes are extracted.                     ******  
;******      - new trprot derived layer management limited to the         ******  
;******        extract part.                                              ******  
;******      - rule check 13.18 modified : value 20.0 replaced by 5.0.    ****** 
;******      - parameter "width" replaced by parameter "wid1" in          ****** 
;******        the saveParameter function for hipo resistor extraction.   ****** 
;******      - rule check 2.15 modified : value 2.0 replaced by 1.5.      ****** 
;******        Only minimum value is checked.                             ****** 
;******      - pnp lateral PL15B recognition added.                       ****** 
;******     22jul96 :                                                     ****** 
;******      - distinction of nwell resistor standard and nwell resistor  ****** 
;******        with hcmos5 value ( then used with the marker l120 )       ****** 
;******     01aug96 :                                                     ****** 
;******       - rule 13.2, 13.4 checks modified : for poly coming         ****** 
;******         from HCMOS5 designs covered by marker m5vsz the rules     ****** 
;******         mentioned above are checked with the value required       ****** 
;******         before sizing.                                            ****** 
;******       - new management for mixed 3.3V/5.0V power-supplies         ****** 
;******         including new value for rule 19.6 (0.5 i.o 0.6/0.55)      ****** 
;******     20aug96 :                                                     ******  
;******       - rules 18.18 & 18.19 modified (siprot edge inside active)  ******  
;******     04sep96 : rule 14.imp13 added : Pldd res top to be tied to Nw *****  
;******     09sep96 : rule 17.6 & 9 modif (strap edge inside active only) ******  
;******                                                                   ******  
;******                                                                   ******  
;*******************************************************************************  
;******                                                                   ******  
;******  DIRECTION FOR USE :                                              ******  
;******                                                                   ******  
;******    SWITCHES                                                       ******  
;******    --------                                                       ******  
;******  - LEVEL1 or/and LEVEL2 input-layers management :                 ******  
;******    By default, the LEVEL2 is used, that is all metallisations are ******  
;******    split into "MxGND, MxVDD, MxINT, MxIO.                         ******  
;******    If the LEVEL1 is needed, its layers can be loaded, in addition ******  
;******    to the LEVEL2 layers, by invoking the switch "level1"          ******  
;******                                                                   ******  
;******  - DIODES MANAGEMENT                                              ******  
;******    By default, all types of diodes are extracted from the layout, ******  
;******    wether the marker layer mdiode is used or not.                 ******  
;******    "diodno" switch : if used, this switch prevents from extracting******  
;******    all types of diodes ( marker "mdiode" used or not).            ******  
;******    "diodm" switch : it may happen that you want the same type of  ******  
;******    diode to be extracted in certain part of the circuit, and not  ******  
;******    in other parts. The switch "diodm" allows you to do that, as   ******  
;******    far as you have covered the diodes you want to be kept with    ******  
;******    the "mdiode" marker layer.                                     ******  
;******                                                                   ******  
;******  - DRC in standard mode :                                         ******  
;******    No specific switch has to be specified to launch DRC.          ******  
;******    ( standard "drc?" switch name is used in the file ).           ******  
;******                                                                   ******  
;******  - EXTRACT, without parasitics output :                           ******  
;******    No specific switch has to be specified to launch EXTRACT.      ******  
;******    ( standard "extract?" switch name is used in the file ).       ******  
;******                                                                   ******  
;******  - EXTRACT, with parasitics output :                              ******  
;******    One of the following switches has to be specified :            ******  
;******    "LPE_pair" switch                                              ****** 
;******    for parasitic capacitances connected between the actual nodes. ******  
;******    (usage of "two-net" option of parasitics extraction ).         ******  
;******    "LPE_single" switch                                            ****** 
;******    for parasitic capacitances referenced to the ground (node 0!). ******  
;******    (usage of "one-net" option of parasitics extraction ).         ******  
;******                                                                   ******  
;******  - BONDING PADS MANAGEMENT                                        ******  
;******    The bond pads rules checking is aligned on the document        ******  
;******    "EWS AND ASSEMBLY RULES", Rev. J, Chapter 7.4.4 "Rules for     ******  
;******    Bonding Pads and Testing Pads".                                ******  
;******    In this revision, bond pads rules are divided in four distincts******  
;******    set of rules corresponding to the four device classes allowed  ******  
;******    which are C1, C2, D and E. Classes C1 and C2 refer to the      ******  
;******    minimum pad pitch 150 um and share the same set of rules       ******  
;******    checked by DIVA.  Classes D and E refer respectively to the    ******  
;******    minimum pad pitch 125 um and 100 um.                           ******  
;******    Since pads belonging to different classes can't be put in the  ******  
;******    same circuit, only one set of rules is checked by circuit.     ******  
;******    The designer can specify by means of switches the set of rules ******  
;******    he wants to check and which corresponds to the device class    ******  
;******    he choosed for the pads he placed in his circuit.              ******  
;******    The switches available are "pad125" and "pad100" which         ******  
;******    correspond respectively to class D and E. By default, when any ******  
;******    of these switches are activated, rules related to class C1 and ******  
;******    C2 are checked.                                                ******  
;******    Besides, switch "nopad" is available in addition to the        ******  
;******    previous ones. When "nopad" is selected, rules related to the  ******  
;******    bond pads are not checked. This allows the designer to check   ******  
;******    the core of the circuit without checking the pads placed around******  
;******    which is time consuming. In case pads related to class E are   ******  
;******    placed in the circuit, if switch "nopad" is selected, switch   ******  
;******    "pad100" must be activated at the same time. In case of        ******  
;******    other classes switch "nopad" only is needed.                   ******  
;******                                                                   ******  
;******  - ADDITIONAL SWITCHES are provided for both DRC and EXTRACT :    ******  
;******    (see availability further in the file under the corresponding  ******  
;******    switches ).                                                    ******  
;******                                                                   ******  
;******    "samenet"                                                      ******  
;******     This switch allows to connect together separate power lines   ******  
;******     having different names but same purpose (VDD1! to VDD2!, or   ******  
;******     GND1! to GND2! ... etc ). See the default list in the         ******  
;******     concerned chapter.                                            ******  
;******                                                                   ******  
;******    "usenotext"                                                    ******  
;******     If this switch is not activated (this is the default ), both  ******  
;******     pins and labels are used, and their names must be consistent. ******  
;******     These labels are placed over the connectivity and belong to   ******  
;******     the label layers polytext, m1text, m2text, m3text, pintext or ******  
;******     m1pintext, m2pintext, m3pintext.                              ******  
;******     This switch allows to not take these labels into account,     ******  
;******     and in this case, only pins will be considered as terminals.  ******  
;******                                                                   ******  
;******    "nodetext"                                                     ******  
;******     This switch allows the labelling by text only from toplevel   ******  
;******     layers "nodetext" and "pintext", used for library development.******  
;******                                                                   ******  
;******    "filter"                                                       ******  
;******     This switch is reserved to EXTRACT :                          ******  
;******     As MOS pruning function provided by the LVS rules doesn't fil-******  
;******     ter all unused MOS, ( especially series MOS with gate to power *****  
;******     or ground, where an internal node is then created ), this     ******  
;******     switch allows to filter out :                                 ******  
;******     - all the NMOS which have the gate connected to ground having ******  
;******     the name "gnd!" ;                                             ******  
;******     - all the PMOS which have the gate connected to power having  ******  
;******     the name "vdd!" ;                                             ******  
;******     For this reason, it is recommanded to invoke the "samenet"    ******  
;******     switch at the same time.                                      ******  
;******     - all the MOS which have the gate unconnected to any terminal.******  
;******                                                                   ******  
;******    "benduse"                                                      ******  
;******     This switch allows the parameter WIDTH of the bent transistors******  
;******     to be reduced by a factor of 0.115L at each 90 degree bend.   ******  
;******     In some cases, this correction happens to be too high,        ******  
;******     By defaults, no WIDTH correction is performed on gates.       ******  
;******                                                                   ******  
;******    "bendopti"                                                     ******  
;******     In some cases, the correction performed on bent transistors   ******  
;******     when "benduse" switch is activated happens to be too high;    ******  
;******     this occurs when the bend value is less than L.               ******  
;******     If more accurate WIDTH value is required, "bendopti" switch   ******  
;******     must be activated to avoid correction on such bends.          ******  
;******     NOTES :                                                       ******  
;******     - "benduse" switch must have been selected to make this       ******  
;******       switch active;                                              ******  
;******     - process timing will be greater in case of large design;     ******  
;******     - the compatibility with the LVS DRACULA file is not ensured  ******  
;******       when this switch is activated; this means that a design     ******  
;******       which passes DIVA LVS without error might not pass with     ******  
;******       DRACULA LVS.                                                ******  
;******                                                                   ******  
;******    "dnsub"                                                        ******  
;******     This switch allows the extraction of the Nwell/P-Substrate    ******  
;******     diode.                                                        ******  
;******                                                                   ******  
;******                                                                   ******  
;******    USING MARKER :                                                 ******  
;******    -------------                                                  ******  
;******    The following design convention must be used :                 ******  
;******                                                                   ******  
;******    "mres" : ( particular scope )                                  ******  
;******      For P+ active, N+ active and poly resistors as well :        ******  
;******      - if marker is not used, only the values of resistors with   ******  
;******      rectangular body will be correctly extracted ( defined by    ******  
;******      the intersection of active and siprot or poly and siprot).   ******  
;******      - if marker is used, it has to be put at the exact place     ******  
;******      you want extract the resistor body, inside or coincident     ******  
;******      the siprot, and the edges in the length direction slightly   ******  
;******      overlapping the active (or poly) (0.1 um for ex. ).          ******  
;******                                                                   ******  
;******    "mdiode" : ( particular scope )                                ******  
;******      - P+/Nwell and N+/Pwell diodes are recognised without marker ******  
;******      if they are drawn alone, that is if their active is not      ******  
;******      shared with a resistor.                                      ******  
;******      - In case of a diode you want associate with a resistor, the ******  
;******      the marker must be placed at the terminal you have choosen,  ******  
;******      and including it.                                            ******  
;******      - Some resistor configurations you want extract as diode only******  
;******      can also be managed : the marker must enclose the entire     ******  
;******      concerned active area ( 0.1 um for ex ).                     ******  
;******                                                                   ******  
;******    "drcio" : ( general scope )                                    ******  
;******      This marker must be used for a correct recognition of some   ******  
;******      special MOS configurations : it has to be put                ******  
;******      - on the intersection of poly for cross-gate transistors     ******  
;******      - on the poly gate plug of ring-gate transistors.            ******  
;******                                                                   ******  
;******    "nondrc" :                                                     ****** 
;******      This marker must placed on the pass transistors used in the  ****** 
;******      SRAM cells to allow the check of the rule 2.4 specific to    ****** 
;******      the SRAM cells. The marker must enclose the gate of the      ****** 
;******      transistors using rule 2.4 and must not overlap the gate     ****** 
;******      of transistors using standard rule 2.1.                      ****** 
;******                                                                   ****** 
;******    "mshort" :                                                     ******  
;******      This marker is used to describe areas where DRC checks       ******  
;******      detecting short-circuits between power supplies and signals  ******  
;******      should not be activated because an "intentional short" has   ******  
;******      been made.                                                   ******  
;******      It has to be put :                                           ******   
;******      - either on the intersection of metal power with metal       ******   
;******      interconnect when they overlap;                              ******   
;******      - or on the metal interconnect when butting metal power.     ******   
;******      In this case the edge defined by metal power butting metal   ******   
;******      interconnect must be at least coincident with marker mshort  ******    
;******      or inside; the minimum width required for marker mshort      ******  
;******      is 0.1 um.                                                   ******  
;******                                                                   ******  
;******    "mpnp" :                                                       ******  
;******      This marker is used for the PNP vertical transistor          ******  
;******      extraction. It must enclose the P+ active area which defines ******  
;******      the emitter.                                                 ******  
;******                                                                   ******  
;******    "msub" :                                                       ******  
;******      This marker allows to separate ground nodes on a single pwell******  
;******      area.                                                        ******  
;******                                                                   ******  
;******                                                                   ******  
;*******************************************************************************  
;  
drcExtractRules(  
;  
;*******************************************************************************  
;**********                                                           **********  
;**********		INPUT   LAYER   BLOCK                         **********  
;**********                                                           **********  
;*******************************************************************************  
;  
        nepi    = geomOr( "nepi" )                                               
        nburied = geomOr( "nburied" )                                            
        niso    = geomOr( "niso" )                                               
        active  = geomOr( "active" )  
        nwell   = geomOr( "nwell" )  
        rnwell  = geomOr( "rnwell" )                                               
        sinker  = geomOr( "sinker" )                                             
        polyh5  = geomOr( "poly" )                                               
        polyh5l = geomOr( "poly5l" )                                             
        cap     = geomOr( "cap" )                                                
        poly2   = geomOr( "poly2" )                                              
        nldprot = geomOr( "nlddprot" )  
        pminus  = geomOr( "pminus" )                                             
        emcut   = geomOr( "emcut" )                                              
        polyem  = geomOr( "polyem" )                                             
        pplus   = geomOr( "pplus" )  
        presist = geomOr( "presist" )                                            
        siprot  = geomOr( "siprot" )  
        contact = geomOr( "contact" )  
        m1int   = geomOr( "m1int" )  
        m1vdd   = geomOr( "m1vdd" )  
        m1gnd   = geomOr( "m1gnd" )  
        m1io    = geomOr( "m1io" )  
        via     = geomOr( "v1" )  
        m2int   = geomOr( "m2int" )  
        m2vdd   = geomOr( "m2vdd" )  
        m2gnd   = geomOr( "m2gnd" )  
        m2io    = geomOr( "m2io" )  
        vi2     = geomOr( "v2" )  
        m3int   = geomOr( "m3int" )  
        m3vdd   = geomOr( "m3vdd" )  
        m3gnd   = geomOr( "m3gnd" )  
        m3io    = geomOr( "m3io" )  
        nitride = geomOr( "nitride" )  
        polyi   = geomOr( "polyimide" )  
        nogate  = geomOr( "drcio" )  
        nogateL = geomOr( "nogate" )                                             
        nogate  = geomOr( nogate nogateL )                                       
        mrm1    = geomOr( "mrm1" )                                               
        mrm2    = geomOr( "mrm2" )                                               
        mrm3    = geomOr( "mrm3" )                                               
        mrpo    = geomOr( "mrpo" )                                               
        mshield = geomOr( "mshield" )                                            
        mpnp    = geomOr( "mpnp" )                                                  
        mnpn    = geomOr( "mnpn" )                                               
        mrnw    = geomOr( "l120" )  ; marker for nw res with hcmos5 value  
        mres    = geomOr( "mres" )  
        mdiode  = geomOr( "mdiode" )  
        mshort  = geomOr( "mshort" )  
        msram   = geomOr( "nondrc" )                                             
        msub    = geomOr( "msub" )  
        m3vns   = geomOr( "m3vnos" )                                             
        m5vsz   = geomOr( "m5vsz" )                                              
        bulk    = geomBkgnd( "bkgnd" )  
;  
        met1pw  = geomOr( m1vdd m1gnd )  
        met1sig = geomOr( m1int m1io )  
        metal1  = geomOr( met1sig met1pw )  
        met2pw  = geomOr( m2vdd m2gnd )  
        met2sig = geomOr( m2int m2io )  
        metal2  = geomOr( met2sig met2pw )  
        met3pw  = geomOr( m3vdd m3gnd )  
        met3sig = geomOr( m3int m3io )  
        metal3  = geomOr( met3sig met3pw )  
;  
;  
;	Possibility of LEVEL1 layers in addition to LEVEL2  
;	--------------------------------------------------  
;  
 ivIf( switch("level1") then  
;  
        met1    = geomOr( "metal1" )  
        metal1  = geomOr(  met1 metal1 )  
        met2    = geomOr( "metal2" )  
        metal2  = geomOr(  met2 metal2 )  
        met3    = geomOr( "metal3" )  
        metal3  = geomOr(  met3 metal3 )  
 )  
;  
        met1drc = geomOr( metal1 )           
        met2drc = geomOr( metal2 )           
        met3drc = geomOr( metal3 )           
;  
;*******************************************************************************  
;**********                                                           **********  
;**********         	CUSTOMER SPECIFIC SIZINGS                     **********  
;**********                                                           **********  
;*******************************************************************************  
;  
; unused  
;  
;*******************************************************************************  
;**********                                                           **********  
;**********		LAYER CREATION FOR CHECKS                     **********  
;**********                                                           **********  
;*******************************************************************************  
;  
;------------------------------------------------------------------------------- 
;      POLY  DERIVATION                                                          
;      FOR MIXED 3.3V AND 5.0V POWER SUPPLIES IN THE SAME DESIGN                 
;      WITH 2 POLY LAYERS AND 1 RECOGNITION MARKER LAYER                         
;------------------------------------------------------------------------------- 
;                                                                                
ivIf( switch( "drc?" ) || ( switch( "extract?" )                                 
      && ( switch( "LPE_pair" ) || switch( "LPE_single" ) ) ) then               
;                                                                                
poh5nsz = geomOutside( polyh5 m5vsz )                                            
poh5m5v = geomInside( polyh5 m5vsz )                                             
poh5sz  = geomSize( poh5m5v 0.05 )       ; POLY FROM HCMOS5 SIZED BY 0.05 um     
polynsz = geomOr( poh5nsz polyh5l )                                              
poly    = geomOr( polynsz poh5sz )                                               
;                                                                                
else                                                                             
;                                                                                
poly    = geomOr( polyh5 polyh5l )                                               
;                                                                                
)                                                                                
;                                                                                
;-------------------------------------------------------------------------------  
;	WELLS  DERIVATION   
;-------------------------------------------------------------------------------  
;  
sub     = geomOr( geomAndNot( bulk geomSize( msub .1 ) ) msub )  
nwrnw   = geomOr( nwell rnwell )                                                   
pwell   = geomAndNot( sub geomOr( nepi nwrnw ) )                                 
;                                       ; DERIVED PWELL AREA EVENTUALLY          
;                                       ; SPLITTED BY "MSUB"  
wells   = geomOr( pwell nwell )         ; NO-ANALOG AREAS  
;  
;       FIND  FLOATING  NWELL  
;       ---------------------  
;  
nwellf  = geomOutside( geomOverlap( nwell geomOr( poly2 nitride ) ) active )     
;                                       ; FLOATING NWELL UNDER PADS              
;                                       ; OR POLY2/POLY CAPACITORS               
 ivIf( switch( "drc?" ) then  
nwellc  = geomAndNot( nwell nwellf )  
 )  
;  
 ivIf( switch( "extract?" ) then  
nwells  = geomAndNot( nwrnw nwellf )    ; TO AVOID FLOATING NWELL                
pwells  = geomAndNot( sub geomOr( nepi nwells ) )                                
;                                       ; DERIVED PWELL AREA EVENTUALLY          
;                                       ; SPLITTED BY "MSUB"  
 )  
;  
;  
;-------------------------------------------------------------------------------  
;	ACTIVE  DERIVATION   
;-------------------------------------------------------------------------------  
;  
pactive = geomAnd( active pplus )        ; SEPARATED P  ACTIVE  
pdiff0  = geomAndNot( geomAndNot( pactive poly ) polyem )  ; SEPARATED P+ ACTIVE 
nactive = geomAndNot( active geomOr( pplus pminus ) )   ; SEPARATED N  ACTIVE    
nacross = geomStraddle( nactive nwrnw )                                            
ndiff0  = geomAndNot( geomAndNot( geomAndNot( nactive poly ) polyem ) sinker )   
;                                                        ; SEPARATED N+ ACTIVE   
nactsk  = geomAnd( nactive sinker )                                              
ndifsk  = geomAnd( nactsk nepi )                        ; N+ SINKER ACTIVE       
pmactiv = geomAnd( active pminus )                                               
pdifbas = geomAnd( pmactiv nepi )                       ; P-BASE ACTIVE          
;  
pnact   = geomAnd( pactive wells )       ; SEPARATED NON ANALOG P ACTIVE  
nnact   = geomAnd( nactive wells )       ; SEPARATED NON ANALOG N ACTIVE  
actinw  = geomOr( pnact nnact )          ; ALL ACTIVE IN NON ANALOG WELLS  
actinws = geomOr( actinw geomAnd( active rnwell ) )                              
;  
pinnw   = geomAnd( pactive nwell  )      ; P ACTIVE IN NWELL  
ninpw   = geomAnd( nactive pwell  )      ; N ACTIVE IN PWELL  
pinnepi = geomAnd( pactive nepi )                       ; P+ ACTIVE IN NEPI      
ninnepi = geomAnd( geomOutside( nactive sinker ) nepi ) ; N+ ACTIVE IN NEPI      
actnepi = geomAnd( active nepi )                        ; ALL ACTIVE IN NEPI     
;  
;-------------------------------------------------------------------------------  
;       STRAPS  DERIVATION   
;-------------------------------------------------------------------------------  
;  
pstrap  = geomAnd( pactive pwell )       ; P ACTIVE WELL STRAPS IN PWELL  
pstrapL = geomOr( pstrap )                                                         
pstrapN = geomAndNot( pstrap niso )                                              
;  
nstrap  = geomAnd( nactive nwrnw )       ; N ACTIVE WELL STRAPS IN NWELL           
nstrapL = geomOr( nstrap )                                                         
;  
nstrtp  = geomButting( nstrap pinnw )    ; N ACTIV TOUCHING P ACTIV IN NWELL  
pstrtn  = geomButting( pstrap ninpw )    ; P ACTIV TOUCHING N ACTIV IN PWELL  
;  
;-------------------------------------------------------------------------------  
;	POLY  RESISTORS  DERIVATION   
;-------------------------------------------------------------------------------  
;  
gate    = geomOutside( geomAnd( active poly ) nepi )    ; ALL GATES              
;  
 ivIf( switch( "drc?" ) then  
trprot  = geomEnclose( siprot gate )  
 )  
;  
 ivIf( switch( "extract?" ) then  
sipa    = geomAnd( siprot active)  
sipg1   = geomEnclose( sipa gate )  
sipo    = geomAnd( siprot poly )  
sipg2   = geomEnclose( sipo gate )  
trprot  = geomOr( sipg1 sipg2 )  
 )  
;  
;start epidio                                                                    
;trprot  = geomEnclose( siprot geomOr( gate geomAnd( polyem emcut) ) )           
;end epidio                                                                      
siprotx = geomAndNot( siprot trprot )  
pofield = geomAndNot( poly active )                     ; POLY OVER FIELD  
polyemf = geomAndNot( polyem active )                   ; POLYEM OVER FIELD      
;  
siprpo1 = geomOutside( geomAnd( pofield siprotx ) poly2 )                        
siprpo3 = geomAnd( polyemf siprotx )                                             
;  
respo1  = geomOutside( siprpo1 mres )   
mrespo1 = geomAnd( siprpo1 mres )  
polconn = geomAndNot( poly geomOr( respo1 mrespo1 ) )   ; INTERCONNECT POLY (GATE INCLUDED)  
rpoly   = geomButting( geomOr( respo1 mrespo1 ) polconn  keep > 1 )        
;                                                       ; POLY RESISTORS    BODY  
rpocap  = geomInside( rpoly cap )                       ; N+ POLY CAP RES   BODY 
rhipo   = geomInside( geomInside( rpoly presist ) nwell ) ;  HIPO POLY RESISTOR  
rpoly   = geomAndNot( rpoly rhipo )                                              
rnpo1   = geomAndNot( geomOutside( rpoly pplus ) rpocap ) ; N+ POLY RES     BODY 
rppo1   = geomInside( rpoly pplus )                     ; P+ POLY RESISTORS BODY  
;                                                                                
respo3  = geomOutside( siprpo3 mres )                                            
mrespo3 = geomAnd( siprpo3 mres )                                                
polyemc = geomAndNot( polyem geomOr( respo3 mrespo3 ) ) ;INTERCONNECT POLYEM     
rpolyem = geomButtin( geomOr( respo3 mrespo3 ) polyemc  keep > 1 )              
;                                                       ; POLYEM RESISTORS  BODY 
rnpo3   = geomOutside( rpolyem pplus )                  ; N+ POLYEM RES     BODY 
;  
;------------------------------------------------------------------------------- 
;       POLY2/POLY  CAPACITOR  DERIVATION                                        
;------------------------------------------------------------------------------- 
;                                                                                
cpo1po2 = geomAnd( cap geomAnd( poly poly2 ) )                                   
;                                                                                
;------------------------------------------------------------------------------- 
;      POLY/N+ SINKER  CAPACITOR  DERIVATION                                     
;------------------------------------------------------------------------------- 
;                                                                                
cpo1nsk = geomAnd( polconn geomAnd( ndifsk nburied ) )                           
;                                                                                
;------------------------------------------------------------------------------- 
;      SANDWICH CAPA : POLY2/POLY/N+SINKER                                       
;------------------------------------------------------------------------------- 
;                                                                                
sandw   = geomAnd( cpo1po2 cpo1nsk )                                             
cpo1po2 = geomOutside( cpo1po2 sandw )                                           
cpo1nsk = geomOutside( cpo1nsk sandw )                                           
csand   = geomEnclose( geomAnd( poly active ) sandw )                            
;                                                                                
;-------------------------------------------------------------------------------  
;	MOS  TRANSISTORS  DERIVATION   
;-------------------------------------------------------------------------------  
;  
pdifnw  = geomAndNot( pinnw poly )                       ; P+ ACTIVE IN NWELL      
ndifpw  = geomAndNot( ninpw poly )                       ; N+ ACTIVE IN PWELL      
;  
ninpwpo = geomOverlap( ninpw poly )                      ; N ACTIVE FOR NMOS       
ngate0  = geomAnd( ninpwpo polconn )  
ngate   = geomAndNot( ngate0 nogate )                    ; NMOS GATE               
;  
pinnwpo = geomOverlap( pinnw poly )                      ; P ACTIVE FOR PMOS       
pgate0  = geomAnd( pinnwpo polconn )  
pgate   = geomAndNot( pgate0 nogate )                    ; PMOS GATE               
;                                                                                 
ivIf( switch("benduse") then             ; BEGINNING OF THE "benduse" SECTION     
;  
   ivIf( switch("bendopti") then         ; BEGINNING OF THE "bendopti" SECTION  
;  
ivIf((switch("drc?") && switch("extract?")) geomConnect( via( vi2 metal3 metal2 )))  
;  
ngata   = geomGetVertex( ngate  keep == 4 ) ; RECTANGULAR NMOS TRANSISTOR          
ngatb   = geomAndNot( ngate ngata )      ; UNRECTANGULAR NMOS STANDARD TRANSISTOR  
;  
ngatz   = geomAnd( geomSize( ngatb .05 ) active )                                  
ngatr   = drc( geomGetEdge( ngatz coincident active ) width < 150 opposite parallel )  
nmosa   = geomOverlap( ngate geomAnd( ngatr ngate ) keep == 1 )  
nmosc   = geomAndNot( ngatb nmosa )                                                
;  
pgata   = geomGetVertex( pgate  keep == 4 ) ; RECTANGULAR PMOS TRANSISTOR          
pgatb   = geomAndNot( pgate pgata )      ; UNRECTANGULAR PMOS STANDARD TRANSISTOR  
;  
pgatz   = geomAnd( geomSize( pgatb .05 ) active )                                  
pgatr   = drc( geomGetEdge( pgatz coincident active ) width < 150 opposite parallel )  
pmosa   = geomOverlap( pgate geomAnd( pgatr pgate ) keep == 1 )  
pmosc   = geomAndNot( pgatb pmosa )            
;  
   else  
;  
nmosc   = geomOr( bulk )  
pmosc   = geomOr( bulk )  
   )                                     ; END OF THE "bendopti" SECTION  
;                                                                           
else                                                                      
;       
nmosc   = geomOr( bulk )                                                          
pmosc   = geomOr( bulk )                                                           
)                                        ; END OF THE "benduse" SECTION            
;  
;------------------------------------------------------------------------------- 
;      MOS  TRANSISTORS  DERIVATIONS                                             
;      FOR  MIXED  3.3V  AND  5.0V  POWER  SUPPLIES  IN  THE  SAME  DESIGN       
;------------------------------------------------------------------------------- 
;                                                                                
 ivIf( switch( "drc?" ) then                                                     
;                                                                                
ngate3  = geomAnd( ninpw poh5nsz )       ; NMOS GATE FOR 3.3V MOS TRANSISTORS    
pgate3  = geomAnd( pinnw poh5nsz )       ; PMOS GATE FOR 3.3V MOS TRANSISTORS    
gate3   = geomOr( ngate3 pgate3 )        ; GATES FOR 3.3V MOS TRANSISTORS        
;                                                                                
pogate5 = geomOr( poh5sz polyh5l )                                               
ngate5  = geomAnd( ninpw pogate5 )       ; NMOS GATE FOR 5.0V MOS TRANSISTORS    
pgate5  = geomAnd( pinnw pogate5 )       ; PMOS GATE FOR 5.0V MOS TRANSISTORS    
gate5   = geomOr( ngate5 pgate5 )        ; GATES FOR 5.0V MOS TRANSISTORS        
;                                                                                
 )                                                                               
;                                                                                
;------------------------------------------------------------------------------- 
;      NPN  BIPOLAR  TRANSISTORS                                                 
;------------------------------------------------------------------------------- 
;                                                                                
npn     = geomAnd( geomAnd( polyemc emcut ) geomAnd( pdifbas nburied ) )         
;                                                                                
;------------------------------------------------------------------------------- 
;      VERTICAL  PNP  TRANSISTOR  with Nepi as Base                              
;------------------------------------------------------------------------------- 
;                                                                                
nphole  = geomHoles( geomOutside( ninnepi nburied ) )                            
;                                                                                
vpnp    = geomEnclose( nphole pinnepi )                                          
;                                                                                
;------------------------------------------------------------------------------- 
;      LATERAL  PNP  TRANSISTOR  with Nepi as Base                               
;------------------------------------------------------------------------------- 
;                                                                                
pphole  = geomHoles( geomInside( pinnepi nburied ) )                             
;                                                                                
lpnp    = geomEnclose( pphole pinnepi )                                          
;                                                                                
lpnpE   = geomInside( pinnepi pphole )                                           
lpnpC   = geomButtOnly( pinnepi pphole )                                         
;                                                                                
;-------------------------------------------------------------------------------  
;	SALICIDE  INTERCONNECT  OVER  DIFFUSIONS   
;-------------------------------------------------------------------------------  
;  
pdifsi  = geomAndNot( geomOr( pdiff0 geomAndNot( pdifbas polyemc ) ) siprotx )   
ndifsi  = geomAndNot( geomOr( ndiff0 geomAndNot( ndifsk polconn ) ) siprotx )    
;  
;start epidio                                                                    
;------------------------------------------------------------------------------- 
;       P+/N-EPI DIODE                                                           
;------------------------------------------------------------------------------- 
;                                                                                
;nodnepi = geomOr( geomButting( pinnepi lpnp ) geomOr( vpnp lpnp ) )             
;dpnepi  = geomAndNot( geomInside( pinnepi mdiode ) nodnepi )                    
;dpnepit = geomAndNot( dpnepi siprotx )                                          
;dpnepic = geomOr( dpnepit )                                                     
;                                                                                
;end epidio                                                                      
;-------------------------------------------------------------------------------  
;	P+ RESISTOR  AND  P+/NWELL DIODE   
;-------------------------------------------------------------------------------  
;  
markact = geomOr( geomOr( mdiode siprotx ) polyemc )                             
;  
nomdiop = geomAndNot( geomOutside( pdifnw markact ) pinnwpo )  
diop    = geomAndNot( nomdiop geomButting( nomdiop nstrap ) )                      
mpdifnw = geomInside( geomOutside( pdifnw polyemc ) mdiode )                     
mdiop   = geomAndNot( mpdifnw geomButting( mpdifnw nstrap ) )                      
mdiopt  = geomAndNot( mdiop siprotx )  
actdiop = geomOr( diop mdiop )  
;  
actresp = geomAndNot( pdifnw actdiop )  
rpldd   = geomButting( geomAnd( actresp polyemc ) pdifsi  keep > 1 )             
;                                                        ; LDD-P RESISTORS       
rpldtop = geomAnd( rpldd polyemc )                                               
;  
sprpdif = geomButting( geomAnd( actresp siprotx ) pdifsi  keep > 1 )  
resp    = geomOutside( sprpdif mres )                    ; P+ RES BODY WITHOUT MARKER  
mresp   = geomAnd( sprpdif mres )                        ; P+ RES BODY WITH MARKER  
mrespt  = geomAndNot( geomEnclose( sprpdif mresp ) mresp ) ; TERM LIMITED TO MARKER  
respp   = geomOr( resp mresp )                           ; ALL P+ RESISTORS BODY    
;  
mrdpt   = geomButting( geomOverlap( pdifsi mdiode ) sprpdif )  
mrdiopt = geomAndNot( mrdpt geomButting( mrdpt nstrap ) )                          
mrdiop  = geomOverlap( actresp mrdiopt ) ; P+ DIODES CONNECTED TO P+ RESISTORS  
;  
mdpter  = geomOr( mdiopt mrdiopt )                       ; MARKED P+ DIODES TERM  
mdiodep = geomOr( mdiop mrdiop )                         ; MARKED P+ DIODES  
dpter   = geomOr( diop mdpter )                          ; ALL P+ DIODES TERM  
diodep  = geomOr( diop mdiodep )                         ; ALL P+ DIODES         
;  
;-------------------------------------------------------------------------------  
;	N+ RESISTOR  AND  N+/PWELL DIODE   
;-------------------------------------------------------------------------------  
;  
ndifpwo = geomAndNot( ndifpw nacross )  
nomdion = geomAndNot( geomOutside( ndifpwo markact ) ninpwpo )  
dion    = geomAndNot( nomdion geomButting( nomdion pstrap ) )                      
mndifpw = geomInside( ndifpw mdiode )  
mdion   = geomAndNot( mndifpw geomButting( mndifpw pstrap ) )                      
mdiont  = geomAndNot( mdion siprotx )  
actdion = geomOr( dion mdion )  
;  
actresn = geomAndNot( ndifpw actdion )  
sprndif = geomButting( geomAnd( actresn siprotx ) ndifsi  keep > 1 )  
resn    = geomOutside( sprndif mres )                    ; N+ RES BODY WITHOUT MARKER  
mresn   = geomAnd( sprndif mres )                        ; N+ RES BODY WITH MARKER  
mresnt  = geomAndNot( geomEnclose( sprndif mresn ) mresn ) ; TERM LIMITED TO MARKER  
resnp   = geomOr( resn mresn )                           ; ALL N+ RESISTORS BODY  
resnpm  = geomAnd( resnp mrnw )                          ; for use of standard value  
resnp   = geomAndNot( resnp resnpm )  
;  
mrdnt   = geomButting( geomOverlap( ndifsi mdiode ) sprndif )  
mrdiont = geomAndNot( mrdnt geomButting( mrdnt pstrap ) )                          
mrdion  = geomOverlap( actresn mrdiont ) ; N+ DIODES CONNECTED TO N+ RESISTORS  
;  
mdnter  = geomOr( mdiont mrdiont )                       ; MARKED N+ DIODES TERM  
mdioden = geomOr( mdion mrdion )                         ; MARKED N+ DIODES  
dnter   = geomOr( dion mdnter )                          ; ALL N+ DIODES TERM  
dioden  = geomOr( dion mdioden )                         ; ALL N+ DIODES  
;  
;-------------------------------------------------------------------------------  
;       NWELL RESISTOR  
;-------------------------------------------------------------------------------  
;  
 ivIf( switch( "drc?" ) then  
rnwdrc  = geomOr( rnwell )                                                       
rnwellt = geomAndNot( rnwdrc mres )  
resnwt  = geomInside( nstrap rnwdrc )                                              
resnw   = geomButting( geomButting( geomAnd( rnwdrc mres ) rnwellt keep == 2 ) resnwt keep == 2 )  
 )  
;  
 ivIf( switch( "extract?" ) then  
rnwellt = geomAndNot( rnwell mres )  
resnwt  = geomInside( nstrap rnwell )                                              
resnw   = geomButting( geomButting( geomAnd( rnwell mres ) rnwellt keep == 2 ) resnwt keep == 2 )  
resnwm  = geomAnd( resnw mrnw )  
resnw   = geomAndNot( resnw resnwm )  
nwells  = geomAndNot( nwells resnw )  
nwells  =  geomAndNot( nwells resnwm )  
pwells  = geomAndNot( sub geomOr( nwells nepi ) )                                
 )        
;  
;-------------------------------------------------------------------------------  
;	CONTACT  DERIVATIONS  
;-------------------------------------------------------------------------------  
;  
actct   = geomAnd( contact geomOr( pdifsi ndifsi ) )     ;CONTACT ON ACTIVE    
polyct  = geomAndNot( geomAnd( contact geomAndNot( poly poly2 ) ) siprot )       
;                                                        ;CONTACT ON POLY        
poly2ct = geomAndNot( geomAnd( contact poly2 ) siprot )  ;CONTACT ON POLY2       
polemct = geomAndNot( geomAnd( contact polyem ) siprot ) ;CONTACT ON POLYEM      
dpct    = geomOr( dpter )  
dnct    = geomOr( dnter )  
;  
;-------------------------------------------------------------------------------  
;	INTERCONNECT  EXTENSIONS   
;-------------------------------------------------------------------------------  
;  
subst   = geomOr( sub )                  ; SUBSTRATE TERMINAL                    
;   
 ivIf( switch( "extract?" ) then  
rnwtsi  = geomAnd( resnwt siprotx )  
ndpwsi  = geomButting( geomAnd( ndifpw siprotx ) rnwtsi )  
ndifsi  = geomOr( ndifsi geomOr( rnwtsi ndpwsi ) )  
;                                        ; SALICIDED ACT EXTENDED TO UNSALICIDED N+ TERM OF NWELL RESISTOR   
 )  
;   
ndifsi  = geomOr( ndifsi mresnt )        ; SALICIDED ACT EXTENDED TO UNSALICIDED NRES TERM  
pdifsi  = geomOr( pdifsi mrespt )        ; SALICIDED ACT EXTENDED TO UNSALICIDED PRES TERM  
ndifct  = geomOr( ndifsi )               ; SALICIDE CONNECTION TO NDIF  
pdifct  = geomOr( pdifsi )               ; SALICIDE CONNECTION TO PDIF  
sali    = geomOr( pdifsi ndifsi )        ; SALICIDE INTERCONNECT ON DIFFUSION  
;  
 ivIf( switch( "drc?" ) then             ; BEGINNING OF LAYERS DERIVATION USED ONLY IN DRC SECTION           
;  
;-------------------------------------------------------------------------------  
;       BONDING  PADS  DERIVATION  
;-------------------------------------------------------------------------------  
;  
 ivIf( switch( "nopad" ) then  
;  
nitsz02 = geomSize( nitride 2.0 )                                                
;                                                                                
ivIf( switch( "pad100" ) && !switch( "pad125" ) then  
nitrsz  = geomSize( nitride 20.0 )  
else  
nitrsz  = geomSize( nitride 30.0 )  
)  
;  
m1pdsz  = geomAnd( nitrsz metal1 )  
m2pdsz  = geomAnd( nitrsz metal2 )  
m3pdsz  = geomAnd( nitrsz metal3 )  
;  
m1pd    = geomOverlap( m1pdsz nitride )  
m2pd    = geomOverlap( m2pdsz nitride )  
m3pd    = geomOverlap( m3pdsz nitride )  
;  
m1npd   = geomAndNot( metal1 m1pd )  
v1npd   = geomOutside( via nitride )  
m2npd   = geomAndNot( metal2 m2pd )  
v2npd   = geomOutside( vi2 nitsz02 )                                             
m3npd   = geomAndNot( metal3 m3pd )  
;  
 else  
;  
nitsz02 = geomSize( nitride 2.0 )                                                
;                                                                                
ivIf( switch( "pad100" ) && !switch( "pad125" ) then  
nitrsz  = geomSize( nitride 20.0 )  
else  
nitrsz  = geomSize( nitride 30.0 )  
)  
;  
nwpdsz  = geomAnd( nitrsz nwell )  
rnwpdsz  = geomAnd( nitrsz rnwell )                                                
m1pdsz  = geomAnd( nitrsz metal1 )  
v1pdsz  = geomAnd( nitrsz via )  
m2pdsz  = geomAnd( nitrsz metal2 )  
v2pdsz  = geomAnd( nitrsz vi2 )  
m3pdsz  = geomAnd( nitrsz metal3 )  
;  
nwpd    = geomOverlap( nwpdsz nitride )  
rnwpd    = geomOverlap( rnwpdsz nitride )                                          
m1pd    = geomOverlap( m1pdsz nitride )  
v1pd    = geomAnd( v1pdsz nitride )  
m2pd    = geomOverlap( m2pdsz nitride )  
v2pd    = geomAnd( v2pdsz nitsz02 )                                              
m3pd    = geomOverlap( m3pdsz nitride )  
;  
m1npd   = geomAndNot( metal1 m1pd )  
v1npd   = geomAndNot( via v1pd )  
m2npd   = geomAndNot( metal2 m2pd )  
v2npd   = geomAndNot( vi2 v2pd )  
m3npd   = geomAndNot( metal3 m3pd )  
;  
actpdsz = geomAnd( nitrsz active )  
po1pdsz = geomAnd( nitrsz poly )  
po3pdsz = geomAnd( nitrsz polyem )                                               
conpdsz = geomAnd( nitrsz contact )  
plypdsz = geomAnd( nitrsz polyi )  
;  
actpd   = geomAnd( nitride actpdsz )  
po1pd   = geomAnd( nitride po1pdsz )  
po3pd   = geomAnd( nitride po3pdsz )                                             
conpd   = geomAnd( nitride conpdsz )  
plypd   = geomAnd( nitride plypdsz )  
;  
 )  
;  
;-------------------------------------------------------------------------------  
;       SPLIT OF METALLISATION INTO "PIN" & "DRAWING" PURPOSE  
;-------------------------------------------------------------------------------  
;  
dpoly   = geomGetPurpose( "poly" "drawing" 0 20 )  
ppoly   = geomGetPurpose( "poly" "pin" 0 20 )  
dpoly5l = geomGetPurpose( "poly5l" "drawing" 0 20 )                              
ppoly5l = geomGetPurpose( "poly5l" "pin" 0 20 )                                  
dpoly   = geomOr( dpoly dpoly5l )                                                
ppoly   = geomOr( ppoly ppoly5l )                                                
;  
dpolyem = geomGetPurpose( "polyem" "drawing" 0 20 )                              
ppolyem = geomGetPurpose( "polyem" "pin" 0 20 )                                  
;                                                                                
dmetal1 = geomGetPurpose( "m1int" "drawing" 0 20 )  
dmetal1 = geomOr( dmetal1 geomGetPurpose( "m1vdd" "drawing" 0 20 ))  
dmetal1 = geomOr( dmetal1 geomGetPurpose( "m1gnd" "drawing" 0 20 ))  
pmetal1 = geomGetPurpose( "m1int" "pin" 0 20 )  
pmetal1 = geomOr( pmetal1 geomGetPurpose( "m1vdd" "pin" 0 20 ))  
pmetal1 = geomOr( pmetal1 geomGetPurpose( "m1gnd" "pin" 0 20 ))  
;  
dmetal2 = geomGetPurpose( "m2int" "drawing" 0 20 )  
dmetal2 = geomOr( dmetal2 geomGetPurpose( "m2vdd" "drawing" 0 20 ))  
dmetal2 = geomOr( dmetal2 geomGetPurpose( "m2gnd" "drawing" 0 20 ))  
pmetal2 = geomGetPurpose( "m2int" "pin" 0 20 )  
pmetal2 = geomOr( pmetal2 geomGetPurpose( "m2vdd" "pin" 0 20 ))  
pmetal2 = geomOr( pmetal2 geomGetPurpose( "m2gnd" "pin" 0 20 ))  
;  
dmetal3 = geomGetPurpose( "m3int" "drawing" 0 20 )  
dmetal3 = geomOr( dmetal3 geomGetPurpose( "m3vdd" "drawing" 0 20 ))  
dmetal3 = geomOr( dmetal3 geomGetPurpose( "m3gnd" "drawing" 0 20 ))  
pmetal3 = geomGetPurpose( "m3int" "pin" 0 20 )  
pmetal3 = geomOr( pmetal3 geomGetPurpose( "m3vdd" "pin" 0 20 ))  
pmetal3 = geomOr( pmetal3 geomGetPurpose( "m3gnd" "pin" 0 20 ))  
;  
 ivIf( switch("level1") then  
;  
    dmetal1 = geomOr( dmetal1 geomGetPurpose( "metal1" "drawing" 0 20 ))  
    pmetal1 = geomOr( pmetal1 geomGetPurpose( "metal1" "pin" 0 20 ))  
    dmetal2 = geomOr( dmetal2 geomGetPurpose( "metal2" "drawing" 0 20 ))  
    pmetal2 = geomOr( pmetal2 geomGetPurpose( "metal2" "pin" 0 20 ))  
    dmetal3 = geomOr( dmetal3 geomGetPurpose( "metal3" "drawing" 0 20 ))  
    pmetal3 = geomOr( pmetal3 geomGetPurpose( "metal3" "pin" 0 20 ))  
 )  
;  
)                                        ; END OF LAYERS DERIVATION USED ONLY IN DRC SECTION  
;  
;------------------------------------------------------------------------------- 
;       POLY  SHORTS                                                             
;------------------------------------------------------------------------------- 
;                                                                                
shpo1   = geomAnd( polconn mrpo )                                                
noshpo1 = geomOr( geomOr( gate polyct ) geomOr( siprpo1 geomOr( cpo1po2 sandw )))
shpo1   = geomAndNot( shpo1 geomButtOrOver( shpo1 geomOr( noshpo1 cpo1nsk ) ) )  
polconn = geomAndNot( polconn shpo1 )                                            
;                                                                                
;------------------------------------------------------------------------------- 
;       METAL  1 - 2 - 3  SHORTS                                                 
;------------------------------------------------------------------------------- 
;                                                                                
shm1    = geomAnd( metal1 mrm1 )                                                 
noshm1  = geomOr( geomOr( actct polyct ) via )                                   
shm1    = geomAndNot( shm1 geomButtOrOver( shm1 noshm1 ) )                       
metal1  = geomAndNot( metal1 shm1 )                                              
;                                                                                
shm2    = geomAnd( metal2 mrm2 )                                                 
noshm2  = geomOr( via vi2 )                                                      
shm2    = geomAndNot( shm2 geomButtOrOver( shm2 noshm2 ) )                       
metal2  = geomAndNot( metal2 shm2 )                                              
;                                                                                
shm3    = geomAnd( metal3 mrm3 )                                                 
shm3    = geomAndNot( shm3 geomButtOrOver( shm3 vi2 ) )                          
metal3  = geomAndNot( metal3 shm3 )                                              
;                                                                                
;-------------------------------------------------------------------------------  
;       CONNECTIVITY  LABELLING  
;-------------------------------------------------------------------------------  
;  
 ivIf( switch("samenet") then  
;  
changeLabel(  
( "gnd1!"  "gnd!" ) ( "gnd2!"  "gnd!" ) ( "vdd1!"  "vdd!" ) ( "vdd2!"  "vdd!" )  
( "VSS:"   "gnd!" ) ( "VDD:"   "vdd!" ) ( "GND:"   "gnd!" )  
( "VEE:"   "gnd!" ) ( "vee:"   "gnd!" ) ( "VEE;"   "gnd!" ) ( "vee;"   "gnd!" )  
( "VSS;"   "gnd!" ) ( "VDD;"   "vdd!" ) ( "GND;"   "gnd!" )  
( "VDD!"   "vdd!" ) ( "VDDE!"  "vdd!" ) ( "VDDI!"  "vdd!" ) ( "VDD1!"  "vdd!" )  
( "VDD2!"  "vdd!" ) ( "VDD3!"  "vdd!" ) ( "VDD4!"  "vdd!" ) ( "VDD5!"  "vdd!" )  
( "VDD6!"  "vdd!" ) ( "VDD7!"  "vdd!" ) ( "VDD8!"  "vdd!" ) ( "VDD9!"  "vdd!" )  
( "VDD10!" "vdd!" ) ( "VDD11!" "vdd!" ) ( "VDD12!" "vdd!" ) ( "VDD13!" "vdd!" )  
( "VSS!"   "gnd!" ) ( "VSSE!"  "gnd!" ) ( "VSSI!"  "gnd!" ) ( "VSS1!"  "gnd!" )  
( "VSS2!"  "gnd!" ) ( "VSS3!"  "gnd!" ) ( "VSS4!"  "gnd!" ) ( "VSS5!"  "gnd!" )  
( "VSS6!"  "gnd!" ) ( "VSS7!"  "gnd!" ) ( "VSS8!"  "gnd!" ) ( "VSS9!"  "gnd!" )  
( "VSS10!" "gnd!" ) ( "VSS11!" "gnd!" ) ( "VSS12!" "gnd!" ) ( "VSS13!" "gnd!" )  
           )  
joinableNet( "vdd!" "gnd!" )  
 )  
;  
;*******************************************************************************  
;**********                                                           **********  
;**********			DRC  SECTION                          **********  
;**********                                                           **********  
;*******************************************************************************  
;  
;  
 ivIf( switch( "drc?" ) then                             ; BEGINNING OF THE DRC SECTION  
;  
;-------------------------------------------------------------------------------  
;	CONNECTIVITY  DEFINITION  
;-------------------------------------------------------------------------------  
;  
  ivIf( switch( "usenotext" ) && !switch( "nodetext" ) then  
;  
               geomConnect(  
                via( vi2       metal3   metal2  )  
                via( via       metal2   metal1  )  
                via( polyct    metal1   polconn )  
                via( polemct   metal1   polyemc )                                
                via( actct     metal1   sali    )  
                via( ndifct    sali     ndifsi  )  
                via( pdifct    sali     pdifsi  )  
                via( nstrap    sali     nstrapL )                                  
                via( pstrap    sali     pstrapL )                                  
                via( pstrap    sali     pstrapN )                                
                          )  
  )  
;  
  ivIf( switch( "nodetext" ) && !switch( "usenotext" ) then  
;  
               geomConnect(  
                via( vi2       metal3   metal2  )  
                via( via       metal2   metal1  )  
                via( polyct    metal1   polconn )  
                via( polemct   metal1   polyemc )                                
                via( actct     metal1   sali    )  
                via( ndifct    sali     ndifsi  )  
                via( pdifct    sali     pdifsi  )  
                via( nstrap    sali     nstrapL )                                  
                via( pstrap    sali     pstrapL )                                  
                via( pstrap    sali     pstrapN )                                
                label( "pintext"  metal3 metal2 metal1 )                         
                label( "nodetext" sali   metal3 metal2 metal1 )                  
                          )  
  )  
;  
  ivIf( !switch( "usenotext" ) && !switch( "nodetext" ) then   
;  
               geomConnect(  
                via( vi2       metal3   metal2  )  
                via( via       metal2   metal1  )  
                via( polyct    metal1   polconn )  
                via( polemct   metal1   polyemc )                                
                via( actct     metal1   sali    )  
                via( ndifct    sali     ndifsi  )  
                via( pdifct    sali     pdifsi  )  
                via( nstrap    sali     nstrapL )                                  
                via( pstrap    sali     pstrapL )                                  
                via( pstrap    sali     pstrapN )                                
                label( "polytext"  polconn )  
                label( "m1text"    metal1  )  
                label( "m2text"    metal2  )  
                label( "m3text"    metal3  )  
                label( "pintext"   metal3 metal2 metal1 )                        
                label( "m1pintext" metal1  )  
                label( "m2pintext" metal2  )  
                label( "m3pintext" metal3  )  
                           )  
  )  
;  
  ivIf( switch( "erc" ) then   
;  
ivIf((switch("drc?") && switch("extract?")) geomConnect( via( vi2 metal3 metal2 )))  
;  
      nwellc  = geomStamp( nwellc   nstrapL error )                                
      pwell   = geomStamp( pwell    pstrapL error )                                
      subst   = geomStamp( subst    pstrapN error )                              
      pdifbas = geomStamp( pdifbas  pdifsi  error )                              
      nburied = geomStamp( nburied  ndifsi  error )                              
      nepi    = geomStamp( nepi     ndifsi  error )                              
;  
  else  
;  
ivIf((switch("drc?") && switch("extract?")) geomConnect( via( vi2 metal3 metal2 )))  
;  
      nwellc  = geomStamp( nwellc   nstrapL )                                      
      rpldtop = geomStamp( rpldtop  polyemc )                                    
;  
  )  
;  
;-------------------------------------------------------------------------------  
;	UNCORRECT  GEOMETRIES   
;-------------------------------------------------------------------------------  
;  
offGrid( nepi       0.05      "off-grid nepi     " )                             
offGrid( nburied    0.05      "off-grid nburied  " )                             
offGrid( niso       0.05      "off-grid niso     " )                             
offGrid( active     0.05      "off-grid active   " )  
offGrid( nwell      0.05      "off-grid nwell    " )  
offGrid( rnwell     0.05      "off-grid rnwell   " )                               
offGrid( sinker     0.05      "off-grid sinker   " )                             
offGrid( "poly"     0.05      "off-grid poly     " )                                
offGrid( "poly5l"   0.05      "off-grid poly     " )                             
offGrid( cap        0.05      "off-grid cap      " )                             
offGrid( presist    0.05      "off-grid presist  " )                             
offGrid( poly2      0.05      "off-grid poly2    " )                             
offGrid( nldprot    0.05      "off-grid nlddprot " )  
offGrid( pminus     0.05      "off-grid pminus   " )                             
offGrid( emcut      0.05      "off-grid emcut    " )                             
offGrid( polyem     0.05      "off-grid polyem   " )                             
offGrid( pplus      0.05      "off-grid pplus    " )  
offGrid( siprot     0.05      "off-grid siprot   " )  
offGrid( contact    0.05      "off-grid contact  " )  
offGrid( met1drc    0.05      "off-grid metal1   " )  
offGrid( via        0.05      "off-grid via      " )  
offGrid( met2drc    0.05      "off-grid metal2   " )  
offGrid( vi2        0.05      "off-grid vi2      " )  
offGrid( met3drc    0.05      "off-grid metal3   " )  
offGrid( nitride    0.05      "off-grid nitride  " )  
offGrid( polyi      0.05      "off-grid polyimide" )  
;  
saveDerived( geomGetNon45( nepi    ) "nepi      non 45 degree angle" )           
saveDerived( geomGetNon45( nburied ) "nburied   non 45 degree angle" )           
saveDerived( geomGetNon45( niso    ) "niso      non 45 degree angle" )           
saveDerived( geomGetNon45( active  ) "active    non 45 degree angle" )  
saveDerived( geomGetNon45( nwell   ) "nwell     non 45 degree angle" )  
saveDerived( geomGetNon45( rnwell  ) "rnwell    non 45 degree angle" )             
saveDerived( geomGetNon45( sinker  ) "sinker    non 45 degree angle" )           
saveDerived( geomGetNon45( poly    ) "poly      non 45 degree angle" )  
saveDerived( geomGetNon45( cap     ) "cap       non 45 degree angle" )           
saveDerived( geomGetNon45( presist ) "presist   non 45 degree angle" )           
saveDerived( geomGetNon45( poly2   ) "poly2     non 45 degree angle" )           
saveDerived( geomGetNon45( nldprot ) "nlddprot  non 45 degree angle" )  
saveDerived( geomGetNon45( pminus  ) "pminus    non 45 degree angle" )           
saveDerived( geomGetNon45( emcut   ) "emcut     non 45 degree angle" )           
saveDerived( geomGetNon45( polyem  ) "polyem    non 45 degree angle" )           
saveDerived( geomGetNon45( pplus   ) "pplus     non 45 degree angle" )  
saveDerived( geomGetNon45( siprot  ) "siprot    non 45 degree angle" )  
saveDerived( geomGetNon45( contact ) "contact   non 45 degree angle" )  
saveDerived( geomGetNon45( met1drc ) "metal1    non 45 degree angle" )  
saveDerived( geomGetNon45( via     ) "via       non 45 degree angle" )  
saveDerived( geomGetNon45( met2drc ) "metal2    non 45 degree angle" )  
saveDerived( geomGetNon45( vi2     ) "via2      non 45 degree angle" )  
saveDerived( geomGetNon45( met3drc ) "metal3    non 45 degree angle" )  
saveDerived( geomGetNon45( nitride ) "nitride   non 45 degree angle" )  
saveDerived( geomGetNon45( polyi   ) "polyimide non 45 degree angle" )  
;  
;------------------------------------------------------------------------------- 
;       NEPI  CHECKS  LEVEL 7                                                    
;------------------------------------------------------------------------------- 
;                                                                                
drc( nepi             width < 2.4  "Rule 7.1  nepi width                  >2.4") 
drc( nepi             sep   < 3.0  "Rule 7.2  nepi space                  >3.0") 
drc( nepi             notch < 3.0  "Rule 7.2  nepi notch                  >3.0") 
drc( nepi    ndifsk   enc   < 1.7  "Rule 7.3  nepi enclos of N+ sink act  >1.7") 
drc( nepi    pdifbas  enc   < 1.7  "Rule 7.4  nepi enclos of P-base act   >1.7") 
drc( nepi    pinnepi  enc   < 1.7  "Rule 7.5  nepi enclos of P+ act       >1.7") 
drc( nepi    ninnepi  enc   < 0.7  "Rule 7.6  nepi enclos of N+ act       >0.7") 
drc( nepi    pstrap   sep   < 0.7  "Rule 7.7  nepi dist to Pwell strap    >0.7") 
;                                                                                
;------------------------------------------------------------------------------- 
;       NBURIED  CHECKS  LEVEL 28                                                
;------------------------------------------------------------------------------- 
;                                                                                
nbtran  = geomOverlap( nburied geomOr( pdifbas pinnepi ) )                       
nbcapa  = geomOverlap( geomAndNot( nburied nbtran ) geomOr( cpo1nsk csand ) keep == 1 ) 
nskcapa = geomOverlap( ndifsk nbcapa )                                           
;                                                                                
drc( nburied          width < 1.4  "Rule 28.1  nburied width              >1.4") 
drc( nburied          sep   < 6.4  "Rule 28.2  nburied space              >6.4") 
drc( nburied          notch < 6.4  "Rule 28.2  nburied notch              >6.4") 
drc( nepi    nburied  enc   < 1.7  "Rule 28.3  nburied enclos by Nepi     >1.7") 
saveDerived( geomStraddle( ndifsk nburied )                                      
                            "Rule 28.4  nburied enclos of N+ sink active  =0.0") 
saveDerived( geomXor( nskcapa nbcapa )                                           
                            "Rule 28.4  nburied enclos of N+ sink active  =0.0") 
saveDerived( geomStraddle( pdifbas nburied )                                     
                            "Rule 28.5  nburied enclos of P-base active   =0.0") 
saveDerived( geomStraddle( geomGetHoled( pinnepi) nburied )                      
                            "Rule 28.6  nburied enclosure of P+ active    =0.0") 
;                                                                                
saveDerived( geomOutside( nburied nepi )                                         
                            "Rule 28.imp1  nepi required under nburied        ") 
saveDerived( geomStraddle( nburied nepi )                                        
                            "Rule 28.imp2  nburied must be inside nepi        ") 
saveDerived( geomOutside( ndifsk nburied )                                       
                            "Rule 28.imp3  nburied under N+ sink act required ") 
saveDerived( geomOutside( pdifbas nburied )                                      
                            "Rule 28.imp4  nburied under P-base act required  ") 
;                                                                                
;------------------------------------------------------------------------------- 
;       NISO  CHECKS  LEVEL 24                                                   
;------------------------------------------------------------------------------- 
;                                                                                
nwhole  = geomHoles( nwell )                                                     
;                                                                                
drc( niso             width < 1.2  "Rule 20.1  niso width                 >1.2") 
drc( niso             sep   < 2.0  "Rule 20.2  niso space                 >2.0") 
drc( niso             notch < 2.0  "Rule 20.2  niso notch                 >2.0") 
saveDerived( geomXor( geomOverlap( niso nwhole ) geomOverlap( nwhole niso ) )    
                            "Rule 20.3  niso inters with nwell guard-ring =0.0") 
;                                                                                
saveDerived( geomOutside( niso nwhole )                                          
                            "Rule 20.imp1  nwell guard-ring required          ") 
saveDerived( geomAnd( niso rnwell )                                              
                            "Rule 20.imp3  niso under rnwell not allowed      ") 
saveDerived( geomAnd( niso nepi )                                                
                            "Rule 20.imp4  niso under nepi not allowed        ") 
;                                                                                
;-------------------------------------------------------------------------------    
;	ACTIVE  CHECKS  LEVEL 2  
;-------------------------------------------------------------------------------   
;  
stdgate = geomAndNot( gate msram )                                               
sramgat = geomAnd( gate msram )                                                  
;  
drc( geomGetEdge( stdgate inside poly ) width < 0.8                              
                                   "Rule 2.1  standard MOS trans width    >0.8") 
drc( ndiff0           width < 0.6  "Rule 2.2  N+ active width             >0.6")  
drc( pdiff0           width < 0.6  "Rule 2.3  P+ active width             >0.6")  
drc( geomGetEdge( sramgat inside poly ) width < 0.6                              
                                   "Rule 2.4  MOS trans width in SRAM     >0.6") 
drc( active           sep   < 1.0  "Rule 2.5  active space                >1.0")   
drc( active           notch < 1.0  "Rule 2.5  active notch                >1.0")   
drc( nstrap  pstrap   sep   < 1.0  "Rule 2.6  Nw strap dist to Pw strap   >1.0")  
drc( geomSize( active 0.2 ) sep < 0.6                                              
                            "Rule 2.7  active space after +0.2um sizing   >0.6")   
drc( ndifsk           width < 0.6  "Rule 2.11 N+ sinker active width      >0.6") 
drc( pdifbas          width < 0.6  "Rule 2.12 P-base active width         >0.6") 
drc( pdifbas          sep   < 2.0  "Rule 2.13 P-base active space         >2.0") 
drc( pdifbas          notch < 2.0  "Rule 2.13 P-base active notch         >2.0") 
drc( ndifsk  pdifbas  sep   < 1.4                                                
                            "Rule 2.14 N+ sink act dist to P-base act     >1.4") 
drc( pinnepi          sep   < 1.5  "Rule 2.15 P+ act space for lat PNP    >1.5") 
drc( pinnepi          notch < 1.5  "Rule 2.15 P+ act notch for lat PNP    >1.5") 
drc( ndifsk  pinnepi  sep   < 1.4  "Rule 2.16 N+ sink act dist to P+ act  >1.4") 
drc( nepi    ninpw    sep   < 1.8  "Rule 2.17 N+ act dist to nepi         >1.8") 
;  
;-------------------------------------------------------------------------------    
;	NWELL  CHECKS  LEVEL 1  
;-------------------------------------------------------------------------------    
;  
ninpwon = geomAndNot( ninpw nacross )  
nwellsz = geomStamp( geomSize( nwell 0.2 ) nstrapL )  
;  
drc( nwell            width < 2.4  "Rule 1.1  nwell width                 >2.4")  
drc( nwell            sep   < 2.0  "Rule 1.2  nwell space same net        >2.0")  
drc( nwell            notch < 2.0  "Rule 1.2  nwell notch                 >2.0")  
drc( nwellc           sep   < 3.0 diffNet   
                                   "Rule 1.3  nwell space diff net        >3.0")  
drc( nwellf           sep   < 3.0  "Rule 1.3  nwell space diff net        >3.0")  
drc( nwellf  nwellc   sep   < 3.0  "Rule 1.3  nwell space diff net        >3.0")  
drc( nwell   pinnw    enc   < 1.7  "Rule 1.4  nwell enclos of P+ active   >1.7") 
drc( nwell   nacross  ovlp  < 1.1  "Rule 1.5.c nwell inters with Nw strap >1.1")   
drc( nwell   ninpwon  sep   < 1.8  "Rule 1.6  nwell dist to N+ active     >1.8") 
drc( nwell   pstrap   sep   < 0.7  "Rule 1.7  nwell dist to Pwell strap   >0.7")  
;                                   Rule 1.8  checked by rules 1.4 & 1.6  
drc( nwellsz          sep   < 1.6           
                      "Rule 1.9  nwell space same net after +0.2um sizing >1.6")  
drc( nwellsz          sep   < 2.6 diffNet    
                      "Rule 1.10 nwell space diff net after +0.2um sizing >2.6")    
drc( nwell   nepi     sep   < 3.0  "Rule 1.14 nwell distance to nepi      >3.0") 
;                                                                                
saveDerived( geomAnd( nwell nepi ) "Rule 1.imp1  nwell over nepi not allowed  ") 
;  
;-------------------------------------------------------------------------------   
;      RNWELL  CHECKS  LEVEL 6                                                     
;-------------------------------------------------------------------------------   
;                                                                                  
rnwelsz = geomSize( rnwell 0.2 )                                                   
;                                                                                  
drc( rnwell           width < 2.4  "Rule 6.1   rnwell width               >2.4")   
drc( geomGetEdge( resnw coincident rnwell )   width < 5.0                        
                                   "Rule 6.1.b nwell resistor width       >5.0") 
drc( rnwell           sep   < 3.0  "Rule 6.2  rnwell space                >3.0")   
drc( rnwell           notch < 3.0  "Rule 6.2  rnwell notch                >3.0")   
drc( rnwell  nwell    sep   < 3.0  "Rule 6.3  rnwell dist to nwell        >3.0")   
drc( rnwell  nepi     sep   < 3.0  "Rule 6.4  rnwell dist to nepi         >3.0") 
drc( rnwell  nacross  ovlp  < 1.1  "Rule 6.5.c rnwell inters with N+ act  >1.1")  
drc( rnwell  ninpwon  sep   < 1.8  "Rule 6.6  rnwell dist to N+ active    >1.8")   
drc( rnwell  pstrap   sep   < 0.7  "Rule 6.7  rnwell dist to Pwell strap  >0.7")   
drc( rnwelsz          sep   < 2.6  "Rule 6.8  rnwell space after 0.2u siz >2.6")   
drc( rnwelsz nwellsz  sep   < 2.6                                                  
             "Rule 6.9  rnwell distance to nwell after +0.2um sizing      >2.6")   
saveDerived( geomAnd( rnwell pactive )                                             
                            "Rule 6.10  P+ active in rnwell not allowed       ")   
saveDerived( geomAnd( rnwell poly )                                                
                            "Rule 6.11  poly in rnwell not allowed            ")   
saveDerived( geomAnd( rnwell polyem )                                            
                            "Rule 6.12  polyem in rnwell not allowed          ") 
;                                                                                  
saveDerived( geomAnd( rnwell nwell )                                               
                            "Rule 6.imp1  rnwell over nwell not allowed       ")   
saveDerived( geomAnd( rnwell nepi )                                              
                            "Rule 6.imp2  rnwell over nepi not allowed        ") 
saveDerived( geomOutside( geomOverlap( rnwell nitride ) active )                   
             "Rule 6.imp3  floating rnwell is not allowed under pads          ")   
;                                                                                  
;------------------------------------------------------------------------------- 
;      SINKER  CHECKS  LEVEL 4                                                   
;------------------------------------------------------------------------------- 
;                                                                                
drc( sinker           width < 1.6  "Rule 4.1  sinker width                >1.6") 
drc( sinker           sep   < 1.6  "Rule 4.2  sinker space                >1.6") 
drc( sinker           notch < 1.6  "Rule 4.2  sinker notch                >1.6") 
drc( sinker  ndifsk   enc   < 0.5  "Rule 4.3  sinker enclos of N+sink act >0.5") 
drc( sinker  active   sep   < 0.9  "Rule 4.4  sinker distance to active   >0.9") 
saveDerived( geomOutside( nactsk nepi )                                          
                                   "Rule 4.5  N+ sink act only allowed in nepi") 
;                                                                                
saveDerived( geomAnd( sinker pactive )                                           
                            "Rule 4.imp1  sinker on P+ active not allowed     ") 
saveDerived( geomAnd( sinker pmactiv )                                           
                            "Rule 4.imp2  sinker on P-base active not allowed ") 
;                                                                                
;-------------------------------------------------------------------------------    
;	POLY  CHECKS  LEVEL 13  
;-------------------------------------------------------------------------------    
;  
drc( poly             width < 0.5  "Rule 13.1  poly interconnect width    >0.5")  
drc( geomGetEdge( gate3 coincident poh5nsz ) width < 0.5                         
                            "Rule 13.1.b poly width for 3.3V MOS trans    >0.5") 
drc( geomGetEdge( gate5 coincident pogate5 ) width < 0.6                         
                            "Rule 13.1.c poly width for 5.0V MOS trans    >0.6") 
drc( polynsz          sep   < 0.7  "Rule 13.2  poly space                 >0.7") 
drc( polynsz          notch < 0.7  "Rule 13.2  poly notch                 >0.7") 
drc( poh5m5v          sep   < 0.8                                                
                      "Rule 13.2  poly space before 0.05 um sizing        >0.8") 
drc( poh5m5v          notch < 0.8                                                
                      "Rule 13.2  poly notch before 0.05 um sizing        >0.8") 
drc( poh5m5v polynsz  sep   < 0.8                                                
                      "Rule 13.2  poly space before 0.05 um sizing        >0.8") 
drc( poly    active   enc   < 0.6  "Rule 13.3  poly ext on active (endcap)>0.6")  
drc( polynsz active   sep   < 0.35 "Rule 13.4  poly distance to active   >0.35") 
drc( poh5m5v active   sep   < 0.4                                                
             "Rule 13.4  poly distance to active before 0.05 um sizing    >0.4") 
drc( actinw  geomGetEdge( gate coincident poly ) enc < 0.9                       
                                   "Rule 13.5  poly-act min S & D width   >.9 ") 
;  
; The following lines check the minimum source and drain width of connected  
; N+ active or P+ active shared by two MOS transistors.  
;  
;minSD   = drc( geomGetEdge( gate coincident poly ) sep < 0.9  )                 
;shareSD = geomOverlap( geomAndNot( active poly ) minSD )  
;saveDerived( geomInside( minSD geomOverlap( shareSD contact ) )  
;      "Rule 13.5  poly-act min S & D width when contact between 2 gates  >.9 ") 
;  
drc( ndifsk  poly     enc   < 1.0  "Rule 13.7  poly enclos by N+ sink act >1.0") 
;                                                                                
actovpo = geomGetPolygon( geomOverlap( active poly ) )  
edactsz = geomSize( geomGetEdge( actovpo inside poly ) 0.1 )  
edactov = geomAnd( edactsz )  
saveDerived( geomOr( geomOverlap( edactsz edactov ) )  
                      "Rule 13.9  poly over inward active corner not allowed  ")  
drc( nwell    geomOverlap( poly poly2 )  enc  < 1.0                              
                      "Rule 13.10 poly of POLY2/POLY cap enclos by nwell  >1.0") 
;  
saveDerived( geomAndNot( ppoly dpoly )  
                             "Rule 13.imp1  POLY purpose PIN without DRAWING  ")  
saveDerived( geomButtOrOver( mrpo gate )                                         
             "Rule 13.imp2  mrpo butting or over poly gate not allowed        ") 
saveDerived( geomButtOrOver( mrpo siprpo1 )                                      
             "Rule 13.imp3  mrpo butting or over unsalicided poly not allowed ") 
saveDerived( geomButtOrOver( mrpo cpo1po2 )                                      
             "Rule 13.imp4  mrpo butting or over POLY2/POLY capa not allowed  ") 
saveDerived( geomButtOrOver( mrpo cpo1nsk )                                      
             "Rule 13.imp5  mrpo butting or over POLY/N+SINK capa not allowed ") 
saveDerived( geomButtOrOver( mrpo csand )                                        
             "Rule 13.imp6  mrpo butting or over PO2/POLY/SK capa not allowed ") 
saveDerived( geomAnd( poly pdifbas )                                             
                            "Rule 13.imp7  poly inside P-base act not allowed ") 
saveDerived( geomAnd( poly pinnepi )                                             
                      "Rule 13.imp8  poly over P+ act in nepi not allowed     ") 
saveDerived( geomAnd( poly ninnepi )                                             
                      "Rule 13.imp9  poly over N+ act in nepi not allowed     ") 
saveDerived( geomAndNot( geomStraddle( polyh5 m5vsz ) m5vsz )                    
                      "Rule 13.imp11 poly crossing marker m5vsz not allowed  ")  
saveDerived( geomAnd( m3vns bulk )                                               
            "Rule 13.imp13 M3VNOS marker no more allowed; use of M5VSZ instead") 
;                                                                                
;------------------------------------------------------------------------------- 
;	CAP  CHECKS  LEVEL 12                                                    
;------------------------------------------------------------------------------- 
;                                                                                
drc( cap     active   sep   < 0.4  "Rule 12.1  cap distance to active     >0.4") 
drc( cap              width < 1.0  "Rule 12.2  cap width                  >1.0") 
drc( cap              sep   < 1.0  "Rule 12.3  cap space                  >1.0") 
drc( cap              notch < 1.0  "Rule 12.3  cap notch                  >1.0") 
drc( cap     geomGetEdge( siprpo1 coincident poly ) enc < 1.9                    
             "Rule 12.4  cap extens on poly inter with siprot, on field   >1.9") 
drc( cap     geomGetEdge( siprpo1 inside poly )     enc < 1.5                    
             "Rule 12.5  cap extens on poly inter with siprot, on poly    >1.5") 
drc( cap     poly     sep   < 2.0  "Rule 12.6  cap distance to poly       >2.0") 
drc( cap     pplus    sep   < 0.8  "Rule 12.7  cap distance to pplus      >0.8") 
drc( cap     siprpo1  sep   < 2.0                                                
                      "Rule 12.8  cap dist to poly intersect with siprot  >2.0") 
drc( cap     pminus   sep   < 0.8  "Rule 12.9  cap distance to pminus     >0.8") 
;                                                                                
saveDerived( geomGetEdge( cap inside siprpo1 )                                   
                      "Rule 12.imp1  cap crossing unsalicided poly forbidden  ") 
saveDerived( geomAnd( cap pplus )                                                
                            "Rule 12.imp2  cap over pplus not allowed         ") 
saveDerived( geomAnd( cap pminus )                                               
                            "Rule 12.imp3  cap over pminus not allowed        ") 
;                                                                                
;------------------------------------------------------------------------------- 
;	POLY2  CHECKS  LEVEL 11                                                  
;------------------------------------------------------------------------------- 
;                                                                                
saveDerived( geomOr( geomAndNot( poly2 poly ) geomAndNot( poly2 cap ) )          
                      "Rule 11.0 poly2 only allowed on poly and cap          ")  
drc( poly2            width < 1.2  "Rule 11.1  poly2 width                >1.2") 
drc( poly2            sep   < 1.0  "Rule 11.2  poly2 space                >1.0") 
drc( poly2            notch < 1.0  "Rule 11.2  poly2 notch                >1.0") 
drc( cap     poly2    enc   < 1.0  "Rule 11.3  poly2 enclosure by cap     >1.0") 
drc( poly    poly2    enc   < 1.0  "Rule 11.4  poly2 enclosure by poly    >1.0") 
drc( poly2   polyct   sep   < 0.6  "Rule 11.5  poly2 distance to contact  >0.6") 
drc( poly2   poly2ct  enc   < 0.6  "Rule 11.6  poly2 enclosure of contact >0.6") 
drc( siprotx poly2    enc   < 0.6  "Rule 11.9  poly2 enclosure by siprot  >0.6") 
;                                                                                
;-------------------------------------------------------------------------------    
;	NLDDPROT  CHECKS  LEVEL 83  
;-------------------------------------------------------------------------------    
;  
nldgate = geomOutside( ngate nldprot )  
;  
drc( nldprot          width < 0.8  "Rule 83.1  nlddprot width             >0.8")  
drc( nldprot          sep   < 0.8  "Rule 83.2  nlddprot space             >0.8")  
drc( nldprot          notch < 0.8  "Rule 83.2  nlddprot notch             >0.8")  
drc( nldprot active   enc   < 0.5   
                            "Rule 83.3  nlddprot extension on N+ active   >0.5")  
drc( nldprot active   sep   < 0.5  "Rule 83.4  nlddprot dist to N+ active >0.5")  
drc( nldprot geomGetEdge( ngate coincident poly ) enc < 0.95                     
                            "Rule 83.5  nlddprot extension on NMOS gate  >0.95") 
drc( nldprot nldgate  sep   < 0.95 "Rule 83.6  nlddprot dist to NMOS gate>0.95") 
drc( nldprot pplus  0 < sep < 0.8  "Rule 83.7  nlddprot distance to pplus >0.8")  
drc( nldprot cap    0 < sep < 0.8  "Rule 83.8  nlddprot distance to cap   >0.8") 
drc( nldprot pminus 0 < sep < 0.8  "Rule 83.9  nlddprot dist to pminus    >0.8") 
drc( nldprot ndifsk     sep < 0.5                                                
                            "Rule 83.10 nlddprot dist to N+ sinker active >0.5") 
;  
saveDerived( geomStraddle( ngate nldprot )  
                            "Rule 83.imp1  NMOS gate must be inside nlddprot  ")  
saveDerived( geomAnd( nldprot ndifsk )                                           
                            "Rule 83.imp2  nlddprot not allowed on N+ sink act") 
;  
;------------------------------------------------------------------------------- 
;      PMINUS  CHECKS  LEVEL 9                                                   
;------------------------------------------------------------------------------- 
;                                                                                
drc( pminus           width < 1.6  "Rule 9.1  pminus width                >1.6") 
drc( pminus           sep   < 0.8  "Rule 9.2  pminus space                >0.8") 
drc( pminus           notch < 0.8  "Rule 9.2  pminus notch                >0.8") 
drc( pminus  pdifbas  enc   < 0.5  "Rule 9.3  pminus enclos of P-base act >0.5") 
drc( pminus  active   sep   < 0.5  "Rule 9.4  pminus distance to active   >0.5") 
;                                                                                
saveDerived( geomAndNot( pmactiv nepi )                                          
                            "Rule 9.imp1  P-base active only allowed in nepi  ") 
;                                                                                
;------------------------------------------------------------------------------- 
;      EMCUT  CHECKS  LEVEL 15                                                   
;------------------------------------------------------------------------------- 
;                                                                                
edgemit = geomSize( geomGetLength( emcut length < 1.2 ) 0.05 )                   
;                                                                                
drc( emcut            width < 0.6  "Rule 15.1  emcut width                >0.6") 
drc( emcut            sep   < 0.8  "Rule 15.2  emcut space                >0.8") 
drc( emcut            notch < 0.8  "Rule 15.2  emcut notch                >0.8") 
saveDerived( geomButting( emcut edgemit  keep > 2 )                              
                                   "Rule 15.3  emcut minimum length       >1.2") 
saveDerived( geomGetLength( emcut length > 60.0 fig )                            
                                   "Rule 15.4  emcut maximum length      <60.0") 
drc( pdifbas emcut    enc   < 0.3  "Rule 15.5  emcut enclos by P-base act >0.3") 
;                                                                                
saveDerived( geomAndNot( emcut pdifbas )                                         
                            "Rule 15.imp1  emcut only allowed on P-base active") 
saveDerived( geomAndNot( geomInside( emcut pdifbas ) polyem )                    
                            "Rule 15.imp2  emcut not covered by polyem        ") 
;                                                                                
;------------------------------------------------------------------------------- 
;      POLYEM  CHECKS  LEVEL 14                                                  
;------------------------------------------------------------------------------- 
;                                                                                
polyema = geomAnd( polyemc pdifbas )                                             
pbase   = geomAndNot( pdifbas polyemc )                                          
respldd = geomButting( geomAnd( pactive polyemc ) pdifsi  keep > 1 )             
;                                                                                
drc( polyem           width < 1.2  "Rule 14.1  polyem width               >1.2") 
drc( polyem           sep   < 1.3  "Rule 14.2  polyem space               >1.3") 
drc( polyem           notch < 1.3  "Rule 14.2  polyem notch               >1.3") 
drc( polyem  active   sep   < 0.4  "Rule 14.3  polyem distance to active  >0.4") 
drc( polyem  emcut    enc   < 0.3  "Rule 14.4  polyem enclosure of emcut  >0.3") 
drc( polyem  pdifbas  enc   < 0.3  "Rule 14.5  polyem extens on P-base act>0.3") 
drc( polyem  pinnw    enc   < 0.5  "Rule 14.6  polyem extension on active >0.5") 
saveDerived( geomAnd( polyem poly ) "Rule 14.7  polyem over poly forbidden    ") 
drc( polyem  poly     sep   < 1.0  "Rule 14.8  polyem distance to poly    >1.0") 
;                                                                                
saveDerived( geomAndNot( ppolyem dpolyem )                                       
                            "Rule 14.imp1  POLYEM purpose PIN without DRAWING ") 
saveDerived( geomOutside( polyema emcut )                                        
                            "Rule 14.imp2  emcut under polyem required        ") 
saveDerived( geomButting( polyema geomGetPolygon( pbase ) )                      
                      "Rule 14.imp3  polyem must cross P-base active boundary ") 
saveDerived( geomAnd( polyem ninpw )                                             
                      "Rule 14.imp5  polyem over N+ act in pwell not allowed  ") 
saveDerived( geomAnd( polyem ndifsk )                                            
                      "Rule 14.imp6  polyem over N+ sinker active not allowed ") 
saveDerived( geomAnd( polyem pinnepi )                                           
                      "Rule 14.imp7  polyem over P+ act in nepi not allowed   ") 
saveDerived( geomAnd( polyem ninnepi )                                           
                      "Rule 14.imp8  polyem over N+ act in nepi not allowed   ") 
saveDerived( geomAnd( polyem nstrap )                                            
                      "Rule 14.imp9  polyem over Nwell strap not allowed      ") 
saveDerived( geomAnd( polyem pstrap )                                            
                      "Rule 14.imp10 polyem over Pwell strap not allowed      ") 
saveDerived( geomAndNot( respldd nwell )                                         
                      "Rule 14.imp11 nwell required under LDD-P resistor      ") 
saveDerived( geomAndNot( geomAnd( polyem pinnw ) rpldd )                         
     "Rule 14.imp12 polyem not allowed on P+ act in nwell except for LDD-P res") 
saveDerived( geomOverlap( rpldtop nwellc  diffNet )                              
 "Rule 14.imp13 Pldd resist top plate must be connected to corresponding nwell") 
;                                                                                
;-------------------------------------------------------------------------------    
;	PPLUS  CHECKS  LEVEL 17  
;-------------------------------------------------------------------------------    
;  
drc( pplus            width < 0.8  "Rule 17.1  pplus width                >0.8")  
drc( pplus            sep   < 0.8  "Rule 17.2  pplus space                >0.8")  
drc( pplus            notch < 0.8  "Rule 17.2  pplus notch                >0.8")  
drc( pplus   actinw   enc   < 0.5  "Rule 17.3  pplus enclos of P+ active  >0.5")  
drc( pplus   pinnepi  enc   < 0.5  "Rule 17.3  pplus enclos of P+ active  >0.5") 
drc( pplus   actinws  sep   < 0.5  "Rule 17.4  pplus dist to N+ active    >0.5") 
drc( pplus   ninnepi  sep   < 0.5  "Rule 17.4  pplus dist to N+ active    >0.5") 
drc( pplus   pstrtn   ovlp  < 0.8    
                            "Rule 17.5  P+ act width of abut Pwell strap  >0.8")  
drc( geomGetEdge( pstrtn butting nactive) geomGetEdge( ngate inside active )     
     sep  < 1.15            "Rule 17.6  poly gate dist to abut Pw strap  >1.15") 
; Rule 17.7  checked by rules 17.5 & 17.6  
drc( geomGetEdge( nstrtp butting pplus ) active ovlp < 0.8  opposite   
                            "Rule 17.8  N+ act width of abut Nwell strap  >0.8")  
drc( geomGetEdge( nstrtp butting pactive ) geomGetEdge( pgate inside active )    
     sep  < 1.15            "Rule 17.9  poly gate dist to abut Nw strap  >1.15") 
; Rule 17.10 checked by rules 17.8 & 17.9  
drc( pplus   ndifsk   sep   < 0.5  "Rule 17.17 pplus dist to N+ sink act  >0.5") 
drc( pplus   pminus 0 < sep < 0.8  "Rule 17.19 pplus distance to pminus   >0.8") 
;                                                                                
saveDerived( geomGetEdge( pplus inside geomAndNot( gate siprot ) )  
                            "Rule 17.imp1 pplus crossing poly gate not allowed")  
saveDerived( geomAnd( pplus pminus )                                             
                            "Rule 17.imp2  pplus over pminus not allowed      ") 
;  
;-------------------------------------------------------------------------------    
;	SIPROT  CHECKS  LEVEL 18  
;-------------------------------------------------------------------------------    
;  
abstrp  = geomOr( pstrtn nstrtp )                                                  
pstrtnz = geomSize( geomGetEdge( pstrtn coincident pplus not_over trprot ) 0.1 )   
nstrtpz = geomSize( geomGetEdge( nstrtp butting pplus not_over trprot ) 0.1 )      
abstrpz = geomOr( pstrtnz nstrtpz )  
abstrnb = geomAndNot( abstrp geomButting( abstrp abstrpz ) )  
;  
mresact = geomAnd( mres active )  
mrespo  = geomAnd( mres poly )  
mrespo3 = geomAnd( mres polyem )                                                 
mresdev = geomOr( mrespo3 geomOr( mresact mrespo ) )                             
;  
saveDerived( geomAnd( siprot actnepi )                                           
                            "Rule 18.0  siprot over active in nepi not allowed") 
drc( siprot           width < 1.3  "Rule 18.1  siprot width               >1.3")  
drc( siprot           sep   < 1.0  "Rule 18.2  siprot space               >1.0")  
drc( siprot           notch < 1.0  "Rule 18.2  siprot notch               >1.0")  
drc( siprot  active   enc   < 0.4  "Rule 18.3  siprot extension on active >0.4")  
drc( siprot  active   ovlp  < 0.6  "Rule 18.4  siprot inters with active  >0.6")  
drc( active  siprot   enc   < 0.8  "Rule 18.5  active extension on siprot >0.8")  
drc( siprot  geomGetEdge( gate inside active )  enc < 1.65                       
                            "Rule 18.6  siprot extension on poly/active  >1.65") 
drc( siprot  actct    sep   < 0.5  "Rule 18.7  siprot dist to cont/act    >0.5")  
drc( siprot  active   sep   < 0.6  "Rule 18.8  siprot distance to active  >0.6")  
drc( siprot  pofield  sep   < 0.55                                               
                            "Rule 18.9  siprot distance to poly on field >0.55") 
drc( siprot  polyct   sep   < 0.5  "Rule 18.10 siprot dist to cont/poly   >0.5")  
drc( siprot  pofield  enc   < 0.35                                               
                           "Rule 18.11 siprot extension on poly on field >0.35") 
saveDerived( geomGetEdge( siprot inside gate )  
                            "Rule 18.12 siprot must overlap gate on both sides")  
drc( siprot  geomGetEdge( gate inside active )    sep < 0.85                     
                                   "Rule 18.13 siprot dist to poly gate  >0.85") 
saveDerived( geomGetEdge( pplus inside geomAnd( geomAndNot( siprot presist ) poly )) 
                      "Rule 18.14 pplus crossing unsalicided poly not allowed ")     
drc( siprot  geomGetEdge( pplus inside poly )     sep < 1.1  
                            "Rule 18.15 siprot dist to P+ poly on poly   >1.1 ")  
drc( geomGetEdge( pplus inside poly ) siprot      enc < 1.1  
                            "Rule 18.16 P+ poly extension on siprot      >1.1 ")  
saveDerived( geomGetEdge( siprot inside abstrnb )                 
             "Rule 18.17 siprot must cross P+ implant boundary on active      ")    
drc( geomGetEdge( siprot inside active )  geomGetEdge( pstrtn inside active )  
  sep < 1.1  "Rule 18.18 siprot dist to P+ act in case of abut Pw strap   >1.1")   
drc( geomGetEdge( siprot inside active )  geomGetEdge( nstrtp inside active )  
  sep < 1.1  "Rule 18.19 P+ act extens on siprot in case of abut Nw strap >1.1")   
drc( poly    siprot   enc   < 0.8  "Rule 18.20 poly extension on siprot   >0.8")  
drc( siprot  poly     ovlp  < 0.6  
             "Rule 18.21 siprot intersect with poly for unsalicided poly  >0.6")  
drc( siprot  poly2ct  sep   < 0.3  "Rule 18.22 siprot dist to poly2 ct    >0.3") 
drc( pplus   siprpo1  sep   < 0.45                                               
                            "Rule 18.23 pplus dist to unsalicided poly   >0.45") 
drc( pplus   geomGetEdge( siprpo1 coincident poly )  enc  < 0.45                 
                            "Rule 18.24 pplus enclos of unsalicided poly >0.45") 
drc( siprot  polyem   sep   < 0.6  "Rule 18.25 siprot distance to polyem  >0.6") 
drc( siprot  polemct  sep   < 0.5  "Rule 18.26 siprot dist to polyem ct   >0.5") 
drc( siprot  polyemf  enc   < 0.4  "Rule 18.27 siprot ext on polyem field >0.4") 
drc( polyem  siprot   enc   < 0.8  "Rule 18.28 polyem extension on siprot >0.8") 
drc( siprot  polyem   ovlp  < 0.6                                                
             "Rule 18.29 siprot inter with polyem for unsalicided polyem  >0.6") 
drc( pplus   siprpo3  sep   < 0.5                                                
                            "Rule 18.30 pplus dist to unsalicided polyem  >0.5") 
drc( pminus  siprpo1  sep   < 0.5                                                
                            "Rule 18.31 pminus dist to unsalicided poly   >0.5") 
;  
saveDerived( geomAndNot( mresdev siprot )  
                             "Rule 18.imp1  siprot over marker mres required  ")  
saveDerived( geomAnd( pplus siprpo3 )                                            
                      "Rule 18.imp2  pplus over unsalicided polyem not allowed") 
saveDerived( geomAnd( pminus siprpo1 )                                           
                      "Rule 18.imp3  pminus over unsalicided poly not allowed ") 
saveDerived( geomAnd( siprot geomAnd( polyem pinnw ) )                           
                            "Rule 18.imp4  siprot over polyem not allowed     ") 
;  
;-------------------------------------------------------------------------------    
;	CONTACT  CHECKS  LEVEL 19  
;-------------------------------------------------------------------------------    
;  
ctovsip = geomAnd( contact siprot )  
;  
drc( contact          width < 0.6  "Rule 19.1a contact width              =0.6")  
drc( contact          area  > 0.36 "Rule 19.1b contact width              =0.6")  
drc( contact          sep   < 0.8  "Rule 19.2  contact space              >0.8")  
drc( poly    polyct   enc   < 0.3  "Rule 19.3  contact enclosure by poly  >0.3") 
drc( active  actct    enc   < 0.3  "Rule 19.4  contact enclos by active   >0.3") 
drc( polyct  active   sep   < 0.6  "Rule 19.5  cont/poly dist to active   >0.6")  
drc( polemct active   sep   < 0.6  "Rule 19.5  cont/polyem dist to active >0.6") 
drc( actct   poly     sep   < 0.5  "Rule 19.6  cont/act distance to poly  >0.5") 
; Rule 19.7  cont encl by P+ or N+ in abutting straps : contact overlapping  
; both PPLUS & NPLUS allowed in abutting straps because of shorting by salicide.  
saveDerived( geomAnd( polyct geomAndNot( active ndifsk ) )                       
                            "Rule 19.8  contact on poly over active forbidden ")  
saveDerived( ctovsip               "Rule 19.9  contact inside siprot forbidden")  
drc( polyem  polemct  enc   < 0.3  "Rule 19.10 contact enclos by polyem   >0.3") 
drc( actct   polyem   sep   < 0.6  "Rule 19.11 cont/act dist to polyem    >0.6") 
drc( geomAnd( poly ndifsk ) polyct  enc < 0.6                                    
            "Rule 19.12 contact enclos by poly of POLY/N+SINKER capacitor >0.6") 
;  
saveDerived( geomAndNot( contact geomOr( ctovsip geomOr( geomOr( actct polyct )  
                                         geomOr( poly2ct polemct ) ) ) )         
     "Rule 19.imp1 cont without poly nor poly2 nor polyem nor active forbidden") 
saveDerived( geomAndNot( contact met1drc )    
                            "Rule 19.imp2  contact not covered by metal1      ")  
saveDerived( geomButtOrOver( mrpo polyct )                                       
             "Rule 19.imp3  mrpo butting or over contact/poly not allowed     ") 
saveDerived( geomButtOrOver( mrm1 polyct )                                       
             "Rule 19.imp4  mrm1 butting or over contact/poly not allowed     ") 
saveDerived( geomButtOrOver( mrm1 actct )                                        
             "Rule 19.imp5  mrm1 butting or over contact/active not allowed   ") 
saveDerived( geomStraddle( polyct ndifsk )                                       
             "Rule 19.imp7  cont/poly crossing N+ sinker active not allowed   ") 
;  
;-------------------------------------------------------------------------------    
;	METAL1  CHECKS  LEVEL 23  
;-------------------------------------------------------------------------------    
;  
shm1gnd = geomSize( geomGetEdge( m1gnd butting geomButtOnly( m1vdd m1gnd ) ) 0.1 )  
shm1pwr = geomSize( geomGetEdge( met1pw butting geomButtOnly( m1int met1pw ) ) 0.1 )  
m1inter = geomAndNot( m1int mshort )  
;  
drc( met1drc          width < 0.8  "Rule 23.1  metal1 width               >0.8") 
drc( met1drc          sep   < 0.8  "Rule 23.2  metal1 space               >0.8")  
drc( met1drc          notch < 0.8  "Rule 23.2  metal1 notch               >0.8")  
drc( met1drc actct    enc   < 0.3  "Rule 23.3  metal1 enclos of cont/act  >0.3") 
drc( met1drc polyct   enc   < 0.3  "Rule 23.4  metal1 enclos of cont/poly >0.3") 
;  
saveDerived( geomSize( m1npd -12.5 )  
                                   "Rule 23.5 metal1 max width X & Y     <25.0")  
drc( met1drc poly2ct  enc   < 0.3  "Rule 23.6  metal1 enc of cont/poly2   >0.3") 
drc( met1drc polemct  enc   < 0.3  "Rule 23.7  metal1 enc of cont/polyem  >0.3") 
;  
saveDerived( geomAndNot( pmetal1 dmetal1 )  
                            "Rule 23.imp1  MET1 purpose PIN without DRAWING   ")  
saveDerived( geomAnd( m1vdd geomOr( m1gnd shm1gnd ) )  
                            "Rule 23.imp2  m1vdd shorted with m1gnd           ")  
saveDerived( geomAnd( geomOr( met1pw shm1pwr ) m1inter )  
                            "Rule 23.imp3  m1int shorted with met1 power      ")  
saveDerived( geomAnd( m1io met1pw )  
                            "Rule 23.imp4  m1io must not overlap met1 power   ")  
saveDerived( geomAndNot( m1io m1int )  
                            "Rule 23.imp5  m1int required over m1io           ")  
;  
;-------------------------------------------------------------------------------    
;	VIA1  CHECKS  LEVEL 25  
;-------------------------------------------------------------------------------    
;  
drc( v1npd            width < 0.6  "Rule 25.1a via1 width                 =0.6")  
drc( v1npd            area  > 0.36 "Rule 25.1b via1 width                 =0.6")  
drc( v1npd            sep   < 0.8  "Rule 25.2  via1 space                 >0.8")  
drc( met1drc v1npd    enc   < 0.3  "Rule 25.3  via1 enclosure by metal1   >0.3") 
;  
saveDerived( geomAndNot( v1npd met1drc )  
                                   "Rule 25.imp1  via1 not covered by metal1  ")  
saveDerived( geomAndNot( v1npd met2drc )  
                                   "Rule 25.imp2  via1 not covered by metal2  ")  
ivIf( switch( "nopad" ) then   
saveDerived( geomAnd( m1inter geomAnd( v1npd met2pw ) )   
                                   "Rule 25.imp3  m1int short with met2 power ")  
saveDerived( geomAnd( m2vdd geomAnd( v1npd m1gnd ) )   
                                   "Rule 25.imp4  m1gnd shorted with m2vdd    ")  
saveDerived( geomAnd( m2gnd geomAnd( v1npd m1vdd ) )   
                                   "Rule 25.imp5  m1vdd shorted with m2gnd    ")  
saveDerived( geomButtOrOver( mrm1 v1npd )                                        
                      "Rule 25.imp6  mrm1 butting or over via1 not allowed    ") 
saveDerived( geomButtOrOver( mrm2 v1npd )                                        
                      "Rule 25.imp7  mrm2 butting or over via1 not allowed    ") 
else   
saveDerived( geomAnd( m1inter geomAnd( via met2pw ) )   
                                   "Rule 25.imp3  m1int short with met2 power ")  
saveDerived( geomAnd( m2vdd geomAnd( via m1gnd ) )   
                                   "Rule 25.imp4  m1gnd shorted with m2vdd    ")  
saveDerived( geomAnd( m2gnd geomAnd( via m1vdd ) )   
                                   "Rule 25.imp5  m1vdd shorted with m2gnd    ")  
saveDerived( geomButtOrOver( mrm1 via )                                          
                      "Rule 25.imp6  mrm1 butting or over via1 not allowed    ") 
saveDerived( geomButtOrOver( mrm2 via )                                          
                      "Rule 25.imp7  mrm2 butting or over via1 not allowed    ") 
)  
;  
;-------------------------------------------------------------------------------    
;	METAL2  CHECKS  LEVEL 27  
;-------------------------------------------------------------------------------   
;  
shm2gnd = geomSize( geomGetEdge( m2gnd butting geomButtOnly( m2vdd m2gnd ) ) 0.1 )  
shm2pwr = geomSize( geomGetEdge( met2pw butting geomButtOnly( m2int met2pw ) ) 0.1 )  
m2inter = geomAndNot( m2int mshort )   
;  
drc( met2drc          width < 1.0  "Rule 27.1  metal2 width               >1.0") 
drc( met2drc          sep   < 0.9  "Rule 27.2  metal2 space               >0.9")  
drc( met2drc          notch < 0.9  "Rule 27.2  metal2 notch               >0.9")  
drc( met2drc v1npd    enc   < 0.3  "Rule 27.3  metal2 enclosure of via1   >0.3") 
saveDerived( geomSize( m2npd -12.5 )    
                                   "Rule 27.5  metal2 max width X & Y    <25.0")  
;  
saveDerived( geomAndNot( pmetal2 dmetal2 )  
                            "Rule 27.imp1  MET2 purpose PIN without DRAWING   ")  
saveDerived( geomAnd( m2vdd geomOr( m2gnd shm2gnd ) )  
                            "Rule 27.imp2  m2vdd shorted with m2gnd           ")  
saveDerived( geomAnd( geomOr( met2pw shm2pwr ) m2inter )  
                            "Rule 27.imp3  m2int shorted with met2 power      ")  
saveDerived( geomAnd( m2io met2pw )  
                            "Rule 27.imp4  m2io must not overlap met2 power   ")  
saveDerived( geomAndNot( m2io m2int )  
                            "Rule 27.imp5  m2int required over m2io           ")  
ivIf( switch( "nopad" ) then  
saveDerived( geomAnd( met1pw geomAnd( v1npd m2inter ) )  
                            "Rule 27.imp6  met1 power shorted with m2int      ")  
else   
saveDerived( geomAnd( met1pw geomAnd( via m2inter ) )  
                            "Rule 27.imp6  met1 power shorted with m2int      ")  
)  
;  
;-------------------------------------------------------------------------------    
;	VIA2  CHECKS  LEVEL 32  
;-------------------------------------------------------------------------------    
;  
drc( v2npd            width < 0.7  "Rule 32.1a via2 width                 =0.7")  
drc( v2npd            area  > 0.49 "Rule 32.1b via2 width                 =0.7")  
drc( v2npd            sep   < 1.0  "Rule 32.2  via2 space                 >1.0")  
drc( met2drc v2npd    enc   < 0.3  "Rule 32.3  via2 enclosure by metal2   >0.3") 
;   
saveDerived( geomAndNot( v2npd met2drc )    
                                   "Rule 32.imp1  via2 not covered by metal2  ")  
saveDerived( geomAndNot( v2npd met3drc )  
                                   "Rule 32.imp2  via2 not covered by metal3  ")  
ivIf( switch( "nopad" ) then  
saveDerived( geomAnd( m2inter geomAnd( v2npd met3pw ) )  
                                   "Rule 32.imp3  m2int short with met3 power ")  
saveDerived( geomAnd( m3vdd geomAnd( v2npd m2gnd ) )  
                                   "Rule 32.imp4  m2gnd shorted with m3vdd    ")  
saveDerived( geomAnd( m3gnd geomAnd( v2npd m2vdd ) )  
                                   "Rule 32.imp5  m2vdd shorted with m3gnd    ")  
saveDerived( geomButtOrOver( mrm2 v2npd )                                        
                      "Rule 32.imp6  mrm2 butting or over via2 not allowed    ") 
saveDerived( geomButtOrOver( mrm3 v2npd )                                        
                      "Rule 32.imp7  mrm3 butting or over via2 not allowed    ") 
else  
saveDerived( geomAnd( m2inter geomAnd( vi2 met3pw ) )  
                                   "Rule 32.imp3  m2int short with met3 power ")  
saveDerived( geomAnd( m3vdd geomAnd( vi2 m2gnd ) )  
                                   "Rule 32.imp4  m2gnd shorted with m3vdd    ")  
saveDerived( geomAnd( m3gnd geomAnd( vi2 m2vdd ) )  
                                   "Rule 32.imp5  m2vdd shorted with m3gnd    ")  
saveDerived( geomButtOrOver( mrm2 vi2 )                                          
                      "Rule 32.imp6  mrm2 butting or over via2 not allowed    ") 
saveDerived( geomButtOrOver( mrm3 vi2 )                                          
                      "Rule 32.imp7  mrm3 butting or over via2 not allowed    ") 
)  
;  
;-------------------------------------------------------------------------------    
;	METAL3  CHECKS  LEVEL 34  
;-------------------------------------------------------------------------------   
;  
shm3gnd = geomSize( geomGetEdge( m3gnd butting geomButtOnly( m3vdd m3gnd ) ) 0.1 )  
shm3pwr = geomSize( geomGetEdge( met3pw butting geomButtOnly( m3int met3pw ) ) 0.1 )  
m3inter = geomAndNot( m3int mshort )   
;  
drc( met3drc          width < 1.3  "Rule 34.1  metal3 width               >1.3") 
drc( met3drc          sep   < 1.2  "Rule 34.2  metal3 space               >1.2") 
drc( met3drc          notch < 1.2  "Rule 34.2  metal3 notch               >1.2") 
drc( met3drc v2npd    enc   < 0.3  "Rule 34.3  metal3 enclosure of via2   >0.3") 
saveDerived( geomSize( m3npd -12.5 )   
                                   "Rule 34.5  metal3 max width X & Y    <25.0")  
;  
saveDerived( geomAndNot( pmetal3 dmetal3 )  
                            "Rule 34.imp1  MET3 purpose PIN without DRAWING   ")  
saveDerived( geomAnd( m3vdd geomOr( m3gnd shm3gnd ) )  
                            "Rule 34.imp2  m3vdd shorted with m3gnd           ")  
saveDerived( geomAnd( geomOr( met3pw shm3pwr ) m3inter )  
                            "Rule 34.imp3  m3int shorted with met3 power      ")  
saveDerived( geomAnd( m3io met3pw )  
                            "Rule 34.imp4  m3io must not overlap met3 power   ")  
saveDerived( geomAndNot( m3io m3int )  
                            "Rule 34.imp5  m3int required over m3io           ")  
ivIf( switch( "nopad" ) then  
saveDerived( geomAnd( met2pw geomAnd( v2npd m3inter ) )  
                            "Rule 34.imp6  met2 power shorted with m3int      ")  
else  
saveDerived( geomAnd( met2pw geomAnd( vi2 m3inter ) )  
                            "Rule 34.imp6  met2 power shorted with m3int      ")  
)  
;  
;-------------------------------------------------------------------------------   
;	POLYIMIDE  CHECKS  LEVEL 39  
;-------------------------------------------------------------------------------    
;  
drc( polyi            width < 50   "Rule 39.1  polyimide width           >50.0")  
drc( polyi            sep   < 25   "Rule 39.2  polyimide space           >25.0")  
drc( polyi            notch < 25   "Rule 39.2  polyimide notch           >25.0")  
; not manageable      "Rule 39.3  polyimide distance to edge of die      >10.0"   
;  
;-------------------------------------------------------------------------------    
;                                                                                
;                                                                                
;******************************************************************************* 
;**********             HIPO  RESISTOR  RULES  CHECKS                 ********** 
;******************************************************************************* 
;                                                                                
rhbody  = geomAndNot( geomAnd( presist siprpo1 ) pplus )                         
rhpoly  = geomEnclose( poly rhbody )                                             
rhterm  = geomAndNot( rhpoly rhbody )                                            
rhhead  = geomAnd( rhterm pplus )                                                
;                                                                                
;------------------------------------------------------------------------------  
;       POLY  CHECKS  LEVEL 13                                                   
;------------------------------------------------------------------------------  
;                                                                                
saveDerived( geomAndNot( rhpoly nwell )                                          
                      "Rule 13.12    hipo resistor poly must be placed on Nw ")  
drc( nwell   rhpoly   enc   < 1.5                                                
                      "Rule 13.13    hipo resistor poly enclosure by Nw  >1.5")  
drc( rhbody           width < 1.2  "Rule 13.17  hipo resistor width      >1.2")  
saveDerived( geomGetLength( geomGetEdge( rhbody coincident poly ) length < 5.0 ) 
                                   "Rule 13.18  hipo resistor length     >5.0")  
drc( rhbody           sep   < 0.8  "Rule 13.19  hipo resistor space      >0.8")  
;                                                                                
;------------------------------------------------------------------------------  
;       PRESIST  CHECKS  LEVEL 26                                                
;------------------------------------------------------------------------------  
;                                                                                
saveDerived( geomAnd( presist active )                                           
                      "Rule 26.0  presist over active not allowed            ")  
drc( presist          width < 0.8  "Rule 26.1  presist width             >0.8")  
drc( presist          sep   < 0.8  "Rule 26.2  presist space             >0.8")  
drc( presist          notch < 0.8  "Rule 26.2  presist space             >0.8")  
drc( presist active   sep   < 0.5                                                
                      "Rule 26.3  presist distance to active             >0.5")  
drc( presist poly     sep   < 1.0                                                
                      "Rule 26.4  presist distance to poly               >1.0")  
drc( presist pplus    sep   < 0.8                                                
                      "Rule 26.5  presist distance to pplus              >0.8")  
drc( presist nldprot  0 < sep < 0.8                                              
                      "Rule 26.6  presist distance to nlddprot           >0.8")  
drc( presist cap      sep   < 0.8                                                
                      "Rule 26.7  presist distance to cap                >0.8")  
saveDerived( geomGetEdge( presist inside rhpoly )                                
     "Rule 26.8  poly of hipo resistor crossing presist boundary forbidden   ")  
drc( presist  rhpoly  enc   < 1.6                                                
             "Rule 26.10 presist enclosure of poly of hipo resistor      >1.6")  
;                                                                                
saveDerived( geomGetEdge( presist inside siprpo1 )                               
             "Rule 26.imph1  presist crossing unsalicided poly forbidden     ")  
saveDerived( geomAnd( presist cap )                                              
                      "Rule 26.imph2  presist over cap not allowed           ")  
;                                                                                
;------------------------------------------------------------------------------  
;       PPLUS  CHECKS  LEVEL 17                                                  
;------------------------------------------------------------------------------  
;                                                                                
saveDerived( geomAndNot( rhterm pplus )                                          
             "Rule 17.20  pplus must be placed on heads of hipo resistor     ")  
drc( geomGetEdge( pplus coincident rhhead )  rhpoly  ovlp < 1.9                  
             "Rule 17.21  pplus intersection with poly of hipo resistor  >1.9")  
drc( pplus   rhpoly    enc  < 0.5                                                
             "Rule 17.22  pplus extension on poly of hipo resistor       >0.5")  
;                                                                                
;------------------------------------------------------------------------------  
;       SIPROT  CHECKS  LEVEL 18                                                 
;------------------------------------------------------------------------------  
;                                                                                
drc( siprpo1 geomGetEdge( pplus coincident rhhead )  ovlp < 0.5                  
     "Rule 18.32  siprot intersection with pplus on heads of hipo resist >0.5")  
;                                                                                
; Rule 18.33 : siprot distance to contact on poly of hipo resistor               
;              already checked by 18.10                                          
;                                                                                
;------------------------------------------------------------------------------  
;  
;  
;*******************************************************************************   
;**********             PADS  RULES  CHECKS                           **********  
;*******************************************************************************  
;  
  ivIf( !switch( "nopad" ) then          ; BEGINNING OF THE PAD SECTION  
;  
;-------------------------------------------------------------------------------  
;       NITRIDE  CHECKS  LEVEL 31  
;-------------------------------------------------------------------------------  
;  
v1szpd  = geomSize( v1pd 0.7 )   
v2szpd  = geomSize( v2pd 0.65 )  
tmp1    = geomOverlap( nitride v1szpd  keep == 1 )  
nitv1pd = geomOverlap( tmp1 geomGetRectangle( v1szpd ) )  
tmp2    = geomOverlap( nitsz02 v2szpd  keep == 1 )                               
nitv2pd = geomOverlap( tmp2 geomGetRectangle( v2szpd ) )                
;  
; already checked : pad = nitride  "Rule 31.1  nitride enclosure of pad   =0.0"  
drc( m3pd    nitride  enc   < 10.0 "Rule 31.3  metal3 enclosure of pad   >10.0") 
drc( m2pd    nitride  enc   < 7.0  "Rule 31.4  metal2 enclosure of pad    >7.0") 
drc( m1pd    nitride  enc   < 4.0  "Rule 31.5  metal1 enclosure of pad    >4.0") 
drc( nwpd    nitride  enc   < 12.0 "Rule 31.6  nwell enclosure of pad    >12.0") 
drc( m1pd    v1pd     enc   < 5.0  "Rule 31.7  metal1 enclosure of via1   >5.0")  
drc( m2pd    v2pd     enc   < 5.0  "Rule 31.8  metal2 enclosure of via2   >5.0")  
drc( v1pd             width < 0.6  "Rule 31.10a  via1 size in pad         =0.6")  
drc( v1pd             area  > 0.36 "Rule 31.10b  via1 size in pad         =0.6")  
drc( v1pd             sep   < 1.4  "Rule 31.11a  via1 space in pad        =1.4")  
saveDerived( geomOverlap( v1szpd geomAndNot( nitride nitv1pd ) )  
                                   "Rule 31.11b  via1 space in pad        =1.4")  
drc( v2pd             width < 0.7  "Rule 31.12a  via2 size in pad         =0.7")  
drc( v2pd             area  > 0.49 "Rule 31.12b  via2 size in pad         =0.7")  
drc( v2pd             sep   < 1.3  "Rule 31.13a  via2 space in pad        =1.3")  
saveDerived( geomOverlap( v2szpd geomAndNot( nitsz02 nitv2pd ) )                 
                                   "Rule 31.13b  via2 space in pad        =1.3") 
saveDerived( actpd                 "Rule 31.14 active not allowed under pad   ")  
saveDerived( po1pd                 "Rule 31.15 poly not allowed under pad     ")  
saveDerived( po3pd                 "Rule 31.18 polyem not allowed under pad   ") 
drc( rnwpd   nitride  enc   < 12.0 "Rule 31.20 rnwell enclosure of pad   >12.0") 
;  
saveDerived( conpd                 "Rule 31.imp1 contact not allowed under pad")  
;saveDerived( geomAndNot( nitride nwrnw )                                           
;                                  "Rule 31.imp2  nwell required under pad     ")   
saveDerived( geomAndNot( nitride met1drc )  
                                   "Rule 31.imp3  metal1 required under pad   ")   
saveDerived( geomAndNot( nitride met2drc )  
                                   "Rule 31.imp4  metal2 required under pad   ")   
saveDerived( geomAndNot( nitride met3drc )  
                                   "Rule 31.imp5  metal3 required under pad   ")    
saveDerived( geomOutside( nitride via )  
                            "Rule 31.imp7  via1 matrix required under pad     ")   
saveDerived( geomOutside( nitride vi2 )  
                            "Rule 31.imp8  via2 matrix required under pad     ")   
drc( v2pd    v1pd     sep   < 0.49  
             "Rule 31.imp9  via2 matrix shifted from via1 matrix in pad   =1.0")  
saveDerived( geomAndNot( v1pd met1drc )                                           
                                   "Rule 31.imp11 via1 not covered by metal1  ")  
saveDerived( geomAndNot( v1pd met2drc )                                           
                                   "Rule 31.imp12 via1 not covered by metal2  ")  
saveDerived( geomAndNot( v2pd met2drc )                                           
                                   "Rule 31.imp13 via2 not covered by metal2  ")  
saveDerived( geomAndNot( v2pd met3drc )                                           
                                   "Rule 31.imp14 via2 not covered by metal3  ")   
saveDerived( plypd          "Rule 31.imp17 polyimide not allowed over pad     ")   
;  
;-------------------------------------------------------------------------------  
;       BOND  PADS  ASSEMBLY  RULES for Class C1 & C2  
;-------------------------------------------------------------------------------  
;  
 ivIf( !( switch( "pad100" ) || switch( "pad125" ) ) || ( switch( "pad100" ) && switch( "pad125" ) ) then  
;   
pad     = geomOr( nitride )  
;  
padsp   = drc( pad  sep < 60.0 )  
padbut2 = geomButting( pad padsp  keep > 1 )  
padsp1  = geomAndNot( padsp geomButting( padsp padbut2 ) )  
padsp2  = geomAndNot( padsp padsp1 )  
pad1    = geomButting( pad padsp1 )  
pad2    = geomAndNot( geomButting( pad padsp ) pad1 )  
padsp2z = geomSize( geomGetEdge( padsp2 butting pad2 ) 0.05 )  
padsp2b = geomGetEdge( padsp2z butting padsp2 )  
padsp2i = geomGetEdge( padsp2z inside pad2 )  
pad21   = geomButting( pad2 padsp2  keep == 1 )   
pad22   = geomButting( pad2 padsp2  keep > 1 )  
padsp21 = geomButting( padsp2 pad21 )   
pad21   = geomButting( pad2 padsp21 )    
pad22   = geomButting( pad22 padsp21 )  
;  
;  
drc( pad              width < 90.0   
"Rule 31.A1 min pad width/heigth for single bond pad, Class C1 & C2      >90.0")  
;  
;"Rule 31.A3  min pad width for double bond pad, Class C1 & C2          >240.0"  
; not manageable                  
;                                 
;"Rule 31.A4  min pad height for double bond pad, Class C1 & C2          >90.0"  
; checked by rule 31.A1          
;   
drc( geomOr( pad1 padsp1 )    pad1   60.0 < enc < 150.0   
                      "Rule 31.A5  minimum pad pitch for Class C1 & C2  >150.0")  
drc( padsp2b padsp2i  sep < 149.95   
                      "Rule 31.A5  minimum pad pitch for Class C1 & C2  >150.0")  
drc( geomOr( pad21 padsp21 )  pad22  60.0 < enc < 150.0  
                      "Rule 31.A5  minimum pad pitch for Class C1 & C2  >150.0")  
drc( pad              sep   < 21.2                                               
                      "Rule 31.A6  min pad space for Class C1 & C2       >21.2") 
drc( pad     geomAndNot( m1pdsz m1pd )    sep   < 30.0  
                      "Rule 31.A7  pad dist to met1 for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( m2pdsz m2pd )    sep   < 30.0  
                      "Rule 31.A8  pad dist to met2 for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( m3pdsz m3pd )    sep   < 30.0  
                      "Rule 31.A9  pad dist to met3 for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( v1pdsz v1pd )    sep   < 30.0  
                      "Rule 31.A11 pad dist to via1 for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( v2pdsz v2pd )    sep   < 30.0  
                      "Rule 31.A12 pad dist to via2 for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( nwpdsz nwpd )    sep   < 30.0  
                      "Rule 31.A14 pad dist to nwell for Class C1 & C2   >30.0")  
drc( pad     geomAndNot( actpdsz actpd )  sep   < 30.0   
                      "Rule 31.A15 pad dist to active for Class C1 & C2  >30.0")  
drc( pad     geomAndNot( po1pdsz po1pd )  sep   < 30.0   
                      "Rule 31.A16 pad dist to poly for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( conpdsz conpd )  sep   < 30.0   
                      "Rule 31.A17 pad dist to cont for Class C1 & C2    >30.0")  
drc( pad     geomAndNot( plypdsz plypd )  sep   < 30.0   
                      "Rule 31.A18 pad dist to polyi for Class C1 & C2   >30.0")  
drc( pad     geomAndNot( po3pdsz po3pd )  sep   < 30.0                           
                      "Rule 31.A20 pad dist to polyem for Class C1 & C2  >30.0") 
drc( pad     geomAndNot( rnwpdsz rnwpd )  sep   < 30.0                             
                      "Rule 31.A21 pad dist to rnwell for Class C1 & C2  >30.0")   
 )  
;  
;-------------------------------------------------------------------------------  
;       BOND  PADS  ASSEMBLY  RULES for Class D  
;-------------------------------------------------------------------------------  
;  
 ivIf( switch( "pad125" ) && !switch( "pad100" ) then  
;  
pad     = geomOr( nitride )  
padlt90 = geomSize( geomGetLength( pad length < 90.0 ) 0.05 )  
;  
padsp   = drc( pad  sep < 50.0 )  
padbut2 = geomButting( pad padsp  keep > 1 )  
padsp1  = geomAndNot( padsp geomButting( padsp padbut2 ) )  
padsp2  = geomAndNot( padsp padsp1 )  
pad1    = geomButting( pad padsp1 )  
pad2    = geomAndNot( geomButting( pad padsp ) pad1 )  
padsp2z = geomSize( geomGetEdge( padsp2 butting pad2 ) 0.05 )  
padsp2b = geomGetEdge( padsp2z butting padsp2 )  
padsp2i = geomGetEdge( padsp2z inside pad2 )  
pad21   = geomButting( pad2 padsp2  keep == 1 )   
pad22   = geomButting( pad2 padsp2  keep > 1 )  
padsp21 = geomButting( padsp2 pad21 )   
pad21   = geomButting( pad2 padsp21 )    
pad22   = geomButting( pad22 padsp21 )  
;  
;  
drc( pad              width < 75.0   
             "Rule 31.A1 min pad width for single bond pad, Class D      >75.0")  
;  
saveDerived( geomButting( pad padlt90  keep > 2 )  
             "Rule 31.A2  min pad height for single bond pad, Class D    >90.0")  
;  
; "Rule 31.A3  min pad width for double bond pad, Class D               >200.0"  
; not manageable                  
;                                 
;"Rule 31.A4  min pad height for double bond pad, Class D                >90.0"  
; not manageable                 
;   
drc( geomOr( pad1 padsp1 )    pad1   50.0 < enc < 125.0   
                      "Rule 31.A5  minimum pad pitch for Class D        >125.0")  
drc( padsp2b padsp2i  sep < 124.95   
                      "Rule 31.A5  minimum pad pitch for Class D        >125.0")  
drc( geomOr( pad21 padsp21 )  pad22  50.0 < enc < 125.0  
                      "Rule 31.A5  minimum pad pitch for Class D        >125.0")  
drc( pad              sep   < 21.2                                               
                      "Rule 31.A6  min pad space for Class D             >21.2") 
drc( pad     geomAndNot( m1pdsz m1pd )    sep   < 30.0  
                      "Rule 31.A7  pad dist to met1 for Class D          >30.0")  
drc( pad     geomAndNot( m2pdsz m2pd )    sep   < 30.0  
                      "Rule 31.A8  pad dist to met2 for Class D          >30.0")  
drc( pad     geomAndNot( m3pdsz m3pd )    sep   < 30.0  
                      "Rule 31.A9  pad dist to met3 for Class D          >30.0")  
drc( pad     geomAndNot( v1pdsz v1pd )    sep   < 30.0  
                      "Rule 31.A11 pad dist to via1 for Class D          >30.0")  
drc( pad     geomAndNot( v2pdsz v2pd )    sep   < 30.0  
                      "Rule 31.A12 pad dist to via2 for Class D          >30.0")  
drc( pad     geomAndNot( nwpdsz nwpd )    sep   < 30.0  
                      "Rule 31.A14 pad dist to nwell for Class D         >30.0")  
drc( pad     geomAndNot( actpdsz actpd )  sep   < 30.0   
                      "Rule 31.A15 pad dist to active for Class D        >30.0")  
drc( pad     geomAndNot( po1pdsz po1pd )  sep   < 30.0   
                      "Rule 31.A16 pad dist to poly for Class D          >30.0")  
drc( pad     geomAndNot( conpdsz conpd )  sep   < 30.0   
                      "Rule 31.A17 pad dist to cont for Class D          >30.0")  
drc( pad     geomAndNot( plypdsz plypd )  sep   < 30.0   
                      "Rule 31.A18 pad dist to polyi for Class D         >30.0")  
drc( pad     geomAndNot( po3pdsz po3pd )  sep   < 30.0                           
                      "Rule 31.A20 pad dist to polyem for Class D        >30.0") 
drc( pad     geomAndNot( rnwpdsz rnwpd )  sep   < 30.0                             
                      "Rule 31.A21 pad dist to rnwell for Class D        >30.0")   
 )  
;  
;-------------------------------------------------------------------------------  
;       BOND  PADS  ASSEMBLY  RULES for Class E  
;-------------------------------------------------------------------------------  
;  
 ivIf( switch( "pad100" ) && !switch( "pad125" ) then  
;  
pad     = geomOr( nitride )  
padlt90 = geomSize( geomGetLength( pad length < 90.0 ) 0.05 )  
;  
padsp   = drc( pad  sep < 25.0 )  
padbut2 = geomButting( pad padsp  keep > 1 )  
padsp1  = geomAndNot( padsp geomButting( padsp padbut2 ) )  
padsp2  = geomAndNot( padsp padsp1 )  
pad1    = geomButting( pad padsp1 )  
pad2    = geomAndNot( geomButting( pad padsp ) pad1 )  
padsp2z = geomSize( geomGetEdge( padsp2 butting pad2 ) 0.05 )  
padsp2b = geomGetEdge( padsp2z butting padsp2 )  
padsp2i = geomGetEdge( padsp2z inside pad2 )  
pad21   = geomButting( pad2 padsp2  keep == 1 )   
pad22   = geomButting( pad2 padsp2  keep > 1 )  
padsp21 = geomButting( padsp2 pad21 )   
pad21   = geomButting( pad2 padsp21 )    
pad22   = geomButting( pad22 padsp21 )  
;  
drc( pad              width < 75.0   
             "Rule 31.A1 min pad width for single bond pad, Class E      >75.0")  
;  
saveDerived( geomButting( pad padlt90  keep > 2 )  
             "Rule 31.A2  min pad height for single bond pad, Class E    >90.0")  
;  
; "Rule 31.A3  min pad width for double bond pad, Class E               >175.0"  
; not manageable                  
;                                 
;"Rule 31.A4  min pad height for double bond pad, Class E                >90.0"  
; not manageable                 
;   
drc( geomOr( pad1 padsp1 )    pad1   25.0 < enc < 100.0   
                      "Rule 31.A5  minimum pad pitch for Class E        >100.0")  
drc( padsp2b padsp2i  sep < 99.95   
                      "Rule 31.A5  minimum pad pitch for Class E        >100.0")  
drc( geomOr( pad21 padsp21 )  pad22  25.0 < enc < 100.0  
                      "Rule 31.A5  minimum pad pitch for Class E        >100.0")  
drc( pad              sep   < 21.2                                               
                      "Rule 31.A6  min pad space for Class E             >21.2") 
drc( pad     geomAndNot( m1pdsz m1pd )    sep   < 20.0  
                      "Rule 31.A7  pad dist to met1 for Class E          >20.0")  
drc( pad     geomAndNot( m2pdsz m2pd )    sep   < 20.0  
                      "Rule 31.A8  pad dist to met2 for Class E          >20.0")  
drc( pad     geomAndNot( m3pdsz m3pd )    sep   < 20.0  
                      "Rule 31.A9  pad dist to met3 for Class E          >20.0")  
drc( pad     geomAndNot( v1pdsz v1pd )    sep   < 20.0  
                      "Rule 31.A11 pad dist to via1 for Class E          >20.0")  
drc( pad     geomAndNot( v2pdsz v2pd )    sep   < 20.0  
                      "Rule 31.A12 pad dist to via2 for Class E          >20.0")  
drc( pad     geomAndNot( nwpdsz nwpd )    sep   < 20.0  
                      "Rule 31.A14 pad dist to nwell for Class E         >20.0")  
drc( pad     geomAndNot( actpdsz actpd )  sep   < 20.0   
                      "Rule 31.A15 pad dist to active for Class E        >20.0")  
drc( pad     geomAndNot( po1pdsz po1pd )  sep   < 20.0   
                      "Rule 31.A16 pad dist to poly for Class E          >20.0")  
drc( pad     geomAndNot( conpdsz conpd )  sep   < 20.0   
                      "Rule 31.A17 pad dist to cont for Class E          >20.0")  
drc( pad     geomAndNot( plypdsz plypd )  sep   < 20.0   
                      "Rule 31.A18 pad dist to polyi for Class E         >20.0")  
drc( pad     geomAndNot( po3pdsz po3pd )  sep   < 20.0                           
                      "Rule 31.A20 pad dist to polyem for Class E        >20.0") 
drc( pad     geomAndNot( rnwpdsz rnwpd )  sep   < 20.0                             
                      "Rule 31.A21 pad dist to rnwell for Class E        >20.0")   
 )  
;  
;-------------------------------------------------------------------------------  
;  
  )                                      ; END OF THE PAD SECTION   
;  
 )                                                       ; END OF THE DRC SECTION  
;  
;  
;*******************************************************************************  
;**********                                                           **********  
;**********			EXTRACT  SECTION                      **********  
;**********                                                           **********  
;*******************************************************************************  
;  
;  
 ivIf( switch( "extract?" ) then                         ; BEGINNING OF THE EXTRACT SECTION  
;  
;-------------------------------------------------------------------------------  
;       RE-DERIVATION OF STRAPS TO TAKE POLY OVER STRAP INTO ACCOUNT  
;-------------------------------------------------------------------------------  
;  
pstrap  = geomAnd( pdiff0 pwell )        ; P ACTIVE WELL STRAPS IN PWELL  
pstrapL = geomOr( pstrap )                                                         
pstrapN = geomAndNot( pstrap niso )                                              
nstrap  = geomAnd( ndiff0 nwrnw )        ; N ACTIVE WELL STRAPS IN NWELL           
nstrapL = geomOr( nstrap )                                                         
;  
;-------------------------------------------------------------------------------  
;  
  ivIf( switch( "usenotext" ) && !switch( "nodetext" ) then  
;  
               geomConnect(  
                via( vi2       metal3   metal2  )  
                via( via       metal2   metal1  )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2   )                                
                via( polemct   metal1   polyemc )                                
                via( actct     metal1   sali    )  
                via( ndifct    sali     ndifsi  )  
                via( pdifct    sali     pdifsi  )  
                via( pdifct    sali     lpnpE   lpnpC )                          
                via( dpct      sali     dpter   )  
                via( dnct      sali     dnter   )  
;start epidio                                                                    
;                via( dpnepic   sali     dpnepit )                               
;end epidio                                                                      
                via( pstrap    sali     pstrapL   pstrapN )                      
                via( nstrap    sali     nstrapL )                                  
                          )  
  )  
;  
  ivIf( switch( "nodetext" ) && !switch( "usenotext" ) then  
;  
               geomConnect(  
                via( vi2       metal3   metal2  )  
                via( via       metal2   metal1  )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2   )                                
                via( polemct   metal1   polyemc )                                
                via( actct     metal1   sali    )  
                via( ndifct    sali     ndifsi  )  
                via( pdifct    sali     pdifsi  )  
                via( pdifct    sali     lpnpE   lpnpC )                          
                via( dpct      sali     dpter   )  
                via( dnct      sali     dnter   )  
;start epidio                                                                    
;                via( dpnepic   sali     dpnepit )                               
;end epidio                                                                      
                via( pstrap    sali     pstrapL   pstrapN )                      
                via( nstrap    sali     nstrapL )                                  
                label( "pintext"  metal3 metal2 metal1 )                         
                label( "nodetext" sali   metal3 metal2 metal1 )                  
                          )  
  )  
;  
  ivIf( !switch( "usenotext" ) && !switch( "nodetext" ) then  
;  
               geomConnect(  
                via( vi2       metal3   metal2  )  
                via( via       metal2   metal1  )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2   )                                
                via( polemct   metal1   polyemc )                                
                via( actct     metal1   sali    )  
                via( ndifct    sali     ndifsi  )  
                via( pdifct    sali     pdifsi  )  
                via( pdifct    sali     lpnpE   lpnpC )                          
                via( dpct      sali     dpter   )  
                via( dnct      sali     dnter   )  
;start epidio                                                                    
;                via( dpnepic   sali     dpnepit )                               
;end epidio                                                                      
                via( pstrap    sali     pstrapL   pstrapN )                      
                via( nstrap    sali     nstrapL )                                  
                label( "polytext" polconn )  
                label( "m1text" metal1 )  
                label( "m2text" metal2 )  
                label( "m3text" metal3 )  
                label( "pintext" metal3 metal2 metal1 )                          
                label( "m1pintext" metal1 )  
                label( "m2pintext" metal2 )  
                label( "m3pintext" metal3 )  
                           )  
  )  
      nwells  = geomStamp( nwells  nstrapL error )  
      pwells  = geomStamp( pwells  pstrapL error )  
      subst   = geomStamp( subst  pstrapN error )                                
      pdifbas = geomStamp( pdifbas pdifsi  error )                               
      nburied = geomStamp( nburied ndifsi  error )                               
      nepi    = geomStamp( nepi    ndifsi  error )                               
;  
;------------------------------------------------------------------------------- 
;     Select the sandwich capacitor which plugs are really connected together    
;------------------------------------------------------------------------------- 
 po2sand = geomInside( poly2 nepi sameNet )                                      
 csand   = geomEnclose( csand po2sand )                                          
;                                                                                
;-------------------------------------------------------------------------------    
;	FILTER all the MOS which have the Gate connected to Power or Ground   
;-------------------------------------------------------------------------------    
;  
 ivIf( switch( "filter" ) then  
;  
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
;  
   polysub  = geomGetNet( polconn "gnd!" )                    ; POLY DRIVEN TO SUB  
   polnosub = geomAndNot( polconn  polysub )                  ; POLY NOT DRIVEN TO SUB  
   ngate    = geomAnd( ngate geomEnclose( polnosub contact) ) ; NMOS GATES  
   ;  
   polywel  = geomGetNet( polconn "vdd!" )                    ; POLY DRIVEN TO NWELL   
   polnowel = geomAndNot( polconn  polywel )                  ; POLY NOT DRIVEN TO NWELL  
   pgate    = geomAnd( pgate geomEnclose( polnowel contact) ) ; PMOS GATES  
 )  
;  
;-------------------------------------------------------------------------------           
;  
;		DEFINING  TRANSISTORS,  DIODES  AND  RESISTORS  ELEMENTS       
;               --------------------------------------------------------  
;   
;			CALCULATE  ELEMENTS  PARAMETERS                                
;               	-------------------------------  
;  
;  
;-------------------------------------------------------------------------------        
;	N-MOS  CAPACITOR  DEVICES  
;-------------------------------------------------------------------------------       
;  
extractDevice( ngate (polconn "PLUS") (ndifsi "MINUS") (pwells "B") "capane3 ivpcell")  
;  
;-------------------------------------------------------------------------------       
;	NMOS  DEVICES  
;-------------------------------------------------------------------------------       
;  
extractDevice( ngate polconn("G") ndifsi("S" "D") pwells("B") "nmos4 ivpcell" )         
    narea    = measureParameter( area ( ngate over active ) 1e-12 )                     
    n_wid    = measureParameter( length ( ngate coincident poly ) 5e-07 )               
    nwidth   = calculateParameter( n_wid * 1 )                                          
    nlength  = calculateParameter( narea / n_wid )                                      
;                                                                                       
ivIf( switch("benduse") then                                                            
    nbends_f = measureParameter( bends_full ( ngate coincident poly over nmosc ) )      
    nwidth   = calculateParameter( n_wid - nlength * ( 0.115 * nbends_f ) )             
)                                                                                       
;                                                                                       
    saveParameter( nlength "l" )                                                        
    saveParameter( nwidth "w" )                                                         
    saveParameter( nlength "lc" )                                                       
    saveParameter( nwidth "wc" )                                                        
;                                                                                          
;-------------------------------------------------------------------------------       
;	P-MOS  CAPACITOR  DEVICES  
;-------------------------------------------------------------------------------       
;  
extractDevice( pgate (polconn "PLUS") (pdifsi "MINUS") (nwells "B") "capape3 ivpcell" ) 
;  
;-------------------------------------------------------------------------------       
;	PMOS  DEVICES   
;-------------------------------------------------------------------------------       
;  
extractDevice( pgate polconn("G") pdifsi("S" "D") nwells("B") "pmos4 ivpcell" )         
    parea    = measureParameter( area ( pgate over active ) 1e-12 )                     
    p_wid    = measureParameter( length ( pgate coincident poly ) 5e-07 )               
    pwidth   = calculateParameter( p_wid * 1 )                                          
    plength  = calculateParameter( parea / p_wid )                                      
;                                                                                       
ivIf( switch("benduse") then                                                            
    pbends_f = measureParameter( bends_full ( pgate coincident poly over pmosc ) )      
    pwidth   = calculateParameter( p_wid - plength * ( 0.115 * pbends_f ) )             
)                                                                                       
;                                                                                       
    saveParameter( plength "l" )                                                        
    saveParameter( pwidth "w" )                                                         
    saveParameter( plength "lc" )                                                       
    saveParameter( pwidth "wc" )                                                        
;  
;-------------------------------------------------------------------------------        
;	POLY2/POLY  CAPACITOR  DEVICES                                                  
;-------------------------------------------------------------------------------        
;                                                                                       
cp1p2mk = geomInside( cpo1po2 mshield )                                                 
cp1p2pl = geomOverlap( polconn cp1p2mk )                                                
cp1p2sh = geomInside( cp1p2mk geomInside( cp1p2pl nwells ) )                            
cpo1po2 = geomAndNot( cpo1po2 cp1p2sh )                                                 
;                                                                                       
extractDevice(cp1p2sh (polconn "MINUS") (poly2 "PLUS") (nwells "B") "cpo1po2sh3 ivpcell") 
    capaval = measureParameter( area ( cp1p2sh ) 1.151e-15 )                            
    saveParameter( capaval "c" )                                                        
;                                                                                       
extractDevice( cpo1po2 (polconn "MINUS") (poly2 "PLUS") "cpo1po2 ivpcell" )             
    capaval = measureParameter( area ( cpo1po2 ) 1.151e-15 )                            
    saveParameter( capaval "c" )                                                        
;                                                                                       
;-------------------------------------------------------------------------------        
;	POLY/N+ SINKER  CAPACITOR  DEVICES                                              
;-------------------------------------------------------------------------------        
;                                                                                       
extractDevice( cpo1nsk (polconn "MINUS") (nepi "PLUS") "cspo1 ivpcell" )                
    capaval = measureParameter( area ( cpo1nsk ) 1.409e-15 )                            
    saveParameter( capaval "c" )                                                        
;                                                                                       
;-------------------------------------------------------------------------------        
;	POLY2/POLY/N+ SINKER  CAPACITOR  DEVICES                                        
;-------------------------------------------------------------------------------        
;                                                                                       
extractDevice( csand (polconn "MINUS") (nepi "PLUS") "cspo1po2 ivpcell" )               
    area1   = measureParameter( area (csand over active) )                              
    area2   = measureParameter( area (csand over poly2 ) )                              
    capaval = calculateParameter(( area1 * 1.409e-15 ) + ( area2 * 1.151e-15 ))         
    saveParameter( capaval "c" )                                                        
;                                                                                       
;-------------------------------------------------------------------------------        
;	NPN  BIPOLAR  DEVICES                                                           
;-------------------------------------------------------------------------------        
;                                                                                       
n1e     = geomGetTexted( npn "textgds2" "n1e"  )                                        
n1a     = geomGetTexted( npn "textgds2" "n1a"  )                                        
n2e     = geomGetTexted( npn "textgds2" "n2e"  )                                        
n2a     = geomGetTexted( npn "textgds2" "n2a"  )                                        
n4e     = geomGetTexted( npn "textgds2" "n4e"  )                                        
n4a     = geomGetTexted( npn "textgds2" "n4a"  )                                        
n10e    = geomGetTexted( npn "textgds2" "n10e" )                                        
n10a    = geomGetTexted( npn "textgds2" "n10a" )                                        
n18e    = geomGetTexted( npn "textgds2" "n18e" )                                        
n18a    = geomGetTexted( npn "textgds2" "n18a" )                                        
npnc    = geomGetUnTexted( npn "textgds2" "n1e" "n1a" "n2e" "n2a"                       
                           "n4e" "n4a" "n10e" "n10a" "n18e" "n18a" )                    
;                                                                                       
extractDevice( n1e  (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n1a  (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n2e  (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n2a  (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n4e  (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n4a  (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n10e (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n10a (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n18e (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
extractDevice( n18a (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
;                                                                                       
saveProperty( n1e  "ModelName" "N1E"  )                                                 
saveProperty( n1a  "ModelName" "N1A"  )                                                 
saveProperty( n2e  "ModelName" "N2E"  )                                                 
saveProperty( n2a  "ModelName" "N2A"  )                                                 
saveProperty( n4e  "ModelName" "N4E"  )                                                 
saveProperty( n4a  "ModelName" "N4A"  )                                                 
saveProperty( n10e "ModelName" "N10E" )                                                 
saveProperty( n10a "ModelName" "N10A" )                                                 
saveProperty( n18e "ModelName" "N18E" )                                                 
saveProperty( n18a "ModelName" "N18A" )                                                 
saveProperty( n1e  "model"     "N1E"  )                                                 
saveProperty( n1a  "model"     "N1A"  )                                                 
saveProperty( n2e  "model"     "N2E"  )                                                 
saveProperty( n2a  "model"     "N2A"  )                                                 
saveProperty( n4e  "model"     "N4E"  )                                                 
saveProperty( n4a  "model"     "N4A"  )                                                 
saveProperty( n10e "model"     "N10E" )                                                 
saveProperty( n10a "model"     "N10A" )                                                 
saveProperty( n18e "model"     "N18E" )                                                 
saveProperty( n18a "model"     "N18A" )                                                 
;                                                                                       
extractDevice( npnc (polyemc "E") (pdifbas "B") (nepi "C") (subst "SUB") "npn4 ivpcell" ) 
npnc_a  = measureParameter( area npnc 1e-12 )                                           
npnc_p  = measureParameter( perimeter npnc 1e-6 )                                       
saveParameter( npnc_a "a" )                                                             
saveParameter( npnc_p "p" )                                                             
saveProperty( npnc "ModelName" "user" )                                                 
saveProperty( npnc "model"     "user" )                                                 
saveProperty( npnc "maskLayoutViewName" "none" )                                        
saveProperty( npnc "LayoutDescription"  "none" )                                        
;                                                                                       
;-------------------------------------------------------------------------------        
;	VERTICAL  PNP  DEVICES  with  Nepi as Base                                      
;-------------------------------------------------------------------------------        
;                                                                                       
vpnp25  = geomGetTexted( vpnp "textgds2" "PNPBG25EPI" )                                 
vpnpc   = geomGetUnTexted( vpnp "textgds2" "PNPBG25EPI" )                               
;                                                                                       
extractDevice( vpnp25  (pdifsi "E") (nepi "B") (subst "C") "pnpw ivpcell" )             
;                                                                                       
saveProperty( vpnp25 "ModelName" "PNPBG25EPI" )                                         
saveProperty( vpnp25 "model"     "PNPBG25EPI" )                                         
;                                                                                       
extractDevice( vpnpc   (pdifsi "E") (nepi "B") (subst "C") "pnpw ivpcell" )             
vpnpc_a = measureParameter( area vpnpc  1e-12 )                                         
vpnpc_p = measureParameter( perimeter vpnpc  1e-6 )                                     
saveParameter( vpnpc_a "a" )                                                            
saveParameter( vpnpc_p "p" )                                                            
saveProperty( vpnpc  "ModelName" "user" )                                               
saveProperty( vpnpc  "model"     "user" )                                               
saveProperty( vpnpc  "maskLayoutViewName" "none" )                                      
saveProperty( vpnpc  "LayoutDescription"  "none" )                                      
;                                                                                       
;-------------------------------------------------------------------------------        
;	LATERAL  PNP  DEVICES  with  Nepi as Base                                       
;-------------------------------------------------------------------------------        
;                                                                                       
lpnpL1  = geomGetTexted( lpnp "textgds2" "TPL1" )                                       
extractDevice( lpnpL1  (lpnpE "E") (nepi "B") (lpnpC "C") "pnp ivpcell" )               
saveProperty( lpnpL1 "ModelName" "TPL1" )                                               
saveProperty( lpnpL1 "model"     "TPL1" )                                               
;                                                                                       
lpnpL15 = geomGetTexted( lpnp "textgds2" "PL15B" )                                      
extractDevice( lpnpL15 (lpnpE "E") (nepi "B") (lpnpC "C") "pnp ivpcell" )               
saveProperty( lpnpL15 "ModelName" "PL15B" )                                             
saveProperty( lpnpL15 "model"     "PL15B" )                                             
;                                                                                       
;-------------------------------------------------------------------------------       
;	RESISTOR  DEVICES   
;-------------------------------------------------------------------------------       
;  
; Resistor head value is twice counted for the total resistance value and   
; takes into account the following parameters :  
; The resistor due to the interface of salicide to diffused active or poly :  
;   ( x ohm.um  divided by the length of the interface edge ).  
; The resistor due to the area of salicide between the contact till the   
;   interface; an estimation of the length is done, using the min distance   
;   of the siprot to contact ( d=0.5um ).  
;   For P-LDD resistor "d" is equal to 0.6um which is the min distance of               
;   the polyem to contact.                                                              
; The resistor due to the contacts, supposing one line of contacts for each head :  
;   the number of contacts is calculated assuming the fact that one contact is   
;   present every 1.4 um (step for contact). If we substract 1.2 um (min width   
;   for one contact) from the width and divide this by the contact step then add   
;   one for the first contact, we obtain the contacts number.  
;  
; Rhead = Rinterface/Width + (d/Width)*Rsq.sali + Rcontact/(((Width-1.2)/1.4)+1)  
;       =  42/W + 1.15/W + 2.3/(((W-1.2)/1.4)+1) =  43.15/W + 3.22/(W+0.2) for N+ active     
;       =  70/W + 1.05/W + 2.7/(((W-1.2)/1.4)+1) =  71.05/W + 3.78/(W+0.2) for P+ active     
;       =  90/W + 1.15/W + 2.5/(((W-1.2)/1.4)+1) =  91.15/W + 3.50/(W+0.2) for N+ poly       
;       = 145/W + 1.05/W + 2.7/(((W-1.2)/1.4)+1) = 146.05/W + 3.78/(W+0.2) for P+ poly       
;       =  60/W + 1.15/W + 2.5/(((W-1.2)/1.4)+1) =  61.15/W + 3.50/(W+0.2) for N++ polycap   
;       =  80/W + 1.50/W + 2.5/(((W-1.2)/1.4)+1) =  81.50/W + 3.50/(W+0.2) for N+ polyem     
;       =  70/W + 1.26/W + 2.7/(((W-1.2)/1.4)+1) =  71.26/W + 3.78/(W+0.2) for P-LDD         
;       = 106/W + 0.69/W + 2.3/(((W-1.2)/1.4)+1) = 106.69/W + 3.22/(W+0.2) for Nwell resistor 
;  
;                                                                                       
;	SHIELDED POLY RESISTORS RECOGNITION                                             
;	-----------------------------------                                             
;                                                                                       
rnpo1nw = geomInside( geomInside( rnpo1 nwells ) mshield )                              
rnpo1hd = drc( nwells geomGetEdge( rnpo1nw butting polconn ) enc < 1.4 edgeb )          
rnpo1sz = geomSize( rnpo1hd 0.1 )                                                       
rnpo1sh = geomAndNot( rnpo1nw geomButting( rnpo1nw rnpo1sz ) )                          
rnpo1   = geomAndNot( rnpo1 rnpo1sh )                                                   
;                                                                                       
rppo1nw = geomInside( geomInside( rppo1 nwells ) mshield )                              
rppo1hd = drc( nwells geomGetEdge( rppo1nw butting polconn ) enc < 1.4 edgeb )          
rppo1sz = geomSize( rppo1hd 0.1 )                                                       
rppo1sh = geomAndNot( rppo1nw geomButting( rppo1nw rppo1sz ) )                          
rppo1   = geomAndNot( rppo1 rppo1sh )                                                   
;                                                                                       
rpocpnw = geomInside( geomInside( rpocap nwells ) mshield )                             
rpocphd = drc( nwells geomGetEdge( rpocpnw butting polconn ) enc < 1.4 edgeb )          
rpocpsz = geomSize( rpocphd 0.1 )                                                       
rpocpsh = geomAndNot( rpocpnw geomButting( rpocpnw rpocpsz ) )                          
rpocap  = geomAndNot( rpocap rpocpsh )                                                  
;                                                                                       
rnpo3nw = geomInside( geomInside( rnpo3 nwells ) mshield )                              
rnpo3hd = drc( nwells geomGetEdge( rnpo3nw butting polyemc ) enc < 1.4 edgeb )          
rnpo3sz = geomSize( rnpo3hd 0.1 )                                                       
rnpo3sh = geomAndNot( rnpo3nw geomButting( rnpo3nw rnpo3sz ) )                          
rnpo3   = geomAndNot( rnpo3 rnpo3sh )                                                   
;                                                                                       
;                                                                                       
;       NWELL RESISTOR DEVICES  
;       ----------------------  
;  
extractDevice( resnw ndifsi("PLUS" "MINUS") "rnw ivpcell" physical)  
area    = measureParameter( area (resnw) 1e-12 )  
width   = measureParameter( length (resnw butting rnwellt) 0.5e-6 )  
widtht  = measureParameter( length (resnw butting ndifsi) 0.5e-6 )  
widthw  = calculateParameter( width - 0.984e-6 )                                        
length  = calculateParameter( area / width )  
resist = calculateParameter((((length+0.293e-6)/widthw)*1150)+ 2*( 43.35e-6/widtht +3.22e-6/(widtht+0.2e-6))) 
saveParameter(resist "r")  
saveParameter(width "w")  
;  
extractDevice( resnwm ndifsi("PLUS" "MINUS") "rnw ivpcell" physical )  
area    = measureParameter( area (resnwm) 1e-12 )  
width   = measureParameter( length (resnwm butting rnwellt) 0.5e-6 )  
widtht  = measureParameter( length (resnwm butting ndifsi) 0.5e-6 )  
widthw  = calculateParameter( width - 0.0e-6 )  
nr_bendf = measureParameter( bends_full ( resnwm inside mres ))  
nr_bendp = measureParameter( bends_part ( resnwm inside mres ))  
length  = calculateParameter((area / width) - width * ( 0.5 * nr_bendf + 0.25 * nr_bendp ))  
resist = calculateParameter((((length-0.147e-6)/widthw)*1300)+ 2*( 62.90e-6/widtht +3.50e-6/(widtht+0.2e-6))) 
saveParameter(resist "r")  
saveParameter(width "w")  
;  
;	N+ ACTIVE RESISTOR DEVICES  
;	--------------------------  
;  
extractDevice( resnp ndifsi("PLUS" "MINUS") (pwells "B") "rndiff3 ivpcell" )            
area     = measureParameter( area (resnp) 1e-12 )  
width    = measureParameter( length (resnp butting ndifsi) 0.5e-6 )  
widthw   = calculateParameter( width + 0.32e-6 )                                        
nr_bendf = measureParameter( bends_full ( resnp coincident active ) )   
nr_bendp = measureParameter( bends_part ( resnp coincident active ) )  
length   = calculateParameter((area / width) - width * ( 0.5 * nr_bendf + 0.25 * nr_bendp ))  
resist   = calculateParameter(((length/widthw)*46)+ 2*( 43.15e-6/widthw +3.22e-6/(width+0.2e-6))) 
saveParameter( resist "r" )  
saveParameter( width "w" )  
;  
extractDevice( resnpm ndifsi("PLUS" "MINUS") (pwells "B") "rndiff3 ivpcell" )           
area     = measureParameter( area (resnpm) 1e-12 )  
width    = measureParameter( length (resnpm butting ndifsi) 0.5e-6 )  
widthw   = calculateParameter( width + 0.147e-6 )  
nr_bendf = measureParameter( bends_full ( resnpm coincident active ) )  
nr_bendp = measureParameter( bends_part ( resnpm coincident active ) )  
length   = calculateParameter((area / width) - width * ( 0.5 * nr_bendf + 0.25 * nr_bendp ))  
resist   = calculateParameter(((length/widthw)*49)+ 2*( 41.15e-6/widthw +3.50e-6/(width+0.2e-6))) 
saveParameter( resist "r" )  
saveParameter( width "w" )  
;  
;	P+ ACTIVE RESISTOR DEVICES  
;	--------------------------  
;  
extractDevice( respp pdifsi("PLUS" "MINUS") (nwells "B") "rpdiff3 ivpcell" )            
area     = measureParameter( area (respp) 1e-12 )  
width    = measureParameter( length (respp butting pdifsi) 0.5e-6 )  
widthw   = calculateParameter( width + 0.32e-6 )                                        
pr_bendf = measureParameter( bends_full ( respp coincident active ) )  
pr_bendp = measureParameter( bends_part ( respp coincident active ) )  
length   = calculateParameter((area / width) - width * ( 0.5 * pr_bendf + 0.25 * pr_bendp ))  
resist   = calculateParameter(((length/widthw)*56)+ 2*( 71.05e-6/widthw +3.78e-6/(width+0.2e-6))) 
saveParameter( resist "r" )  
saveParameter( width "w" )  
;  
;  
;	P-LDD RESISTOR DEVICES                                                          
;	----------------------                                                          
;                                                                                       
extractDevice( rpldd pdifsi("PLUS" "MINUS") (nwells "B") "rpldd3 ivpcell" )             
area     = measureParameter( area (rpldd) 1e-12 )                                       
width    = measureParameter( length (rpldd butting pdifsi) 0.5e-6 )                     
widthw   = calculateParameter( width - 0.00e-6 )                                        
pr_bendf = measureParameter( bends_full ( rpldd coincident active ) )                   
pr_bendp = measureParameter( bends_part ( rpldd coincident active ) )                   
length   = calculateParameter((area / width) - width * ( 0.5 * pr_bendf + 0.25 * pr_bendp )) 
resist   = calculateParameter(((length/widthw)*2500)+(2*((71.26e-6/widthw)+3.78e-6/(width+0.2e-6)))) 
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
;                                                                                       
;	N+ POLY RESISTOR DEVICES  
;	------------------------  
;  
extractDevice( rnpo1 polconn("PLUS" "MINUS") "rpo1 ivpcell" )  
area     = measureParameter( area (rnpo1) 1e-12 )  
width    = measureParameter( length (rnpo1 butting polconn) 0.5e-6 )  
widthw   = calculateParameter( width - 0.06e-6 )                                        
po_bendf = measureParameter( bends_full ( rnpo1 coincident poly ) )    
po_bendp = measureParameter( bends_part ( rnpo1 coincident poly ) )   
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))   
resist   = calculateParameter(((length/widthw)*135)+(2*((91.15e-6/widthw)+3.50e-6/(width+0.2e-6))))  
saveParameter( resist "r" )  
saveParameter( width "w" )  
;  
extractDevice( rnpo1sh polconn("PLUS" "MINUS") (nwells "B") "rpo1sh3 ivpcell" )         
area     = measureParameter( area (rnpo1sh) 1e-12 )                                     
width    = measureParameter( length (rnpo1sh butting polconn) 0.5e-6 )                  
widthw   = calculateParameter( width - 0.06e-6 )                                        
po_bendf = measureParameter( bends_full ( rnpo1sh coincident poly ) )                   
po_bendp = measureParameter( bends_part ( rnpo1sh coincident poly ) )                   
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))         
resist   = calculateParameter(((length/widthw)*135)+(2*((91.15e-6/widthw)+3.50e-6/(width+0.2e-6))))  
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
;  
;       P+ POLY RESISTOR DEVICES  
;       ------------------------  
;  
extractDevice( rppo1 polconn("PLUS" "MINUS") "rpo1p ivpcell" )  
area     = measureParameter( area (rppo1) 1e-12 )  
width    = measureParameter( length (rppo1 butting polconn) 0.5e-6 )  
widthw   = calculateParameter( width - 0.06e-6 )                                        
po_bendf = measureParameter( bends_full ( rppo1 coincident poly ) )  
po_bendp = measureParameter( bends_part ( rppo1 coincident poly ) )  
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))  
resist   = calculateParameter(((length/widthw)*86 )+ 2*((146.05e-6/widthw)+3.78e-6/(width+0.2e-6))) 
saveParameter( resist "r" )  
saveParameter( width "w" )  
;  
extractDevice( rppo1sh polconn("PLUS" "MINUS") (nwells "B") "rpo1psh3 ivpcell" )        
area     = measureParameter( area (rppo1sh) 1e-12 )                                     
width    = measureParameter( length (rppo1sh butting polconn) 0.5e-6 )                  
widthw   = calculateParameter( width - 0.06e-6 )                                        
po_bendf = measureParameter( bends_full ( rppo1sh coincident poly ) )                   
po_bendp = measureParameter( bends_part ( rppo1sh coincident poly ) )                   
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))         
resist   = calculateParameter(((length/widthw)*86)+(2*((146.05e-6/widthw)+3.78e-6/(width+0.2e-6))))  
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
;                                                                                       
;       HIPO  RESISTOR DEVICES                                                          
;       ----------------------                                                          
;                                                                                       
extractDevice( rhipo polconn("PLUS" "MINUS") "rhipo ivpcell" )                          
area1    = measureParameter( area (rhipo not_over pplus) 1e-12 )                        
len1     = measureParameter( length (rhipo outside pplus) 0.5e-6 )                      
wid1     = calculateParameter( area1 / len1 )                                           
w1c      = calculateParameter( wid1 + 0.086e-6 )                                        
bendf    = measureParameter( bends_full ( rhipo coincident poly ) )                     
bendp    = measureParameter( bends_part ( rhipo coincident poly ) )                     
l1c      = calculateParameter( len1 - 0.94e-6 - wid1 * ( 0.5*bendf + 0.25*bendp ))      
ln2      = measureParameter( length ( rhipo over pplus ) 0.5e-6 )                       
len2     = calculateParameter( ln2 - wid1 + 0.94e-6 )                                   
wd2c     = calculateParameter( wid1 + 0.086e-6 )                                        
resist   = calculateParameter( (l1c/w1c)*1000 + (len2/wd2c)*97.3 +(2*((145e-6/w1c)+3.40e-6/(wid1+0.2e-6)))) 
saveParameter( resist "r" )                                                             
saveParameter( wid1 "w" )                                                               
;                                                                                       
;	N++ POLY-CAP RESISTOR DEVICES                                                   
;	-----------------------------                                                   
;                                                                                       
extractDevice( rpocap polconn("PLUS" "MINUS") "rpocap ivpcell" )                        
area     = measureParameter( area (rpocap) 1e-12 )                                      
width    = measureParameter( length (rpocap butting polconn) 0.5e-6 )                   
widthw   = calculateParameter( width - 0.00e-6 )                                        
po_bendf = measureParameter( bends_full ( rpocap coincident poly ) )                    
po_bendp = measureParameter( bends_part ( rpocap coincident poly ) )                    
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))       
resist   = calculateParameter(((length/widthw)*34)+(2*((61.15e-6/widthw)+3.50e-6/(width+0.2e-6)))) 
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
extractDevice( rpocpsh polconn("PLUS" "MINUS") (nwells "B") "rpocapsh3 ivpcell" )       
area     = measureParameter( area (rpocpsh) 1e-12 )                                     
width    = measureParameter( length (rpocpsh butting polconn) 0.5e-6 )                  
widthw   = calculateParameter( width - 0.00e-6 )                                        
po_bendf = measureParameter( bends_full ( rpocpsh coincident poly ) )                   
po_bendp = measureParameter( bends_part ( rpocpsh coincident poly ) )                   
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))       
resist   = calculateParameter(((length/widthw)*34)+(2*((61.15e-6/widthw)+3.50e-6/(width+0.2e-6)))) 
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
;                                                                                       
;       N+ POLYEM RESISTOR DEVICES                                                      
;       --------------------------                                                      
;                                                                                       
extractDevice( rnpo3 polyemc("PLUS" "MINUS") "rpo3 ivpcell" )                           
area     = measureParameter( area (rnpo3) 1e-12 )                                       
width    = measureParameter( length (rnpo3 butting polyemc) 0.5e-6 )                    
widthw   = calculateParameter( width - 0.00e-6 )                                        
po_bendf = measureParameter( bends_full ( rnpo3 coincident polyem ) )                   
po_bendp = measureParameter( bends_part ( rnpo3 coincident polyem ) )                   
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))        
resist   = calculateParameter(((length/widthw)*100)+(2*((81.50e-6/widthw)+3.50e-6/(width+0.2e-6)))) 
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
extractDevice( rnpo3sh polyemc("PLUS" "MINUS") (nwells "B") "rpo3sh3 ivpcell" )         
area     = measureParameter( area (rnpo3sh) 1e-12 )                                     
width    = measureParameter( length (rnpo3sh butting polyemc) 0.5e-6 )                  
widthw   = calculateParameter( width - 0.00e-6 )                                        
po_bendf = measureParameter( bends_full ( rnpo3sh coincident polyem ) )                 
po_bendp = measureParameter( bends_part ( rnpo3sh coincident polyem ) )                 
length   = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ))        
resist   = calculateParameter(((length/widthw)*100)+(2*((81.50e-6/widthw)+3.50e-6/(width+0.2e-6)))) 
saveParameter( resist "r" )                                                             
saveParameter( width "w" )                                                              
;                                                                                       
;-------------------------------------------------------------------------------       
;	DIODE  DEVICES   
;-------------------------------------------------------------------------------       
;  
 ivIf( !switch( "diodno" ) then  
;  
  ivIf( !switch( "diodm" ) then     
;  
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
;  
;  
;	P+/NWELL DIODE DEVICES   
;	----------------------  
;  
extractDevice( diodep dpter("PLUS") nwells("MINUS") "dp ivpcell" )  
    dioparea = measureParameter( area ( diodep ) 1e-12 )  
    diopperi = measureParameter( perimeter ( diodep ) 1e-6 )  
    saveParameter( dioparea "area" )  
    saveParameter( diopperi "peri" )  
    saveRecognition( diodep "instance" )  
    saveDerived( diodep ( "pplus" "drawing" ) ext_view )  
;  
;  
;	N+/PWELL DIODE DEVICES   
;	----------------------  
;  
extractDevice( dioden pwells("PLUS") dnter("MINUS") "dn ivpcell" )  
    dionarea = measureParameter( area ( dioden ) 1e-12 )  
    dionperi = measureParameter( perimeter ( dioden ) 1e-6 )  
    saveParameter( dionarea "area" )  
    saveParameter( dionperi "peri" )  
    saveRecognition( dioden "instance" )  
    saveDerived( dioden ( "mdiode" "drawing" ) ext_view )  
;  
;start epidio                                                                           
;                                                                                       
;       MARKED P+/N-EPI DIODE DEVICES                                                   
;       -----------------------------                                                   
;                                                                                       
;extractDevice( dpnepi dpnepit("PLUS") nepi("MINUS") "dp ivpcell" )                     
;    depiarea = measureParameter( area ( dpnepi ) 1e-12 )                               
;    depiperi = measureParameter( perimeter ( dpnepi ) 1e-6 )                           
;    saveParameter( depiarea "area" )                                                   
;    saveParameter( depiperi "peri" )                                                   
;    saveRecognition( dpnepi "instance" )                                               
;    saveDerived( dpnepi ( "pplus" "drawing" ) ext_view )                               
;                                                                                       
;end epidio                                                                             
   else                                  ; IF "diodm" SWITCH INVOKED  
;  
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
;  
;  
;	MARKED P+/NWELL DIODE DEVICES   
;	-----------------------------  
;  
extractDevice( mdiodep mdpter("PLUS") nwells("MINUS") "dp ivpcell" )  
    dioparea = measureParameter( area ( mdiodep ) 1e-12 )  
    diopperi = measureParameter( perimeter ( mdiodep ) 1e-6 )  
    saveParameter( dioparea "area" )  
    saveParameter( diopperi "peri" )  
    saveRecognition( mdiodep "instance" )  
    saveDerived( mdiodep ( "pplus" "drawing" ) ext_view )  
;  
;  
;	MARKED N+/PWELL DIODE DEVICES   
;	-----------------------------  
;   
extractDevice( mdioden pwells("PLUS") mdnter("MINUS") "dn ivpcell" )  
    dionarea = measureParameter( area ( mdioden ) 1e-12 )  
    dionperi = measureParameter( perimeter ( mdioden ) 1e-6 )  
    saveParameter( dionarea "area" )  
    saveParameter( dionperi "peri" )  
    saveRecognition( mdioden "instance" )  
    saveDerived( mdioden ( "mdiode" "drawing" ) ext_view )  
;  
;start epidio                                                                           
;                                                                                       
;       MARKED P+/N-EPI DIODE DEVICES                                                   
;       -----------------------------                                                   
;                                                                                       
;extractDevice( dpnepi dpnepit("PLUS") nepi("MINUS") "dp ivpcell" )                     
;    depiarea = measureParameter( area ( dpnepi ) 1e-12 )                               
;    depiperi = measureParameter( perimeter ( dpnepi ) 1e-6 )                           
;    saveParameter( depiarea "area" )                                                   
;    saveParameter( depiperi "peri" )                                                   
;    saveRecognition( dpnepi "instance" )                                               
;    saveDerived( dpnepi ( "pplus" "drawing" ) ext_view )                               
;                                                                                       
;end epidio                                                                             
  )  
 )  
;  
;  
;-------------------------------------------------------------------------------        
;       POLY  SHORTS  DEVICES                                                           
;-------------------------------------------------------------------------------        
;                                                                                       
extractDevice( shpo1 polconn("PLUS" "MINUS") "short ivpcell" )                          
;                                                                                       
;-------------------------------------------------------------------------------        
;       METAL  1 - 2 - 3  SHORTS  DEVICES                                               
;-------------------------------------------------------------------------------        
;                                                                                       
extractDevice( shm1 metal1("PLUS" "MINUS") "short ivpcell" )                            
extractDevice( shm2 metal2("PLUS" "MINUS") "short ivpcell" )                            
extractDevice( shm3 metal3("PLUS" "MINUS") "short ivpcell" )                            
;                                                                                       
;-------------------------------------------------------------------------------       
;	GRAPHICS  DATABASE  OUTPUT  
;-------------------------------------------------------------------------------       
;  
;  
    saveInterconnect( metal3 )  
    saveInterconnect( metal2 )  
    saveInterconnect( metal1 )  
    saveInterconnect( poly2  )                                                   
    saveInterconnect( nburied )                                                  
    saveInterconnect( nepi )                                                     
    saveInterconnect(( sali    "active"  )  
                     ( polconn "poly"    )  
                     ( polyemc "polyem"  )                                       
                     ( ndifsi  "nplus"   )  
                     ( pdifsi  "pplus"   )  
                     ( dpter   "pplus"   )  
                     ( dnter   "nplus"   )  
                     ( nstrap  "nplus"   )                                         
                     ( pstrap  "pplus"   )                                         
                     ( vi2     "v2"      )  
                     ( via     "v1"      )  
                     ( polyct  "contact" )  
                     ( poly2ct "contact" )                                       
                     ( polemct "contact" )                                       
                     ( pdifbas "pminus"  )                                       
                     ( actct   "contact" )  
                     ( nwells  "nwell"   ))  
  
;  
    saveDerived( ngate   ( "active" "drawing" ) ext_view )                       
    saveDerived( pgate   ( "active" "drawing" ) ext_view )                       
    saveDerived( n1e     ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n1a     ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n2e     ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n2a     ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n4e     ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n4a     ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n10e    ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n10a    ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n18e    ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( n18a    ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( npnc    ( "emcut"  "drawing" ) ext_view )                       
    saveDerived( vpnp25  ( "pplus"  "drawing" ) ext_view )                       
    saveDerived( vpnpc   ( "pplus"  "drawing" ) ext_view )                       
    saveDerived( lpnpL1  ( "pplus"  "drawing" ) ext_view )                       
    saveDerived( lpnpL15 ( "pplus"  "drawing" ) ext_view )                       
    saveDerived( resnwm  ( "mres"   "drawing" ) ext_view )  
    saveDerived( resnw   ( "mres"   "drawing" ) ext_view )  
    saveDerived( resnp   ( "mres"   "drawing" ) ext_view )                  
    saveDerived( resnpm  ( "mres"   "drawing" ) ext_view )                  
    saveDerived( respp   ( "mres"   "drawing" ) ext_view )  
    saveDerived( rpldd   ( "mres"   "drawing" ) ext_view )                       
    saveDerived( rnpo1   ( "poly"   "drawing" ) ext_view )  
    saveDerived( rppo1   ( "poly"   "drawing" ) ext_view )  
    saveDerived( rhipo   ( "presist" "drawing" ) ext_view )                      
    saveDerived( rpocap  ( "cap"    "drawing" ) ext_view )                       
    saveDerived( cpo1po2 ( "poly2"  "drawing" ) ext_view )                       
    saveDerived( rnpo1sh ( "poly"   "drawing" ) ext_view )                       
    saveDerived( rppo1sh ( "poly"   "drawing" ) ext_view )                       
    saveDerived( rpocpsh ( "cap"    "drawing" ) ext_view )                       
    saveDerived( cp1p2sh ( "poly2"  "drawing" ) ext_view )                       
    saveDerived( rnpo3   ( "polyem" "drawing" ) ext_view )                       
    saveDerived( rnpo3sh ( "polyem" "drawing" ) ext_view )                       
    saveDerived( cpo1nsk ( "poly"   "drawing" ) ext_view )                       
    saveDerived( csand   ( "poly2"  "drawing" ) ext_view )                       
;  
;  
    saveRecognition( ngate   "instance" )                                        
    saveRecognition( pgate   "instance" )                                        
    saveRecognition( n1e     "instance" )                                        
    saveRecognition( n1a     "instance" )                                        
    saveRecognition( n2e     "instance" )                                        
    saveRecognition( n2a     "instance" )                                        
    saveRecognition( n4e     "instance" )                                        
    saveRecognition( n4a     "instance" )                                        
    saveRecognition( n10e    "instance" )                                        
    saveRecognition( n10a    "instance" )                                        
    saveRecognition( n18e    "instance" )                                        
    saveRecognition( n18a    "instance" )                                        
    saveRecognition( npnc    "instance" )                                        
    saveRecognition( vpnp25  "instance" )                                        
    saveRecognition( vpnpc   "instance" )                                        
    saveRecognition( lpnpL1  "instance" )                                        
    saveRecognition( lpnpL15 "instance" )                                        
    saveRecognition( resnwm  "instance" )  
    saveRecognition( resnw   "instance" )  
    saveRecognition( resnp   "instance" )  
    saveRecognition( resnpm  "instance" )  
    saveRecognition( respp   "instance" )  
    saveRecognition( rpldd   "instance" )                                        
    saveRecognition( rnpo1   "instance" )  
    saveRecognition( rppo1   "instance" )  
    saveRecognition( rhipo   "instance" )                                        
    saveRecognition( rpocap  "instance" )                                        
    saveRecognition( cpo1po2 "instance" )                                        
    saveRecognition( rnpo1sh "instance" )                                        
    saveRecognition( rppo1sh "instance" )                                        
    saveRecognition( rpocpsh "instance" )                                        
    saveRecognition( cp1p2sh "instance" )                                        
    saveRecognition( rnpo3   "instance" )                                        
    saveRecognition( rnpo3sh "instance" )                                        
    saveRecognition( cpo1nsk "instance" )                                        
    saveRecognition( csand   "instance" )                                        
    saveRecognition( shpo1   "instance" )                                        
    saveRecognition( shm1    "instance" )                                        
    saveRecognition( shm2    "instance" )                                        
    saveRecognition( shm3    "instance" )                                        
;  
;  
    copyGraphics( ("msub"      "drawing") )  
    copyGraphics( ("pin"       "drawing") )  
    copyGraphics( ("polytext"  "drawing") )  
    copyGraphics( ("m1text"    "drawing") )  
    copyGraphics( ("m2text"    "drawing") )  
    copyGraphics( ("m3text"    "drawing") )  
    copyGraphics( ("m1pintext" "drawing") )  
    copyGraphics( ("m2pintext" "drawing") )  
    copyGraphics( ("m3pintext" "drawing") )  
;  
;  
 )                                                       ; END OF THE EXTRACT SECTION  
;  
;  
;*******************************************************************************  
;**********                                                           **********  
;**********		EXTRACT  PARASITIC  CAPACITANCE               **********  
;**********                                                           **********  
;*******************************************************************************  
;  
 ivIf( ( switch("extract?") && switch("LPE_pair") ) then                         
;                                                        ; BEGINNING OF THE "pair" SECTION  
;  
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
;  
;  
;-------------------------------------------------------------------------------    
;  
;		ATTACH  D-S  CAPACITANCES  ON  MOS  COMPONENTS    
;       	----------------------------------------------  
;  
;  
;	NMOS capa drain-source   
;	----------------------  
;  
  a = measureParasitic( area ( ndifsi ) 1e-12 figure )  
  attachParasitic( a ("as" "S") ("ad" "D") ngate shared )                        
  b = measureParasitic( length ( ndifsi outside poly ) 1e-06 figure )  
  attachParasitic( b ("ps" "S") ("pd" "D") ngate shared )                        
;  
;  
;	PMOS capa drain-source   
;	----------------------  
;   
  c = measureParasitic( area ( pdifsi ) 1e-12 figure )  
  attachParasitic( c ("as" "S") ("ad" "D") pgate shared )                        
  d = measureParasitic( length ( pdifsi outside poly ) 1e-06 figure )  
  attachParasitic( d ("ps" "S") ("pd" "D") pgate shared )                        
;  
;  
;-------------------------------------------------------------------------------    
;  
;		EXTRACT  PARASITIC  CAPACITANCES  by  NODE - PAIR   
;		-------------------------------------------------  
;  
;  
;  Crossing capacitances, including area and side capacitances, are calculated  
;  and referenced between two nodes                                             
;  
;  Coupling capacitances are calculated between 2 adjacents conductors with    
;       minimum =<  spacing  =<  2.5 * minimum                                  
;  
;  Maximum value are used ( worst case )                                       
;  
;  
;-------------------------------------------------------------------------------    
;			Preliminary derived layers    
;-------------------------------------------------------------------------------    
;  
poloract   = geomOr( poly     active )  
m1opoa     = geomOr( metal1   poloract )  
met2or1    = geomOr( metal2   metal1 )  
m2o1opoa   = geomOr( met2or1  poloract )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   poly - nwellfield   
;-------------------------------------------------------------------------------    
;  
 Ppolynwell  = measureParasitic( area ( polconn over nwells not_over active)   
  7.28e-17 two_net  
                               )  
 Sapolynwell = measureParasitic( length ( polconn inside nwells not_over  
  active ) two_net)  
 Sbpolynwell = measureParasitic( length ( polconn butting nwells not_over  
  active ) two_net)  
 Spolynwell  = calculateParasitic( ( Sapolynwell + Sbpolynwell ) * 4.68e-17 )   
 Cpolynwell  = calculateParasitic( Ppolynwell + Spolynwell )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   poly - pwellfield  
;-------------------------------------------------------------------------------    
;  
 Ppolypwell  = measureParasitic( area ( polconn over pwells not_over active)   
  7.28e-17 two_net        
                               )  
 Sapolypwell = measureParasitic( length ( polconn inside pwells not_over active )  
  two_net)  
 Sbpolypwell = measureParasitic( length ( polconn butting pwells not_over   
  active ) two_net)  
 Spolypwell  = calculateParasitic( ( Sapolypwell + Sbpolypwell ) * 4.68e-17 )   
 Cpolypwell  = calculateParasitic( Ppolypwell + Spolypwell )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   poly - metal1     
;-------------------------------------------------------------------------------    
;  
 PpolyMET1   = measureParasitic( area ( polconn over metal1 not_over poly2)      
   two_net )                                                                     
 S0apolyMET1 = measureParasitic( length ( polconn inside metal1 ) two_net )  
 S0bpolyMET1 = measureParasitic( length ( polconn butting metal1 ) two_net )  
 S0polyMET1  = calculateParasitic( S0apolyMET1 + S0bpolyMET1 )  
 S1apolyMET1 = measureParasitic( length ( metal1 inside polconn not_over poly2)  
   two_net )                                                                     
 S1bpolyMET1 = measureParasitic( length ( metal1 butting polconn ) two_net )  
 S1polyMET1  = calculateParasitic( S1apolyMET1 + S1bpolyMET1 )  
 CPpolyMET1  = calculateParasitic( PpolyMET1  * 4.13e-17 )                           
 CS0polyMET1 = calculateParasitic( S0polyMET1 * 4.78e-17 )                       
 CS1polyMET1 = calculateParasitic( S1polyMET1 * 4.78e-17 )                       
 CpolyMET1   = calculateParasitic( CPpolyMET1 + CS0polyMET1 + CS1polyMET1 )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   poly - metal2   
;-------------------------------------------------------------------------------    
;  
; No capacitance when poly - (metal1) - metal2    
;  
 PpolyMET2   = measureParasitic( area ( polconn over metal2 not_over poly2       
  not_over metal1 ) two_net )                                                    
 S0apolyMET2 = measureParasitic( length ( polconn inside metal2 not_over   
  metal1 ) two_net)  
 S0bpolyMET2 = measureParasitic( length ( polconn butting metal2 not_over   
  metal1 ) two_net)  
 S0polyMET2  = calculateParasitic( S0apolyMET2 + S0bpolyMET2 )  
 S1apolyMET2 = measureParasitic( length ( metal2 inside polconn not_over poly2   
  not_over metal1 ) two_net )                                                    
 S1bpolyMET2 = measureParasitic( length ( metal2 butting polconn not_over   
  metal1 ) two_net )  
 S1polyMET2  = calculateParasitic( S1apolyMET2 + S1bpolyMET2 )  
 CPpolyMET2  = calculateParasitic( PpolyMET2  * 1.75e-17 )                        
 CS0polyMET2 = calculateParasitic( S0polyMET2 * 4.01e-17 )                       
 CS1polyMET2 = calculateParasitic( S1polyMET2 * 4.01e-17 )                       
 CpolyMET2   = calculateParasitic( CPpolyMET2 + CS0polyMET2 + CS1polyMET2 )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   poly - metal3   
;-------------------------------------------------------------------------------    
;  
; No capacitance when poly - (metal1 or metal2) - metal3   
;  
 PpolyMET3   = measureParasitic( area ( polconn over metal3 not_over poly2       
  not_over met2or1 ) two_net )                                                   
 S0apolyMET3 = measureParasitic( length ( polconn inside metal3 not_over   
  met2or1) two_net)  
 S0bpolyMET3 = measureParasitic( length ( polconn butting metal3 not_over   
  met2or1) two_net)  
 S0polyMET3  = calculateParasitic( S0apolyMET3 + S0bpolyMET3 )  
 S1apolyMET3 = measureParasitic( length ( metal3 inside polconn not_over poly2   
  not_over met2or1 ) two_net)                                                    
 S1bpolyMET3 = measureParasitic( length ( metal3 butting polconn not_over   
  met2or1) two_net)  
 S1polyMET3  = calculateParasitic( S1apolyMET3 + S1bpolyMET3 )  
 CPpolyMET3  = calculateParasitic( PpolyMET3  * 1.09e-17 )                         
 CS0polyMET3 = calculateParasitic( S0polyMET3 * 3.89e-17 )                       
 CS1polyMET3 = calculateParasitic( S1polyMET3 * 3.89e-17 )                       
 CpolyMET3   = calculateParasitic( CPpolyMET3 + CS0polyMET3 + CS1polyMET3 )  
;  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    
;  
    CAPApoly = calculateParasitic(  
                 Cpolynwell + Cpolypwell + CpolyMET1 + CpolyMET2 + CpolyMET3  
                                 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal1 - dnplus   
;-------------------------------------------------------------------------------    
;  
 PMET1dnplus  = measureParasitic( area ( metal1 over ndifsi ) 2.95e-17 two_net )   
 SaMET1dnplus = measureParasitic( length ( metal1 inside ndifsi ) two_net )  
 SbMET1dnplus = measureParasitic( length ( metal1 butting ndifsi ) two_net )  
 SMET1dnplus  = calculateParasitic(( SaMET1dnplus + SbMET1dnplus ) * 4.38e-17)   
 CMET1dnplus  = calculateParasitic( PMET1dnplus + SMET1dnplus )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal1 - dpplus    
;-------------------------------------------------------------------------------    
;  
 PMET1dpplus  = measureParasitic( area ( metal1 over pdifsi ) 2.95e-17 two_net )   
 SaMET1dpplus = measureParasitic( length ( metal1 inside pdifsi ) two_net )  
 SbMET1dpplus = measureParasitic( length ( metal1 butting pdifsi ) two_net )  
 SMET1dpplus  = calculateParasitic(( SaMET1dpplus + SbMET1dpplus ) * 4.38e-17)   
 CMET1dpplus  = calculateParasitic( PMET1dpplus + SMET1dpplus )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal1 - nwellfield  
;-------------------------------------------------------------------------------    
;  
; No capacitance when nwellfield - (poly) - metal1           
;  
 PMET1nwell  = measureParasitic( area ( metal1 over nwells not_over poloract)   
  2.54e-17 two_net                                                                
                              )  
 SaMET1nwell = measureParasitic( length ( metal1 inside nwells not_over   
  poloract ) two_net )  
 SbMET1nwell = measureParasitic( length ( metal1 butting nwells not_over   
  poloract ) two_net )  
 SMET1nwell  = calculateParasitic( ( SaMET1nwell + SbMET1nwell ) * 4.22e-17 )    
 CMET1nwell  = calculateParasitic( PMET1nwell + SMET1nwell )  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal1 - pwellfield  
;-------------------------------------------------------------------------------    
;  
; No capacitance when pwellfield - (poly) - metal1             
;  
 PMET1pwell  = measureParasitic( area ( metal1 over pwells not_over poloract)   
  2.54e-17 two_net                                                                 
                              )  
 SaMET1pwell = measureParasitic( length ( metal1 inside pwells not_over   
  poloract ) two_net )  
 SbMET1pwell = measureParasitic( length ( metal1 butting pwells not_over   
  poloract ) two_net )  
 SMET1pwell  = calculateParasitic( ( SaMET1pwell + SbMET1pwell ) * 4.22e-17 )    
 CMET1pwell  = calculateParasitic( PMET1pwell + SMET1pwell )  
;   
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CAPAMET1 = calculateParasitic( CMET1dnplus + CMET1dpplus +   
                                   CMET1nwell + CMET1pwell )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   
;   
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal1 - metal2  
;-------------------------------------------------------------------------------    
;  
 PMET1MET2   = measureParasitic( area ( metal1 over metal2 ) two_net )  
 S0aMET1MET2 = measureParasitic( length ( metal1 inside metal2 ) two_net )  
 S0bMET1MET2 = measureParasitic( length ( metal1 butting metal2 ) two_net )  
 S0MET1MET2  = calculateParasitic( S0aMET1MET2 + S0bMET1MET2 )  
 S1aMET1MET2 = measureParasitic( length ( metal2 inside metal1 ) two_net )  
 S1bMET1MET2 = measureParasitic( length ( metal2 butting metal1 ) two_net )  
 S1MET1MET2  = calculateParasitic( S1aMET1MET2 + S1bMET1MET2 )  
 CPMET1MET2  = calculateParasitic( PMET1MET2   * 4.80e-17 )                      
 CS0MET1MET2 = calculateParasitic( S0MET1MET2 * 5.23e-17 )                       
 CS1MET1MET2 = calculateParasitic( S1MET1MET2 * 5.23e-17 )                       
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CMET1MET2 = calculateParasitic( CPMET1MET2 + CS0MET1MET2 + CS1MET1MET2 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal1 - metal3         
;-------------------------------------------------------------------------------    
;  
; No capacitance when metal1 - (metal2) - metal3              
;  
 PMET1MET3   = measureParasitic( area ( metal1 over metal3 not_over metal2 )   
  two_net )  
 S0aMET1MET3 = measureParasitic( length ( metal1 inside metal3 not_over   
  metal2 ) two_net )  
 S0bMET1MET3 = measureParasitic( length ( metal1 butting metal3 not_over   
  metal2 ) two_net)  
 S0MET1MET3  = calculateParasitic( S0aMET1MET3 + S0bMET1MET3 )  
 S1aMET1MET3 = measureParasitic( length ( metal3 inside metal1 not_over   
  metal2 ) two_net )  
 S1bMET1MET3 = measureParasitic( length ( metal3 butting metal1 not_over   
  metal2 ) two_net)  
 S1MET1MET3  = calculateParasitic( S1aMET1MET3 + S1bMET1MET3 )  
 CPMET1MET3  = calculateParasitic( PMET1MET3   * 1.81e-17 )                      
 CS0MET1MET3 = calculateParasitic( S0MET1MET3 * 4.42e-17 )                       
 CS1MET1MET3 = calculateParasitic( S1MET1MET3 * 4.42e-17 )                       
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CMET1MET3 = calculateParasitic( CPMET1MET3 + CS0MET1MET3 + CS1MET1MET3 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal2 - dnplus  
;-------------------------------------------------------------------------------    
;  
; No capacitance when dnplus - (metal1) - metal2              
;  
 PMET2dnplus  = measureParasitic( area ( metal2 over ndifsi not_over metal1 )   
  1.49e-17 two_net                                                                
                               )  
 SaMET2dnplus = measureParasitic( length ( metal2 inside ndifsi not_over  
  metal1 ) two_net )   
 SbMET2dnplus = measureParasitic( length ( metal2 butting ndifsi not_over  
  metal1) two_net )   
 SMET2dnplus  = calculateParasitic(( SaMET2dnplus + SbMET2dnplus ) * 3.85e-17)   
 CMET2dnplus  = calculateParasitic( PMET2dnplus + SMET2dnplus )   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal2 - dpplus       
;-------------------------------------------------------------------------------    
;  
; No capacitance when dpplus - (metal1) - metal2              
;  
 PMET2dpplus  = measureParasitic( area ( metal2 over pdifsi not_over metal1 )   
  1.49e-17 two_net                                                                
                                )  
 SaMET2dpplus = measureParasitic( length ( metal2 inside pdifsi not_over  
  metal1 ) two_net )   
 SbMET2dpplus = measureParasitic( length ( metal2 butting pdifsi not_over  
  metal1 ) two_net )   
 SMET2dpplus  = calculateParasitic(( SaMET2dpplus + SbMET2dpplus ) * 3.85e-17)   
 CMET2dpplus  = calculateParasitic( PMET2dpplus + SMET2dpplus )   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal2 - nwellfield    
;-------------------------------------------------------------------------------    
;  
; No capacitance when  nwellfield  - (poly or metal1) - metal2      
;  
 PMET2nwell   = measureParasitic( area ( metal2 over nwells not_over m1opoa )   
  1.38e-17 two_net                                                                
                                )  
 SaMET2nwell  = measureParasitic( length ( metal2 inside nwells not_over   
  m1opoa ) two_net )   
 SbMET2nwell  = measureParasitic( length ( metal2 butting nwells not_over   
  m1opoa ) two_net)   
 SMET2nwell   = calculateParasitic( ( SaMET2nwell + SbMET2nwell ) * 3.78e-17 )   
 CMET2nwell   = calculateParasitic( PMET2nwell + SMET2nwell )   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal2 - pwellfield    
;-------------------------------------------------------------------------------    
;  
; No capacitance when  pwellfield  - (poly or metal1) - metal2       
;  
 PMET2pwell   = measureParasitic( area ( metal2 over pwells not_over m1opoa )   
  1.38e-17 two_net                                                               
                                )  
 SaMET2pwell  = measureParasitic( length ( metal2 inside pwells not_over m1opoa )  
  two_net)   
 SbMET2pwell  = measureParasitic( length ( metal2 butting pwells not_over   
  m1opoa ) two_net)   
 SMET2pwell   = calculateParasitic( ( SaMET2pwell + SbMET2pwell ) * 3.78e-17 )   
 CMET2pwell   = calculateParasitic( PMET2pwell + SMET2pwell )   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   
;  
    CAPAMET2 = calculateParasitic( CMET2dnplus + CMET2dpplus +   
                                   CMET2nwell + CMET2pwell )   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal2 - metal3         
;-------------------------------------------------------------------------------    
;  
 PMET2MET3   = measureParasitic( area ( metal2 over metal3 ) two_net )   
 S0aMET2MET3 = measureParasitic( length ( metal2 inside metal3 ) two_net )   
 S0bMET2MET3 = measureParasitic( length ( metal2 butting metal3 ) two_net )   
 S0MET2MET3  = calculateParasitic( S0aMET2MET3 + S0bMET2MET3 )   
 S1aMET2MET3 = measureParasitic( length ( metal3 inside metal2 ) two_net )   
 S1bMET2MET3 = measureParasitic( length ( metal3 butting metal2 ) two_net )   
 S1MET2MET3  = calculateParasitic( S1aMET2MET3 + S1bMET2MET3 )   
 CPMET2MET3  = calculateParasitic( PMET2MET3   * 4.97e-17 )                       
 CS0MET2MET3 = calculateParasitic( S0MET2MET3 * 5.82e-17 )                       
 CS1MET2MET3 = calculateParasitic( S1MET2MET3 * 5.82e-17 )                       
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CMET2MET3 = calculateParasitic( CPMET2MET3 + CS0MET2MET3 + CS1MET2MET3 )   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal3 - dnplus       
;-------------------------------------------------------------------------------    
;  
; No capacitance when dnplus - (metal1 or metal2) - metal3    
;  
 PMET3dnplus  = measureParasitic( area ( metal3 over ndifsi not_over met2or1 )   
  0.93e-17 two_net                                                                
                               )  
 SaMET3dnplus = measureParasitic( length ( metal3 inside ndifsi not_over  
  met2or1 ) two_net)   
 SbMET3dnplus = measureParasitic( length ( metal3 butting ndifsi not_over   
  met2or1 ) two_net)   
 SMET3dnplus  = calculateParasitic(( SaMET3dnplus + SbMET3dnplus ) *  
  3.74e-17                                                                       
                                 )  
 CMET3dnplus  = calculateParasitic( PMET3dnplus + SMET3dnplus )   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal3 - dpplus  
;-------------------------------------------------------------------------------    
;  
; No capacitance when dpplus - (metal1 or metal2) - metal3    
;  
 PMET3dpplus  = measureParasitic( area ( metal3 over pdifsi not_over met2or1 )   
  0.93e-17 two_net                                                                
                               )  
 SaMET3dpplus = measureParasitic( length ( metal3 inside pdifsi not_over  
  met2or1 ) two_net)   
 SbMET3dpplus = measureParasitic( length ( metal3 butting pdifsi not_over   
  met2or1 ) two_net)   
 SMET3dpplus  = calculateParasitic(( SaMET3dpplus + SbMET3dpplus ) *  
  3.74e-17                                                                       
                                 )  
 CMET3dpplus  = calculateParasitic( PMET3dpplus + SMET3dpplus )   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal3 - nwellfield    
;-------------------------------------------------------------------------------    
;  
; No capacitance when  nwellfield - (poly or metal1 or metal2) - metal3   
;  
 PMET3nwell  = measureParasitic( area ( metal3 over nwells not_over m2o1opoa )   
  0.93e-17 two_net                                                                 
                               )  
 SaMET3nwell = measureParasitic( length ( metal3 inside nwells not_over   
  m2o1opoa ) two_net)   
 SbMET3nwell = measureParasitic( length ( metal3 butting nwells not_over   
  m2o1opoa ) two_net)   
 SMET3nwell  = calculateParasitic( ( SaMET3nwell + SbMET3nwell ) *  
  3.74e-17                                                                       
                                 )  
 CMET3nwell  = calculateParasitic( PMET3nwell + SMET3nwell )   
;  
;-------------------------------------------------------------------------------    
;		Crossing capacitance   metal3 - pwellfield    
;-------------------------------------------------------------------------------    
;  
; No capacitance when  pwellfield - (poly or metal1 or metal2) - metal3   
;  
 PMET3pwell  = measureParasitic( area ( metal3 over pwells not_over m2o1opoa )   
  0.93e-17 two_net                                                               
                               )  
 SaMET3pwell = measureParasitic( length ( metal3 inside pwells not_over   
  m2o1opoa ) two_net)   
 SbMET3pwell = measureParasitic( length ( metal3 butting pwells not_over   
  m2o1opoa ) two_net)   
 SMET3pwell  = calculateParasitic( ( SaMET3pwell + SbMET3pwell ) *   
  3.74e-17                                                                       
                                 )  
 CMET3pwell  = calculateParasitic( PMET3pwell + SMET3pwell )   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;   
    CAPAMET3 = calculateParasitic( CMET3dnplus + CMET3dpplus +   
                                   CMET3nwell + CMET3pwell )   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------    
;  
;			FRINGE  CAPACITANCES                               
;			--------------------  
;  
;  
;	Fringe capacitances are due to the lateral interaction of    
;	two shapes of the same layer which are separated by a        
;	maximum distance equal to 2.5 times the min distance.        
;	A factor " 1/x " is applied to the unit value in order to    
;	take in account the separation distance.                     
;  
;-------------------------------------------------------------------------------    
;		poly Coupling capacitance           
;-------------------------------------------------------------------------------    
;  
    fringepoly   = measureFringe( polconn calculate(( 3.47e-17 * l * 0.8 ) / s )  
       sep <= 2.0  parallel opposite diffNet )  
;   
;-------------------------------------------------------------------------------    
;		metal1 Coupling capacitance           
;-------------------------------------------------------------------------------    
;  
    fringemetal1 = measureFringe( metal1 calculate(( 6.15e-17 * l * 0.8 ) / s )  
       sep <= 2.0  parallel opposite diffNet )  
;   
;-------------------------------------------------------------------------------    
;		metal2 Coupling capacitance            
;-------------------------------------------------------------------------------    
;  
    fringemetal2 = measureFringe( metal2 calculate(( 6.51e-17 * l * 0.9 ) / s )  
       sep <= 2.25 parallel opposite  diffNet )  
;   
;-------------------------------------------------------------------------------    
;		metal3 Coupling capacitance            
;-------------------------------------------------------------------------------    
;  
    fringemetal3 = measureFringe( metal3 calculate(( 6.75e-17 * l * 1.2 ) / s )  
       sep <= 3.0 parallel opposite  diffNet )                                   
;  
;-------------------------------------------------------------------------------    
;		metal3-metal2 Coupling capacitance       
;-------------------------------------------------------------------------------    
;  
    fringeme3me2 = measureFringe( metal3 metal2   
calculate(( 5.82e-17 * l )/( 1 + s ) ) 0 < sep <= 1.2 parallel opposite )        
;  
;-------------------------------------------------------------------------------    
;		metal2-metal3 Coupling capacitance       
;-------------------------------------------------------------------------------    
;  
    fringeme2me3 = measureFringe( metal2 metal3  
calculate(( 5.82e-17 * l )/( 1 + s ) ) 0 < sep <= 0.9 parallel opposite )        
;  
;-------------------------------------------------------------------------------    
;		metal2-metal1 Coupling capacitance       
;-------------------------------------------------------------------------------    
;  
    fringeme2me1 = measureFringe( metal2 metal1  
calculate(( 5.23e-17 * l )/( 1 + s ) ) 0 < sep <= 0.9 parallel opposite )        
;  
;-------------------------------------------------------------------------------    
;		metal1-metal2 Coupling capacitance       
;-------------------------------------------------------------------------------    
;  
    fringeme1me2 = measureFringe( metal1 metal2  
calculate(( 5.23e-17 * l )/( 1 + s ) ) 0 < sep <= 0.8 parallel opposite )        
;  
;-------------------------------------------------------------------------------    
;		metal1-polconn Coupling capacitance       
;-------------------------------------------------------------------------------    
;  
    fringeme1pol = measureFringe( metal1 polconn  
calculate(( 4.78e-17 * l )/( 1 + s ) ) 0 < sep <= 0.8 parallel opposite )        
;  
;-------------------------------------------------------------------------------    
;		polconn-metal1 Coupling capacitance       
;-------------------------------------------------------------------------------    
;  
    fringepolme1 = measureFringe( polconn metal1  
calculate(( 4.78e-17 * l )/( 1 + s ) ) 0 < sep <= 0.8 parallel opposite )        
;  
   CAPA_fringe = calculateParasitic(  
      fringepoly   + fringemetal1 + fringemetal2 + fringemetal3 + fringeme3me2  
      + fringeme2me3 + fringeme2me1 + fringeme1me2 + fringeme1pol + fringepolme1  
                                   )  
;  
;-------------------------------------------------------------------------------    
;  
;		Display the results on different nodes   
;		--------------------------------------  
;  
;  
CAPA = calculateParasitic(  
         CAPApoly  + CAPAMET1  + CAPAMET2  + CAPAMET3  
         + CMET1MET2 + CMET1MET3 + CMET2MET3   
         + CAPA_fringe  
                         )  
;  
 saveParasitic( CAPA "PLUS" "MINUS" "c" "capapar ivpcell"  )  
;  
;  
;-------------------------------------------------------------------------------    
;  
;		Possibility of capa separation for better analysis   
;		--------------------------------------------------  
;  
/*  
 saveParasitic( Cpolynwell  , "PLUS" , "MINUS" , M = "capa10" , P = "c")  
 saveParasitic( Cpolypwell  , "PLUS" , "MINUS" , M = "capa11" , P = "c")  
 saveParasitic( CpolyMET1   , "PLUS" , "MINUS" , M = "capa12" , P = "c")  
 saveParasitic( CpolyMET2   , "PLUS" , "MINUS" , M = "capa13" , P = "c")  
 saveParasitic( CpolyMET3   , "PLUS" , "MINUS" , M = "capa14" , P = "c")  
;   
 saveParasitic( CMET1dnplus , "PLUS" , "MINUS" , M = "capa16" , P = "c")  
 saveParasitic( CMET1dpplus , "PLUS" , "MINUS" , M = "capa17" , P = "c")  
 saveParasitic( CMET1nwell  , "PLUS" , "MINUS" , M = "capa18" , P = "c")  
 saveParasitic( CMET1pwell  , "PLUS" , "MINUS" , M = "capa19" , P = "c")  
;  
 saveParasitic( CMET1MET2   , "PLUS" , "MINUS" , M = "capa20" , P = "c")  
 saveParasitic( CMET1MET3   , "PLUS" , "MINUS" , M = "capa21" , P = "c")  
;   
 saveParasitic( CMET2dnplus , "PLUS" , "MINUS" , M = "capa23" , P = "c")  
 saveParasitic( CMET2dpplus , "PLUS" , "MINUS" , M = "capa24" , P = "c")  
 saveParasitic( CMET2nwell  , "PLUS" , "MINUS" , M = "capa25" , P = "c")  
 saveParasitic( CMET2pwell  , "PLUS" , "MINUS" , M = "capa26" , P = "c")  
;   
 saveParasitic( CMET2MET3   , "PLUS" , "MINUS" , M = "capa27" , P = "c")  
;   
 saveParasitic( CMET3dnplus , "PLUS" , "MINUS" , M = "capa29" , P = "c")  
 saveParasitic( CMET3dpplus , "PLUS" , "MINUS" , M = "capa30" , P = "c")  
 saveParasitic( CMET3nwell  , "PLUS" , "MINUS" , M = "capa31" , P = "c")  
 saveParasitic( CMET3pwell  , "PLUS" , "MINUS" , M = "capa32" , P = "c")  
;  
;   
;  
; saveParasitic( fringepoly    "PLUS" "MINUS" "c" "capa1"  )   
; saveParasitic( fringemetal1  "PLUS" "MINUS" "c" "capa2"  )   
; saveParasitic( fringemetal2  "PLUS" "MINUS" "c" "capa3"  )  
; saveParasitic( fringemetal3  "PLUS" "MINUS" "c" "capa4"  )   
; saveParasitic( fringemetal4  "PLUS" "MINUS" "c" "capa5"  )   
; saveParasitic( fringeme4me3  "PLUS" "MINUS" "c" "capa6"  )   
; saveParasitic( fringeme3me4  "PLUS" "MINUS" "c" "capa7"  )   
; saveParasitic( fringeme3me2  "PLUS" "MINUS" "c" "capa8"  )   
; saveParasitic( fringeme2me3  "PLUS" "MINUS" "c" "capa9"  )   
; saveParasitic( fringeme2me1  "PLUS" "MINUS" "c" "capa40" )  
; saveParasitic( fringeme1me2  "PLUS" "MINUS" "c" "capa41" )   
; saveParasitic( fringeme1pol  "PLUS" "MINUS" "c" "capa42" )   
; saveParasitic( fringepolme1  "PLUS" "MINUS" "c" "capa43" )  
;  
 saveParasitic( CAPA_fringe , "PLUS" , "MINUS" , M = "capa38" , P = "c")  
*/  
;  
 )                                                       ; END OF THE "pair" SECTION  
;  
;  
;*******************************************************************************  
;  
 ivIf( ( switch("extract?") && switch("LPE_single") ) then                       
;                                                        ; BEGINNING OF THE "single" SECTION  
;  
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
;  
;  
;-------------------------------------------------------------------------------    
;  
;		ATTACH  D-S  CAPACITANCES  ON  MOS  COMPONENTS    
;       	----------------------------------------------  
;  
;  
;	NMOS capa drain-source   
;	----------------------  
;  
  a = measureParasitic( area ( ndifsi ) 1e-12 figure )  
  attachParasitic( a ("as" "S") ("ad" "D") ngate shared )                        
  b = measureParasitic( length ( ndifsi outside poly ) 1e-06 figure )  
  attachParasitic( b ("ps" "S") ("pd" "D") ngate shared )                        
;  
;  
;	PMOS capa drain-source   
;	----------------------  
;   
  c = measureParasitic( area ( pdifsi ) 1e-12 figure )  
  attachParasitic( c ("as" "S") ("ad" "D") pgate shared )                        
  d = measureParasitic( length ( pdifsi outside poly ) 1e-06 figure )  
  attachParasitic( d ("ps" "S") ("pd" "D") pgate shared )                        
;  
;  
;-------------------------------------------------------------------------------    
;  
;		EXTRACT  PARASITIC  CAPACITANCES  by  NODE - PAIR   
;		-------------------------------------------------  
;  
;  
;  Crossing capacitances, including area and side capacitances, are calculated  
;  twice, associated to each intervening layer, and referenced to one virtual  
;  node.                                                                      
;                                                                              
;  Coupling capacitances between 2 adjacents conductors are not calculated     
;                                                                              
;  Maximum value are used ( worst case )                                       
;  
;  
;-------------------------------------------------------------------------------  
;                       Preliminary derived layers  
;-------------------------------------------------------------------------------  
;  
poloract   = geomOr( poly     active )  
m1opoa     = geomOr( metal1   poloract )  
met2or1    = geomOr( metal2   metal1 )  
m2o1opoa   = geomOr( met2or1  poloract )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   poly - nwellfield  
;-------------------------------------------------------------------------------  
;  
 Ppolynwell  = measureParasitic( area ( polconn over nwells not_over active )   
  7.28e-17 one_net                                                                 
                               )  
 Sapolynwell = measureParasitic( length ( polconn inside nwells not_over   
  active ) one_net)  
 Sbpolynwell = measureParasitic( length ( polconn butting nwells not_over   
  active ) one_net)  
 Spolynwell  = calculateParasitic( ( Sapolynwell + Sbpolynwell ) * 4.68e-17 )      
 Cpolynwell  = calculateParasitic( Ppolynwell + Spolynwell )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   poly - pwellfield  
;-------------------------------------------------------------------------------  
;  
 Ppolypwell  = measureParasitic( area ( polconn over pwells not_over active )   
  7.28e-17 one_net                                                                
                               )  
 Sapolypwell = measureParasitic( length ( polconn inside pwells not_over   
  active ) one_net)  
 Sbpolypwell = measureParasitic( length ( polconn butting pwells not_over   
  active ) one_net)  
 Spolypwell  = calculateParasitic( ( Sapolypwell + Sbpolypwell ) * 4.68e-17 )      
 Cpolypwell  = calculateParasitic( Ppolypwell + Spolypwell )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   poly - metal1  
;-------------------------------------------------------------------------------  
;  
; These capas are seen from poly   
;  
 PpolyMET1   = measureParasitic( area ( polconn over metal1 not_over poly2)      
   one_net )                                                                     
 S0apolyMET1 = measureParasitic( length ( polconn inside metal1 not_over poly2 ) 
   one_net )                                                                     
 S0bpolyMET1 = measureParasitic( length ( polconn butting metal1 not_over poly2) 
   one_net )                                                                     
 S0polyMET1  = calculateParasitic( S0apolyMET1 + S0bpolyMET1 )  
 S1apolyMET1 = measureParasitic( perimeter ( polconn over metal1 not_over poly2) 
   one_net )                                                                     
 S1bpolyMET1 = measureParasitic( length ( polconn coincident metal1 not_over     
   poly2 ) one_net)                                                              
 S1polyMET1  = calculateParasitic( S1apolyMET1 - ( S0apolyMET1 + S1bpolyMET1))  
 CPpolyMET1  = calculateParasitic( PpolyMET1  * 4.13e-17 )                       
 CS0polyMET1 = calculateParasitic( S0polyMET1 * 4.78e-17 )                       
 CS1polyMET1 = calculateParasitic( S1polyMET1 * 4.78e-17 )                       
;  
; These capas are seen from metal1  
;  
 PMET1poly   = measureParasitic( area ( metal1 over polconn not_over poly2)      
   one_net )                                                                     
 S0aMET1poly = measureParasitic( length ( metal1 inside polconn not_over poly2 ) 
   one_net )                                                                     
 S0bMET1poly = measureParasitic( length ( metal1 butting polconn not_over poly2) 
   one_net )                                                                     
 S0MET1poly  = calculateParasitic( S0aMET1poly + S0bMET1poly )  
 S1aMET1poly = measureParasitic( perimeter ( metal1 over polconn not_over poly2) 
   one_net )                                                                     
 S1bMET1poly = measureParasitic( length ( metal1 coincident polconn not_over     
   poly2 ) one_net)                                                              
 S1MET1poly  = calculateParasitic( S1aMET1poly - ( S0aMET1poly + S1bMET1poly))  
 CPMET1poly  = calculateParasitic( PMET1poly  * 4.13e-17 )                       
 CS0MET1poly = calculateParasitic( S0MET1poly * 4.78e-17 )                       
 CS1MET1poly = calculateParasitic( S1MET1poly * 4.78e-17 )                       
;   
; Capas between poly and metal1, summed by nodes   
;  
  CpolyMET1  = calculateParasitic( CPpolyMET1 + CS0polyMET1 + CS1polyMET1 +  
                                   CPMET1poly + CS0MET1poly + CS1MET1poly )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   poly - metal2  
;-------------------------------------------------------------------------------  
;  
; No capacitance when poly - (metal1) - metal2  
;  
; These capas are seen from poly   
;  
 PpolyMET2   = measureParasitic( area ( polconn over metal2 not_over metal1      
   not_over poly2 ) one_net )                                                    
 S0apolyMET2 = measureParasitic( length ( polconn inside metal2 not_over         
  metal1 not_over poly2 ) one_net )                                              
 S0bpolyMET2 = measureParasitic( length ( polconn butting metal2 not_over        
  metal1 not_over poly2 ) one_net)                                               
 S0polyMET2  = calculateParasitic( S0apolyMET2 + S0bpolyMET2 )  
 S1apolyMET2 = measureParasitic( perimeter ( polconn over metal2 not_over        
  metal1 not_over poly2 ) one_net)                                               
 S1bpolyMET2 = measureParasitic( length ( polconn coincident metal2 not_over     
  metal1 not_over poly2 ) one_net)                                               
 S1polyMET2  = calculateParasitic( S1apolyMET2 - ( S0apolyMET2 + S1bpolyMET2))  
 CPpolyMET2  = calculateParasitic( PpolyMET2  * 1.75e-17 )                        
 CS0polyMET2 = calculateParasitic( S0polyMET2 * 4.01e-17 )                       
 CS1polyMET2 = calculateParasitic( S1polyMET2 * 4.01e-17 )                       
;  
; These capas are seen from metal2  
;  
 PMET2poly   = measureParasitic( area ( metal2 over polconn not_over metal1      
   not_over poly2 ) one_net )                                                    
 S0aMET2poly = measureParasitic( length ( metal2 inside polconn not_over         
  metal1 not_over poly2 ) one_net )                                              
 S0bMET2poly = measureParasitic( length ( metal2 butting polconn not_over        
  metal1 not_over poly2 ) one_net)                                               
 S0MET2poly  = calculateParasitic( S0aMET2poly + S0bMET2poly )  
 S1aMET2poly = measureParasitic( perimeter ( metal2 over polconn not_over        
  metal1 not_over poly2 ) one_net)                                               
 S1bMET2poly = measureParasitic( length ( metal2 coincident polconn not_over     
  metal1 not_over poly2 ) one_net)                                               
 S1MET2poly  = calculateParasitic( S1aMET2poly - ( S0aMET2poly + S1bMET2poly))  
 CPMET2poly  = calculateParasitic( PMET2poly  * 1.75e-17 )                        
 CS0MET2poly = calculateParasitic( S0MET2poly * 4.01e-17 )                       
 CS1MET2poly = calculateParasitic( S1MET2poly * 4.01e-17 )                       
;  
; Capas between poly and metal2, summed by nodes   
;  
 CpolyMET2   = calculateParasitic( CPpolyMET2 + CS0polyMET2 + CS1polyMET2 +  
                                   CPMET2poly + CS0MET2poly + CS1MET2poly )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   poly - metal3  
;-------------------------------------------------------------------------------  
;  
; No capacitance when poly - (metal1 or metal2) - metal3  
;  
; These capas are seen from poly   
;  
 PpolyMET3   = measureParasitic( area ( polconn over metal3 not_over met2or1     
  not_over poly2 ) one_net )                                                     
 S0apolyMET3 = measureParasitic( length ( polconn inside metal3 not_over         
  met2or1 not_over poly2 ) one_net)                                              
 S0bpolyMET3 = measureParasitic( length ( polconn butting metal3 not_over        
  met2or1 not_over poly2 ) one_net)                                              
 S0polyMET3  = calculateParasitic( S0apolyMET3 + S0bpolyMET3 )  
 S1apolyMET3 = measureParasitic( perimeter ( polconn over metal3 not_over        
  met2or1 not_over poly2 ) one_net)                                              
 S1bpolyMET3 = measureParasitic( length ( polconn coincident metal3 not_over     
  met2or1 not_over poly2 ) one_net)                                              
 S1polyMET3  = calculateParasitic(S1apolyMET3 - ( S0apolyMET3 + S1bpolyMET3 ))  
 CPpolyMET3  = calculateParasitic( PpolyMET3  * 1.09e-17 )                       
 CS0polyMET3 = calculateParasitic( S0polyMET3 * 3.89e-17 )                       
 CS1polyMET3 = calculateParasitic( S1polyMET3 * 3.89e-17 )                       
;  
; These capas are seen from metal3   
;  
 PMET3poly   = measureParasitic( area ( metal3 over polconn not_over met2or1     
  not_over poly2 ) one_net )                                                     
 S0aMET3poly = measureParasitic( length ( metal3 inside polconn not_over         
  met2or1 not_over poly2 ) one_net)                                              
 S0bMET3poly = measureParasitic( length ( metal3 butting polconn not_over        
  met2or1 not_over poly2 ) one_net)                                              
 S0MET3poly  = calculateParasitic( S0aMET3poly + S0bMET3poly )  
 S1aMET3poly = measureParasitic( perimeter ( metal3 over polconn not_over        
  met2or1 not_over poly2 ) one_net)                                              
 S1bMET3poly = measureParasitic( length ( metal3 coincident polconn not_over     
  met2or1 not_over poly2 ) one_net)                                              
 S1MET3poly  = calculateParasitic(S1aMET3poly - ( S0aMET3poly + S1bMET3poly ))  
 CPMET3poly  = calculateParasitic( PMET3poly  * 1.09e-17 )                        
 CS0MET3poly = calculateParasitic( S0MET3poly * 3.89e-17 )                       
 CS1MET3poly = calculateParasitic( S1MET3poly * 3.89e-17 )                       
;  
; Capas between poly and metal3, summed by nodes   
;  
 CpolyMET3   = calculateParasitic( CPpolyMET3 + CS0polyMET3 + CS1polyMET3 +  
                                   CPMET3poly + CS0MET3poly + CS1MET3poly )  
;  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CAPApoly = calculateParasitic(  
                 Cpolynwell + Cpolypwell + CpolyMET1 + CpolyMET2 + CpolyMET3  
                                 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal1 - dnplus  
;-------------------------------------------------------------------------------  
;  
 PMET1dnplus  = measureParasitic( area ( metal1 over ndifsi ) 2.95e-17 one_net )   
 SaMET1dnplus = measureParasitic( length ( metal1 inside ndifsi ) one_net )  
 SbMET1dnplus = measureParasitic( length ( metal1 butting ndifsi ) one_net )  
 SMET1dnplus  = calculateParasitic(( SaMET1dnplus + SbMET1dnplus ) * 4.38e-17)   
 CMET1dnplus  = calculateParasitic( PMET1dnplus + SMET1dnplus )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal1 - dpplus  
;-------------------------------------------------------------------------------  
;  
 PMET1dpplus  = measureParasitic( area ( metal1 over pdifsi ) 2.95e-17 one_net )   
 SaMET1dpplus = measureParasitic( length ( metal1 inside pdifsi ) one_net )  
 SbMET1dpplus = measureParasitic( length ( metal1 butting pdifsi ) one_net )  
 SMET1dpplus  = calculateParasitic(( SaMET1dpplus + SbMET1dpplus ) * 4.38e-17)   
 CMET1dpplus  = calculateParasitic( PMET1dpplus + SMET1dpplus )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal1 - nwellfield  
;-------------------------------------------------------------------------------  
;  
; No capacitance when nwellfield - (poly) - metal1  
;  
 PMET1nwell  = measureParasitic( area ( metal1 over nwells not_over poloract)  
  2.54e-17 one_net                                                               
                              )  
 SaMET1nwell = measureParasitic( length ( metal1 inside nwells not_over   
  poloract ) one_net )  
 SbMET1nwell = measureParasitic( length ( metal1 butting nwells not_over   
  poloract ) one_net )  
 SMET1nwell  = calculateParasitic( ( SaMET1nwell + SbMET1nwell ) * 4.22e-17 )    
 CMET1nwell  = calculateParasitic( PMET1nwell + SMET1nwell )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal1 - pwellfield  
;-------------------------------------------------------------------------------  
;  
; No capacitance when pwellfield - (poly) - metal1  
;  
 PMET1pwell  = measureParasitic( area ( metal1 over pwells not_over poloract)   
  2.54e-17 one_net                                                                
                              )  
 SaMET1pwell = measureParasitic( length ( metal1 inside pwells not_over   
  poloract ) one_net )  
 SbMET1pwell = measureParasitic( length ( metal1 butting pwells not_over   
  poloract ) one_net )  
 SMET1pwell  = calculateParasitic( ( SaMET1pwell + SbMET1pwell ) * 4.22e-17 )    
 CMET1pwell  = calculateParasitic( PMET1pwell + SMET1pwell )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CAPAMET1 = calculateParasitic( CMET1dnplus + CMET1dpplus +  
                                   CMET1nwell + CMET1pwell )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal1 - metal2  
;-------------------------------------------------------------------------------  
;  
; These following Capas are seen from metal1   
;  
 PMET1MET2   = measureParasitic( area ( metal1 over metal2 ) one_net )  
 S0aMET1MET2 = measureParasitic( length ( metal1 inside metal2 ) one_net )  
 S0bMET1MET2 = measureParasitic( length ( metal1 butting metal2 ) one_net )  
 S0MET1MET2  = calculateParasitic( S0aMET1MET2 + S0bMET1MET2 )  
 S1aMET1MET2 = measureParasitic( perimeter ( metal1 over metal2 ) one_net )  
 S1bMET1MET2 = measureParasitic( length ( metal1 coincident metal2 ) one_net)  
 S1MET1MET2  = calculateParasitic( S1aMET1MET2 - ( S0aMET1MET2 + S1bMET1MET2))  
 CPMET1MET2  = calculateParasitic( PMET1MET2   * 4.80e-17 )                       
 CS0MET1MET2 = calculateParasitic( S0MET1MET2 * 5.23e-17 )                       
 CS1MET1MET2 = calculateParasitic( S1MET1MET2 * 5.23e-17 )                       
;   
; These following Capas are seen from metal2   
;  
 PMET2MET1   = measureParasitic( area ( metal2 over metal1 ) one_net )  
 S0aMET2MET1 = measureParasitic( length ( metal2 inside metal1 ) one_net )  
 S0bMET2MET1 = measureParasitic( length ( metal2 butting metal1 ) one_net )  
 S0MET2MET1  = calculateParasitic( S0aMET2MET1 + S0bMET2MET1 )  
 S1aMET2MET1 = measureParasitic( perimeter ( metal2 over metal1 ) one_net )  
 S1bMET2MET1 = measureParasitic( length ( metal2 coincident metal1 ) one_net)  
 S1MET2MET1  = calculateParasitic( S1aMET2MET1 - ( S0aMET2MET1 + S1bMET2MET1))  
 CPMET2MET1  = calculateParasitic( PMET2MET1   * 4.80e-17 )                       
 CS0MET2MET1 = calculateParasitic( S0MET2MET1 * 5.23e-17 )                       
 CS1MET2MET1 = calculateParasitic( S1MET2MET1 * 5.23e-17 )                       
;   
; Capas between metal1 and metal2 , summed by nodes   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CMET1MET2 = calculateParasitic( CPMET1MET2 + CS0MET1MET2 + CS1MET1MET2 +  
                                    CPMET2MET1 + CS0MET2MET1 + CS1MET2MET1 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal1 - metal3  
;-------------------------------------------------------------------------------  
;  
; No capacitance when metal1 - (metal2) - metal3  
;  
; These following Capas are seen from metal1   
;  
 PMET1MET3   = measureParasitic( area ( metal1 over metal3 not_over metal2 )   
  one_net )  
 S0aMET1MET3 = measureParasitic( length ( metal1 inside metal3 not_over   
  metal2 ) one_net )  
 S0bMET1MET3 = measureParasitic( length ( metal1 butting metal3 not_over   
  metal2 ) one_net)  
 S0MET1MET3  = calculateParasitic( S0aMET1MET3 + S0bMET1MET3 )  
 S1aMET1MET3 = measureParasitic( perimeter ( metal1 over metal3 not_over   
  metal2 ) one_net)  
 S1bMET1MET3 = measureParasitic( length ( metal1 coincident metal3 not_over   
  metal2) one_net)  
 S1MET1MET3  = calculateParasitic( S1aMET1MET3 - ( S0aMET1MET3 + S1bMET1MET3))  
 CPMET1MET3  = calculateParasitic( PMET1MET3   * 1.81e-17 )                      
 CS0MET1MET3 = calculateParasitic( S0MET1MET3 * 4.42e-17 )                       
 CS1MET1MET3 = calculateParasitic( S1MET1MET3 * 4.42e-17 )                       
;   
; These following Capas are seen from metal3   
;  
 PMET3MET1   = measureParasitic( area ( metal3 over metal1 not_over metal2 )   
  one_net )  
 S0aMET3MET1 = measureParasitic( length ( metal3 inside metal1 not_over   
  metal2 ) one_net )  
 S0bMET3MET1 = measureParasitic( length ( metal3 butting metal1 not_over   
  metal2 ) one_net)  
 S0MET3MET1  = calculateParasitic( S0aMET3MET1 + S0bMET3MET1 )  
 S1aMET3MET1 = measureParasitic( perimeter ( metal3 over metal1 not_over   
  metal2 ) one_net)  
 S1bMET3MET1 = measureParasitic( length ( metal3 coincident metal1 not_over   
  metal2) one_net)  
 S1MET3MET1  = calculateParasitic( S1aMET3MET1 - ( S0aMET3MET1 + S1bMET3MET1))  
 CPMET3MET1  = calculateParasitic( PMET3MET1   * 1.81e-17 )                        
 CS0MET3MET1 = calculateParasitic( S0MET3MET1 * 4.42e-17 )                       
 CS1MET3MET1 = calculateParasitic( S1MET3MET1 * 4.42e-17 )                       
;   
; Capas between metal1 and metal3 , summed by nodes   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CMET1MET3 = calculateParasitic( CPMET1MET3 + CS0MET1MET3 + CS1MET1MET3 +  
                                    CPMET3MET1 + CS0MET3MET1 + CS1MET3MET1 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal2 - dnplus  
;-------------------------------------------------------------------------------  
;  
; No capacitance when dnplus - (metal1) - metal2  
;  
 PMET2dnplus  = measureParasitic( area ( metal2 over ndifsi not_over metal1 )   
  1.49e-17 one_net                                                                
                               )  
 SaMET2dnplus = measureParasitic( length ( metal2 inside ndifsi not_over  
  metal1 ) one_net )   
 SbMET2dnplus = measureParasitic( length ( metal2 butting ndifsi not_over  
  metal1 ) one_net )   
 SMET2dnplus  = calculateParasitic(( SaMET2dnplus + SbMET2dnplus ) * 3.85e-17)   
 CMET2dnplus  = calculateParasitic( PMET2dnplus + SMET2dnplus )   
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal2 - dpplus  
;-------------------------------------------------------------------------------  
;  
; No capacitance when dpplus - (metal1) - metal2  
;  
 PMET2dpplus  = measureParasitic( area ( metal2 over pdifsi not_over metal1 )   
  1.49e-17 one_net                                                               
                                )  
 SaMET2dpplus = measureParasitic( length ( metal2 inside pdifsi not_over  
  metal1 ) one_net )   
 SbMET2dpplus = measureParasitic( length ( metal2 butting pdifsi not_over  
  metal1 ) one_net )   
 SMET2dpplus  = calculateParasitic(( SaMET2dpplus + SbMET2dpplus ) * 3.85e-17)   
 CMET2dpplus  = calculateParasitic( PMET2dpplus + SMET2dpplus )   
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal2 - nwellfield  
;-------------------------------------------------------------------------------  
;  
; No capacitance when  nwellfield  - (poly or metal1) - metal2  
;  
 PMET2nwell  = measureParasitic( area ( metal2 over nwells not_over m1opoa )   
  1.38e-17 one_net                                                               
                                )  
 SaMET2nwell = measureParasitic( length ( metal2 inside nwells not_over m1opoa )  
  one_net )  
 SbMET2nwell = measureParasitic( length ( metal2 butting nwells not_over   
  m1opoa ) one_net)  
 SMET2nwell  = calculateParasitic( ( SaMET2nwell + SbMET2nwell ) * 3.78e-17 )    
 CMET2nwell  = calculateParasitic( PMET2nwell + SMET2nwell )  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal2 - pwellfield  
;-------------------------------------------------------------------------------  
;  
; No capacitance when  pwellfield  - (poly or metal1) - metal2  
;  
 PMET2pwell  = measureParasitic( area ( metal2 over pwells not_over m1opoa)   
  1.38e-17 one_net                                                                
                                )  
 SaMET2pwell = measureParasitic( length ( metal2 inside pwells not_over m1opoa )   
  one_net)  
 SbMET2pwell = measureParasitic( length ( metal2 butting pwells not_over m1opoa )  
  one_net)  
 SMET2pwell  = calculateParasitic( ( SaMET2pwell + SbMET2pwell ) * 3.78e-17 )    
 CMET2pwell  = calculateParasitic( PMET2pwell + SMET2pwell )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CAPAMET2 = calculateParasitic( CMET2dnplus + CMET2dpplus +  
                                   CMET2nwell + CMET2pwell )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal2 - metal3  
;-------------------------------------------------------------------------------  
;  
; These following Capas are seen from metal2   
;  
 PMET2MET3   = measureParasitic( area ( metal2 over metal3 ) one_net )  
 S0aMET2MET3 = measureParasitic( length ( metal2 inside metal3 ) one_net )  
 S0bMET2MET3 = measureParasitic( length ( metal2 butting metal3 ) one_net )  
 S0MET2MET3  = calculateParasitic( S0aMET2MET3 + S0bMET2MET3 )  
 S1aMET2MET3 = measureParasitic( perimeter ( metal2 over metal3 ) one_net )  
 S1bMET2MET3 = measureParasitic( length ( metal2 coincident metal3 ) one_net)  
 S1MET2MET3  = calculateParasitic( S1aMET2MET3 - ( S0aMET2MET3 + S1bMET2MET3 ) )  
 CPMET2MET3  = calculateParasitic( PMET2MET3   * 4.97e-17 )                       
 CS0MET2MET3 = calculateParasitic( S0MET2MET3 * 5.82e-17 )                       
 CS1MET2MET3 = calculateParasitic( S1MET2MET3 * 5.82e-17 )                       
;   
; These following Capas are seen from metal3   
;  
 PMET3MET2   = measureParasitic( area ( metal3 over metal2 ) one_net )  
 S0aMET3MET2 = measureParasitic( length ( metal3 inside metal2 ) one_net )  
 S0bMET3MET2 = measureParasitic( length ( metal3 butting metal2 ) one_net )  
 S0MET3MET2  = calculateParasitic( S0aMET3MET2 + S0bMET3MET2 )  
 S1aMET3MET2 = measureParasitic( perimeter ( metal3 over metal2 ) one_net )  
 S1bMET3MET2 = measureParasitic( length ( metal3 coincident metal2 ) one_net )  
 S1MET3MET2  = calculateParasitic( S1aMET3MET2 - ( S0aMET3MET2 + S1bMET3MET2 ) )  
 CPMET3MET2  = calculateParasitic( PMET3MET2   * 4.97e-17 )                       
 CS0MET3MET2 = calculateParasitic( S0MET3MET2 * 5.82e-17 )                       
 CS1MET3MET2 = calculateParasitic( S1MET3MET2 * 5.82e-17 )                       
;   
; Capas between metal2 and metal3 , summed by nodes   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CMET2MET3 = calculateParasitic( CPMET2MET3 + CS0MET2MET3 + CS1MET2MET3 +  
                                    CPMET3MET2 + CS0MET3MET2 + CS1MET3MET2 )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal3 - dnplus  
;-------------------------------------------------------------------------------  
;  
; No capacitance when dnplus - (metal1 or metal2) - metal3  
;  
 PMET3dnplus = measureParasitic( area ( metal3 over ndifsi not_over met2or1 )   
  0.93e-17 one_net                                                               
                               )  
 SaMET3dnplus = measureParasitic( length ( metal3 inside ndifsi not_over  
  met2or1 ) one_net)   
 SbMET3dnplus = measureParasitic( length ( metal3 butting ndifsi not_over   
  met2or1 ) one_net)   
 SMET3dnplus  = calculateParasitic(( SaMET3dnplus + SbMET3dnplus ) *  
  3.74e-17                                                                       
                                  )  
 CMET3dnplus  = calculateParasitic( PMET3dnplus + SMET3dnplus )   
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal3 - dpplus  
;-------------------------------------------------------------------------------  
;  
; No capacitance when dpplus - (metal1 or metal2) - metal3  
;  
 PMET3dpplus  = measureParasitic( area ( metal3 over pdifsi not_over met2or1 )   
  0.93e-17 one_net                                                                
                               )  
 SaMET3dpplus = measureParasitic( length ( metal3 inside pdifsi not_over  
  met2or1 ) one_net)   
 SbMET3dpplus = measureParasitic( length ( metal3 butting pdifsi not_over   
  met2or1 ) one_net)   
 SMET3dpplus  = calculateParasitic(( SaMET3dpplus + SbMET3dpplus ) *  
  3.74e-17                                                                       
                                 )  
 CMET3dpplus  = calculateParasitic( PMET3dpplus + SMET3dpplus )   
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal3 - nwellfield  
;-------------------------------------------------------------------------------  
;  
; No capacitance when  nwellfield - (poly or metal1 or metal2) - metal3  
;  
 PMET3nwell  = measureParasitic( area ( metal3 over nwells not_over m2o1opoa )   
  0.93e-17 one_net                                                                
                               )  
 SaMET3nwell = measureParasitic( length ( metal3 inside nwells not_over   
  m2o1opoa ) one_net)   
 SbMET3nwell = measureParasitic( length ( metal3 butting nwells not_over   
  m2o1opoa ) one_net)   
 SMET3nwell  = calculateParasitic( ( SaMET3nwell + SbMET3nwell ) *  
  3.74e-17                                                                       
                                 )  
 CMET3nwell  = calculateParasitic( PMET3nwell + SMET3nwell )   
;  
;-------------------------------------------------------------------------------  
;               Crossing capacitance   metal3 - pwellfield  
;-------------------------------------------------------------------------------  
;  
; No capacitance when  pwellfield - (poly or metal1 or metal2) - metal3  
;  
 PMET3pwell  = measureParasitic( area ( metal3 over pwells not_over m2o1opoa )   
  0.93e-17 one_net                                                                
                               )  
 SaMET3pwell = measureParasitic( length ( metal3 inside pwells not_over   
  m2o1opoa ) one_net)   
 SbMET3pwell = measureParasitic( length ( metal3 butting pwells not_over   
  m2o1opoa ) one_net)   
 SMET3pwell  = calculateParasitic( ( SaMET3pwell + SbMET3pwell ) *  
  3.74e-17                                                                       
                                 )  
 CMET3pwell  = calculateParasitic( PMET3pwell + SMET3pwell )   
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
    CAPAMET3 = calculateParasitic( CMET3dnplus + CMET3dpplus +  
                                   CMET3nwell + CMET3pwell )  
;  
;  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
;  
;-------------------------------------------------------------------------------  
;  
;		Display the results on different nodes  
;		--------------------------------------  
;  
;  
CAPA = calculateParasitic(  
         CAPApoly  + CAPAMET1  + CAPAMET2  + CAPAMET3  
         + CMET1MET2 + CMET1MET3 + CMET2MET3  
                         )  
;  
saveParasitic( CAPA "PLUS" "MINUS" "c" "capapar ivpcell"  )  
;  
;-------------------------------------------------------------------------------  
;  
;		Possibility of capa separation for better analysis  
;		--------------------------------------------------  
;  
/*  
 saveParasitic( Cpolynwell  , "PLUS" , "MINUS" , M = "capa10" , P = "c")  
 saveParasitic( Cpolypwell  , "PLUS" , "MINUS" , M = "capa11" , P = "c")  
 saveParasitic( CpolyMET1   , "PLUS" , "MINUS" , M = "capa12" , P = "c")  
 saveParasitic( CpolyMET2   , "PLUS" , "MINUS" , M = "capa13" , P = "c")  
 saveParasitic( CpolyMET3   , "PLUS" , "MINUS" , M = "capa14" , P = "c")  
;  
 saveParasitic( CMET1dnplus , "PLUS" , "MINUS" , M = "capa16" , P = "c")  
 saveParasitic( CMET1dpplus , "PLUS" , "MINUS" , M = "capa17" , P = "c")  
 saveParasitic( CMET1nwell  , "PLUS" , "MINUS" , M = "capa18" , P = "c")  
 saveParasitic( CMET1pwell  , "PLUS" , "MINUS" , M = "capa19" , P = "c")  
;  
 saveParasitic( CMET1MET2   , "PLUS" , "MINUS" , M = "capa20" , P = "c")  
 saveParasitic( CMET1MET3   , "PLUS" , "MINUS" , M = "capa21" , P = "c")  
;  
 saveParasitic( CMET2dnplus , "PLUS" , "MINUS" , M = "capa23" , P = "c")  
 saveParasitic( CMET2dpplus , "PLUS" , "MINUS" , M = "capa24" , P = "c")  
 saveParasitic( CMET2nwell  , "PLUS" , "MINUS" , M = "capa25" , P = "c")  
 saveParasitic( CMET2pwell  , "PLUS" , "MINUS" , M = "capa26" , P = "c")  
;  
 saveParasitic( CMET2MET3   , "PLUS" , "MINUS" , M = "capa27" , P = "c")  
;  
 saveParasitic( CMET3dnplus , "PLUS" , "MINUS" , M = "capa29" , P = "c")  
 saveParasitic( CMET3dpplus , "PLUS" , "MINUS" , M = "capa30" , P = "c")  
 saveParasitic( CMET3nwell  , "PLUS" , "MINUS" , M = "capa31" , P = "c")  
 saveParasitic( CMET3pwell  , "PLUS" , "MINUS" , M = "capa32" , P = "c")  
;  
;  
*/  
;  
 )                                                       ; END OF THE "single" SECTION  
;  
)                                                        ; END OF drcExtractRules  


