From abousha@ima.enst.fr Mon Jul 21 15:55:13 1997
Return-Path: <abousha@ima.enst.fr>
Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2])
          by asim.lip6.fr (8.8.6/jtpda-5.2) with ESMTP id PAA12746
          for <Marie-Minerve.Louerat@asim.lip6.fr>; Mon, 21 Jul 1997 15:55:12 +0200 (MET DST)
Received: from enst.enst.fr (/4S2gv8qX+PIpSNuVDeVOIYGmFq0dIfF@enst.enst.fr [137.194.2.16])
          by isis.lip6.fr (8.8.5/jtpda-5.2) with ESMTP id PAA26180
          for <Marie-Minerve.Louerat@asim.lip6.fr>; Mon, 21 Jul 1997 15:55:35 +0200 (MET DST)
Received: from ima.enst.fr (mathieu-2.enst.fr [137.194.2.64])
          by enst.enst.fr (8.8.4/8.8.4) with SMTP
	  id PAA20271 for <Marie-Minerve.Louerat@asim.lip6.fr>; Mon, 21 Jul 1997 15:55:31 +0200 (MET DST)
Received: by ima.enst.fr (SMI-8.6/SMI-SVR4)
	id PAA19460; Mon, 21 Jul 1997 15:55:27 +0200
Date: Mon, 21 Jul 1997 15:55:27 +0200
From: abousha@ima.enst.fr (Thesard Ana Hassan Aboushady)
Message-Id: <199707211355.PAA19460@ima.enst.fr>
Content-Type: text
Apparently-To: Marie-Minerve.Louerat@asim.lip6.fr
Content-Length: 164270
Status: OR

;******************************************************************************  
;*******************          D   I   V    A               ********************  
;******************************************************************************  
;******                                                                   *****  
;******       E X T R A C T -  D R C        INPUT  COMMAND  FILE          *****  
;******                                                                   *****  
;******            H C M O S - 5 A  TLM   CMOS   TECHNOLOGY               *****  
;******                 ============================                      *****  
;******                                                                   *****  
;******   0.5 micron poly   -  N  Well    -  3  metals                    *****  
;******                                                                   *****  
;******   UPDATE     : 19 jul 95                                          *****
;******                                                                   *****  
;******   SOURCE : CENTRAL R&D  GRENOBLE                                  *****  
;******                                                                   *****  
;******   REFERENCED DOCUMENTS  : UDCS Nb 0061751  REV.B - XX.AUG.94      *****  
;******                         ( HCMOS5 PRELIMINARY DESIGN RULE MANUAL ) *****  
;******                           UDCS Nb 0076646  REV.A - XX.JUN.94      *****  
;******                        ( HCMOS5A PRELIMINARY DESIGN RULE MANUAL ) *****  
;******                                                                   *****  
;******************************************************************************  
;******                                                                   *****  
;******   OVERVIEW :                                                      *****  
;******                                                                   *****  
;******   This DRC-EXTRACT file has been developped for usage in          *****  
;******         UNICAD -2 ( or pure CADENCE FRAMEWORK II ) system         *****  
;******                                                                   *****  
;******   Inside the HCMOS5A DESIGN KIT which provides the whole design   *****  
;******    environment for CADENCE FRAMEWORK II, this file is called      *****  
;******    "hcmos5a.drcExtract_##" and is present in the current version  *****  
;******    of the Design Kit .                                            *****  
;******                                                                   *****  
;******************************************************************************  
;******                                                                   *****  
;******   MODIFICATIONS :                                                 *****  
;******     17mar94 :                                                     *****  
;******      - analog wells (anwell, apwell) rules added                  *****  
;******        connectivity redefined for xxwell layers                   *****  
;******      - poly2, cap rules added, some changes for poly rules        *****  
;******        or contact rules to allow poly2 layer                      *****  
;******     15mar94 ; - diodes extraction : from now on again, an active  *****  
;******        area without diode marker, but having a single salicide    *****  
;******        region is recognised as a diode                            *****  
;******      - transistor gate upper limit extended to 999 um.            *****  
;******     28mar94 : - bended transistors filtered before calculation    *****  
;******        to decrease CPU time                                       *****  
;******      - additional distinction between same type of diodes         *****  
;******     10jun94 : - geomConnect added in the switches to avoid the    *****  
;******        Note of connectivity tracing possible problem.             *****  
;******        Switches reorganized to separate switches usenotext        *****  
;******        and nodetext in drc and extract parts                      *****  
;******     24jun94 : - resistors nplus/pplus extracted with 3 pins       *****  
;******      - width saved for resistors as parameter                     *****  
;******     28jun94 : - switch for more accurate bended gates calculation *****  
;******        with transistor gate upper limit equal to 150 um           *****  
;******     29jun94 : - rpo1 and rpocap siprot interface corrected 70->75 *****  
;******     30jun94 : feed through management deleted                     *****  
;******     16jun94 :                                                     *****  
;******        - add switch "bendopti" to avoid the standard gate correc- *****  
;******          tion when the gate corner to corner value is les than L  *****  
;******     07jul94 :                                                     *****  
;******        - add switch "mdiode"; see documentation below.            *****  
;******     18aug94 :                                                     *****  
;******          rule 13.5 improved (only actual edges of gate are used ) *****  
;******        - EXTRACT section :                                        *****  
;******          bended mos in option get more accurate recognition       *****  
;******          nwell and pwell becomes "stamped" instead of connected   *****  
;******     12sep94 :                                                     *****  
;******      - rule 13.5 min S-D width when contact between 2 gates >.95  *****  
;******     12oct94 :                                                     *****  
;******      - rules 30.12 & 30.14 modified                               *****  
;******     18nov94 :                                                     *****  
;******      - msub feature added to allow separate ground nodes on a     *****  
;******        single pwell area                                          *****  
;******     09dec94 :                                                     *****  
;******          active n+ crossing nwell allowed                         *****  
;******          nlddprot layer with DRC rules included                   *****  
;******     11jan95 :                                                     *****  
;******      - rule 1.5c corrected to consider only active crossing nwell *****  
;******      - pad rules modified according to DRM (rules 30 and 31)      *****  
;******     23jan95 :                                                     ***** 
;******      - rules 40.10, 40.11, 41.5 accorded to DRM rev B             ***** 
;******        + implicite rules 40.imp3->6 , 41.imp3->9 , 1.imp3->8      ***** 
;******      - LVS part: anwell under pads removed from stamped connects  ***** 
;******        ( derived "nowell" redefined with nwells instead of nwell )***** 
;******     31jan95 :                                                     *****  
;******      - updated with last modif of HCMOS5A DRM revB dated 26jan95  *****  
;******     06mar95 :                                                     ***** 
;******      - property "model" added for pnpw  transistor                ***** 
;******     26Oct95 :							  *****
;******      - rule 25.0 added : "via1 over poly2 of POLY2/POLY capacitor *****
;******        forbidden".                                                *****
;******     30Oct95 :							  *****
;******      - rule 19.6 value corrected from 0.5 to 0.6 um (DRM rev.B)   *****
;******      - rule 11.6 value corrected from 0.3 to 0.6 um (DRM rev.B)   *****
;******      - Capa Poly2/1 extraction improved                           *****
;******      - N+ poly-cap sheet resistance value corrected ( 28 to 34 )  *****
;******        according to HCMOS5A DRM (Rev. B).			  *****
;******                                                                   *****  
;******************************************************************************  
;******                                                                   *****  
;******   DIRECTION FOR USE :                                             *****  
;******                                                                   *****  
;******    SWITCHES                                                       *****  
;******    --------                                                       *****  
;******  - LEVEL1 or/and LEVEL2 input-layers management :                 *****  
;******    By default, the LEVEL2 is used, that is all metallisations are *****  
;******    splitted 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.                 *****  
;******    "nodiode" switch : if used, this switch prevents from extrac-  *****  
;******    ting all types of diodes ( marker mdiode used or not).         *****  
;******    "mdiode" 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 "mdiode" 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 :            *****  
;******    "pair"                                                         *****  
;******    for parasitic capacitances connected between the actual nodes. *****  
;******    (usage of "two-net" option of parasitics extraction ).         *****  
;******    "single"                                                       *****  
;******    for parasitic capacitances referenced to the ground (node 0!). *****  
;******    (usage of "one-net" option of parasitics extraction ).         *****  
;******                                                                   *****  
;******  - ADDITIONAL SWITCHES are provided for both DRC and EXTRACT :    *****  
;******     (see availability farther 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 consistant. *****  
;******     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 does'nt 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 MOS which have the gate connected to power having   *****  
;******     the name "vdd!" or a ground having the name "gnd!".           *****  
;******     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.*****  
;******                                                                   *****  
;******    "bendopti"                                                     *****  
;******     By default, a standard WIDTH correction is performed on gates *****  
;******     having bends; but in some cases, this correction happens to   *****  
;******     be to high, what occurs when the bend value is lesser than L. *****  
;******     To avoid that, the switch "bendopti" recognises such configu- *****  
;******     tions and avoids their correction. It has to be used when more ****  
;******     accurate W is required (NB process timing will be greater in  *****  
;******     case of large design ).                                       *****  
;******     NB: When this switch is activated, the compatibility with the *****  
;******     hcmos5.draclvs file is not ensured. This means that a design  *****  
;******     which passes lvs diva without error might not pass lvs dracula. ***  
;******                                                                   *****  
;******    USING MARKER :                                                 *****  
;******    -------------                                                  *****  
;******      The following design convention must be used :               *****  
;******    "mres" : ( particular scope )                                  *****  
;******      For P+/Nwell , N+/Pwell 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 active and poly).   *****  
;******      - 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 configuration you want extract as diode only *****  
;******      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 configuration : it has to be put            *****  
;******      - on the intersection of poly for cross-gate transistors     *****  
;******      - on the poly gate plug of ring-gate transistors.            *****  
;******                                                                   *****  
;******                                                                   *****  
;******                                                                   *****  
;******************************************************************************  
;  
drcExtractRules(  
;  
;******************************************************************************  
;  
;                    INPUT   LAYER   BLOCK  
;  
;******************************************************************************  
;  
        nwell   = geomOr( "nwell" )  
        anwell  = geomOr( "anwell" )                                             
        apwell  = geomOr( "apwell" )                                             
        active  = geomOr( "active" )  
        poly    = geomOr( "poly" )  
        pplus   = geomOr( "pplus" )  
        nldprot = geomOr( "nlddprot" )  
        cap     = geomOr( "cap" )                                                
        poly2   = geomOr( "poly2" )                                              
        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" )  
        glass   = geomOr( "glass" )  
        nitride = geomOr( "nitride" )  
        polyi   = geomOr( "polyimide" )  
        markgen = geomOr( "drcio" )  
        mres    = geomOr( "mres" )  
        mdiode  = geomOr( "mdiode" )  
        mpnp    = geomOr( "mpnp" )                                               
        mshort  = geomOr( "mshort" )  
        nodrc   = geomOr( "nondrc" )  
        msub    = geomOr( "msub" )  
        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 )  
        )  
;  
;*****************************************************************************  
;  
;    CUSTOMER SPECIFIC SIZINGS  
;  
;******** ********* ********* ********* ********* ********* ********* ********  
;  
; unused  
;  
;*****************************************************************************  
;  
;   LAYER CREATION FOR CHECKS  
;  
;*****************************************************************************  
;  
;******* SEPARATED  NWELL  *****  
;  
sub = geomOr( geomAndNot( bulk geomSize( msub .1 ) ) msub )  
nwells  = geomOr( nwell anwell )            ; NWELL AREAS                         
pwells  = geomAndNot( sub nwells )      ; DERIVED PWELL AREA EVENTUALLY           
;                                       ;  SPLITTED BY "MSUB"  
pwell   = geomAndNot( pwells apwell )       ; DERIVED PWELL AREA                  
awells  = geomOr( apwell anwell )           ; ANALOG AREAS                        
wells   = geomOr( pwell nwell )             ; NO-ANALOG AREAS  
;  
;****** ACTIVE DERIVATION ***  
;  
pactive = geomAnd( active pplus )      ;SEPARATED P ACTIVE  
pdiff0  = geomAndNot( pactive poly )  
nactive = geomAndNot( active pplus )   ;SEPARATED N ACTIVE  
ndiff0  = geomAndNot( nactive poly )  
;  
panact  = geomAnd( pactive awells )    ;SEPARATED ANALOG P ACTIVE                 
pnact   = geomAnd( pactive wells )     ;SEPARATED NON ANALOG P ACTIVE  
nanact  = geomAnd( nactive awells )    ;SEPARATED ANALOG N ACTIVE                 
nnact   = geomAnd( nactive wells )     ;SEPARATED NON ANALOG N ACTIVE  
actinaw = geomOr( panact nanact )      ;ALL ACTIVE IN ANALOG WELLS                
actinw  = geomOr( pnact nnact )        ;ALL ACTIVE IN NON ANALOG WELLS  
;  
pinanw  = geomAnd( pactive anwell )    ;P ACTIVE IN ANWELL                        
pinnw   = geomAnd( pactive nwell  )    ;P ACTIVE IN NWELL  
pinnws  = geomOr( pinanw pinnw )       ;P ACTIVE IN NWELLS                        
ninapw  = geomAnd( nactive apwell )    ;N ACTIVE IN APWELL                        
ninpw   = geomAnd( nactive pwell  )    ;N ACTIVE IN PWELL  
ninpws  = geomOr( ninapw ninpw  )      ;N ACTIVE IN PWELLS                        
;  
pastrap = geomAnd( pactive apwell )    ;P ACTIVE WELL STRAPS IN APWELL            
pstrap  = geomAnd( pactive pwell )     ;P ACTIVE WELL STRAPS IN PWELL  
pstraps = geomOr( pastrap pstrap )     ;P ACTIVE WELL STRAPS IN PWELLS            
pstrapL = geomOr( pstraps )                                                       
nastrap = geomAnd( nactive anwell )    ;N ACTIVE WELL STRAPS IN ANWELL            
nstrap  = geomAnd( nactive nwell )     ;N ACTIVE WELL STRAPS IN NWELL  
nstraps = geomOr( nastrap nstrap )     ;N ACTIVE WELL STRAPS IN NWELLS            
nstrapL = geomOr( nstraps )                                                       
nastrtp = geomButting( nastrap pinanw )  ;N ACTIV TOUCHING P ACTIV IN ANWELL      
nstrtp  = geomButting( nstrap pinnw )    ;N ACTIV TOUCHING P ACTIV IN NWELL  
nstrtps = geomButting( nstraps pinnws )  ;N ACTIV TOUCHING P ACTIV IN NWELLS      
pastrtn = geomButting( pastrap ninapw )  ;P ACTIV TOUCHING N ACTIV IN APWELL      
pstrtn  = geomButting( pstrap ninpw )    ;P ACTIV TOUCHING N ACTIV IN PWELL  
pstrtns = geomButting( pstraps ninpws )  ;P ACTIV TOUCHING N ACTIV IN PWELLS      
;  
;******* POLY  RESISTOR **************  
;  
poly5v  = geomAnd( poly geomAnd(active awells ) ) ; POLY IN ANALOG AREAS          
;                                                                                 
gate    = geomAnd( active poly )                        ; ALL GATES  
trprot  = geomEnclose( siprot gate )  
siprotx = geomAndNot( siprot trprot )  
;  
polnoac = geomAndNot( poly active )                     ; POLY OVER FIELD  
siprpo1 = geomOutside( geomAnd( polnoac siprotx ) poly2 )
respo1  = geomOutside( siprpo1 mres )  
respo2  = geomAnd( siprpo1 mres )  
rnpoly  = geomAndNot( geomOr( respo1 respo2 ) pplus )   ; POLY RESISTORS          
rpoly   = geomAndNot( rnpoly cap )                      ; POLY N+ RESISTOR BODY   
rpocap  = geomAnd( rnpoly cap )                         ; POLY CAP RESISTOR BODY  
;  
polconn = geomAndNot( poly geomOr( rpoly rpocap )) ;CONNECT POLY (GATE INCLUDED) 
;  
;******* CAPACITOR DERIVATIONS ******                                             
;                                                                                 
sipmrpo = geomEnclose( siprot geomAnd(poly cap) )                                 
cpo1po2 = geomAnd( cap geomAnd( poly poly2 ) )
;                                                                                 
;******* SILICIDE INTERCONNECT OVER DIFFUSIONS ******  
;  
pdifsi  = geomAndNot( pdiff0  siprotx )  
ndifsi  = geomAndNot( ndiff0  siprotx )  
;  
;******* TRANSISTOR DERIVATIONS ******  
;  
ninpwpo = geomOverlap( ninpws poly )    ;N ACTIVE FOR NMOS                     
ngate0  = geomAnd( ninpwpo polconn )  
ngate   = geomAndNot( geomAndNot( ngate0 awells ) markgen ) ;NMOS GATE         
angate  = geomAndNot( geomAnd( ngate0 awells ) markgen ) ; 5V NMOS GATE        
ngates  = geomOr( ngate angate )                                               
;  
pinnwpo = geomOverlap( pinnws poly )    ;P ACTIVE FOR PMOS                     
pgate0  = geomAnd( pinnwpo polconn )  
pgate   = geomAndNot( geomAndNot( pgate0 awells ) markgen ) ;PMOS GATE         
apgate  = geomAndNot( geomAnd( pgate0 awells ) markgen ) ; 5V PMOS GATE        
pgates  = geomOr( pgate apgate )                                               
;  
ivIf( switch("bendopti") then  
ivIf((switch("drc?") && switch("extract?")) geomConnect( via( vi2 metal3 metal2 )))  
ngata   = geomGetVertex( ngates keep == 4 )  ;  RECTANGULAR TRANSISTOR             
ngatb   = geomAndNot( ngate ngata )          ;  UNRECTANGULAR STANDARD TRANSISTOR  
angatb  = geomAndNot( angate ngata )         ;  UNRECTANGULAR ANALOG TRANSISTOR    
ngatbs  = geomOr( ngatb angatb )             ;  UNRECTANGULAR TRANSISTORS      
;  
ngatz   = geomAnd( geomSize( ngatbs .05 ) active )                             
ngatr   = drc( geomGetEdge( ngatz coincident active ) width < 150 opposite parallel )  
nmosa   = geomOverlap( ngate geomAnd( ngatr ngate ) keep == 1 )  
nmosc   = geomAndNot( ngatbs nmosa )                                          
;  
pgata   = geomGetVertex( pgates keep == 4 )  ;  RECTANGULAR TRANSISTOR             
pgatb   = geomAndNot( pgate pgata )          ;  UNRECTANGULAR STANDARD TRANSISTOR  
apgatb  = geomAndNot( apgate pgata )         ;  UNRECTANGULAR ANALOG TRANSISTOR    
pgatbs  = geomOr( pgatb apgatb )             ;  UNRECTANGULAR TRANSISTORS          
;  
pgatz   = geomAnd( geomSize( pgatbs .05 ) active )                             
pgatr   = drc( geomGetEdge( pgatz coincident active ) width < 150 opposite parallel )  
pmosa   = geomOverlap( pgate geomAnd( pgatr pgate ) keep == 1 )  
pmosc   = geomAndNot( pgatbs pmosa )                                          
else  
nmosc   = geomOr( bulk )  
pmosc   = geomOr( bulk )  
)  
;  
;******* P+ RESISTOR  AND P+/NWELL DIODE ***  
;  
pdioa   = geomInside( geomAndNot( pinnws poly ) mdiode )                     
pinnw1  = geomAndNot( geomAndNot( pinnws poly ) pdioa )                      
;  
actrp   = geomEnclose( geomOverlap( pinnw1 siprotx ) pdifsi keep > 1 )  
rpnk    = geomOutside( geomAnd( actrp siprotx ) mres ) ; res body without marker  
rpk1    = geomOverlap( geomAnd( actrp siprotx ) mres ) ; marked res body  
rpk     = geomAnd( rpk1 mres )                         ; body limited to marker  
rpkt    = geomAndNot( rpk1 mres )                      ; term defined by marker  
respp   = geomOr( rpnk rpk )                           ; all P resistor body   
;  
diop1   = geomOverlap( actrp mdiode )  
tmp1    = geomOverlap( geomAndNot( diop1 siprotx ) mdiode )  
dpter1  = geomAndNot( tmp1 geomButting( tmp1 nstraps) )                      
diopass = geomOverlap( diop1 dpter1 )  
;  
diopsep = geomAndNot( pdioa geomButting( pdioa nstraps) )                    
dpter2  = geomAndNot( diopsep siprotx )  
;  
tmp1    = geomAndNot( pinnw1 geomOr( pinnwpo actrp )) ; keeps these diodes and  
tmp     = geomAnd( tmp1 siprotx )       ; removes from the netlist the diodes  
diopsp3 = geomOutside( tmp1 tmp )       ; not fully covered by salicide when  
dpter3  = geomAndNot( diopsp3 siprotx ) ; the marker mdiode is not used  
;  
diopx   = geomOr( diopass diopsep )  
diop    = geomOutside( geomOr( diopx diopsp3 ) mpnp ) ; no diode on pnp      
tmp1    = geomOr( dpter1 dpter2 )  
dpter   = geomOr( tmp1 dpter3 )  
;  
;******* VERTICAL BIPOLAR PNP ****                                           
;                                                                            
pnpemit = geomAnd( pinnws mpnp )                                             
pnpem   = geomGetTexted( pnpemit "text" "PNPBG25" )                          
;                                                                            
;******* N+ RESISTOR  AND N+/PWELL DIODE ****  
;  
ndioa   = geomInside( geomAndNot( ninpws poly ) mdiode )                     
ninpw1  = geomAndNot( geomAndNot( ninpws poly ) ndioa )                      
;  
actrn   = geomEnclose( geomOverlap( ninpw1 siprotx ) ndifsi keep > 1 )  
rnnk    = geomOutside( geomAnd( actrn siprotx ) mres ) ; res body without marker  
rnk1    = geomOverlap( geomAnd( actrn siprotx ) mres ) ; marked res body  
rnk     = geomAnd( rnk1 mres )                         ; body limited to marker  
rnkt    = geomAndNot( rnk1 mres )                      ; term defined by marker  
resnp   = geomOr( rnnk rnk )                           ; all P resistor body  
;  
dion1   = geomOverlap( actrn mdiode )  
tmp1    = geomOverlap( geomAndNot( dion1 siprotx ) mdiode )  
dnter1  = geomAndNot( tmp1 geomButting( tmp1 pstraps) )                      
dionass = geomOverlap( dion1 dnter1 )  
;  
dionsep = geomAndNot( ndioa geomButting( ndioa pstraps) )                    
dnter2  = geomAndNot( dionsep siprotx )  
;  
tmp1    = geomAndNot( ninpw1 geomOr( ninpwpo actrn ))  
tmp     = geomAnd( tmp1 siprotx )  
dionsp3 = geomOutside( tmp1 tmp )       ; to remove from extract the diodes which  
dnter3  = geomAndNot( dionsp3 siprotx ) ; salicide doesn't cover the entire area  
;  
dionx   = geomOr( dionass dionsep )  
dion    = geomOr( dionx dionsp3 )  
tmp1    = geomOr( dnter1 dnter2 )  
dnter   = geomOr( tmp1 dnter3 )  
;  
;******* CONTACT DERIVATIONS ******  
;  
actct   = geomAnd( contact geomOr( pdifsi ndifsi ) )     ;CONTACT ON ACTIVE   
polyct  = geomAnd( contact geomAndNot(poly poly2 ) )     ;CONTACT ON POLY    
poly2ct = geomAnd( contact poly2 )                       ;CONTACT ON POLY2   
dpct    = geomOr( dpter )  
dnct    = geomOr( dnter )  
;  
;******* INTERCONNECT EXTENSIONS *****  
;  
subst   = geomOr( sub )            ; SUBSTRATE TERMINAL                      
pdifsi  = geomOr( pdifsi rpkt ) ; salicided act extended to unsalicided Pres ter  
ndifsi  = geomOr( ndifsi rnkt ) ; salicided act extended to unsalicided Nres ter  
ndifct  = geomOr( ndifsi )        ;SALICIDE CONNECTION TO NDIF  
pdifct  = geomOr( pdifsi )        ;SALICIDE CONNECTION TO PDIF  
sali    = geomOr( pdifsi  ndifsi )     ;SALICIDE INTERCONNECT ON DIFFUSION  
;  
;********* CONNECTIVITY  LABELLING  
;  
    ivIf( switch("samenet") then  
;  
changeLabel(  
( "gnd1!" "gnd!"  ) ( "gnd2!" "gnd!" ) ( "vdd1!" "vdd!" ) ( "vdd2!" "vdd!" )  
( "VSS:" "gnd!"  ) ( "VDD:" "vdd!" ) ( "GND:" "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!" )  
   )  
;  
;  SPLIT OF METALLISATION INTO "PIN" & "DRAWING" PURPOSE  
;  
dpoly   = geomGetPurpose( "poly" "drawing" 0 20 )  
ppoly   = geomGetPurpose( "poly" "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 ))  
)  
;  
;  
;**************************************  
;********  DRC  SECTION  **************  
;**************************************  
;  
;  
;  
ivIf( (switch( "drc?" ) && switch( "usenotext" ))  
  then  
               geomConnect(  
                via( vi2       metal3   metal2 )  
                via( via       metal2   metal1 )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2 )                                  
                via( actct     metal1   sali )  
                via( ndifct    sali     ndifsi )  
                via( pdifct    sali     pdifsi )  
                via( dpct      sali     dpter )  
                via( dnct      sali     dnter )  
                via( pstrap    sali     pwell   )  
                via( nstrap    sali     nwell  )  
                via( pastrap   sali     apwell  )                                
                via( nastrap   sali     anwell )                                 
                          )  
    )  
ivIf( (switch( "drc?" ) && switch( "nodetext" ))  
  then  
               geomConnect(  
                via( vi2       metal3   metal2 )  
                via( via       metal2   metal1 )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2 )                                  
                via( actct     metal1   sali )  
                via( ndifct    sali     ndifsi )  
                via( pdifct    sali     pdifsi )  
                via( dpct      sali     dpter )  
                via( dnct      sali     dnter )  
                via( pstrap    sali     pwell   )  
                via( nstrap    sali     nwell  )  
                via( pastrap   sali     apwell  )                                
                via( nastrap   sali     anwell )                                 
                label( "pintext" metal3 metal2 metal1 )                          
                label( "nodetext" sali metal3 metal2 metal1 )                    
                          )  
     )  
;  
ivIf( switch( "drc?" ) then        ; Beginning of the drc section  
 ivIf( !switch( "usenotext" ) && !switch( "nodetext" )  
   then  
               geomConnect(  
                via( vi2       metal3   metal2 )  
                via( via       metal2   metal1 )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2 )                                  
                via( actct     metal1   sali )  
                via( ndifct    sali     ndifsi )  
                via( pdifct    sali     pdifsi )  
                via( dpct      sali     dpter )  
                via( dnct      sali     dnter )  
                via( pstrap    sali     pwell   )  
                via( nstrap    sali     nwell  )  
                via( pastrap   sali     apwell  )                                
                via( nastrap   sali     anwell )                                 
                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 )  
                           )  
      )  
;  
;  
; ****** UNCORRECT  GEOMETRIES *****  
;  
offGrid( nwell      0.05      "off-grid nwell    " )  
offGrid( anwell     0.05      "off-grid anwell   " )                           
offGrid( apwell     0.05      "off-grid apwell   " )                           
offGrid( active     0.05      "off-grid active   " )  
offGrid( poly       0.05      "off-grid poly     " )  
offGrid( pplus      0.05      "off-grid pplus    " )  
offGrid( nldprot    0.05      "off-grid nldprot  " )  
offGrid( cap        0.05      "off-grid cap      " )                           
offGrid( poly2      0.05      "off-grid poly2    " )                           
offGrid( siprot     0.05      "off-grid siprot   " )  
offGrid( contact    0.05      "off-grid contact  " )  
offGrid( metal1     0.05      "off-grid metal1   " )  
offGrid( via        0.05      "off-grid via      " )  
offGrid( metal2     0.05      "off-grid metal2   " )  
offGrid( vi2        0.05      "off-grid vi2      " )  
offGrid( metal3     0.05      "off-grid metal3   " )  
offGrid( glass      0.05      "off-grid glass    " )  
offGrid( nitride    0.05      "off-grid nitride  " )  
offGrid( polyi      0.05      "off-grid polyimide" )  
;  
saveDerived( geomGetNon45( nwell   ) "nwell     non 45 degre angle" )  
saveDerived( geomGetNon45( anwell  ) "anwell    non 45 degre angle" )          
saveDerived( geomGetNon45( apwell  ) "apwell    non 45 degre angle" )          
saveDerived( geomGetNon45( active  ) "active    non 45 degre angle" )  
saveDerived( geomGetNon45( poly    ) "poly      non 45 degre angle" )  
saveDerived( geomGetNon45( pplus   ) "pplus     non 45 degre angle" )  
saveDerived( geomGetNon45( nldprot ) "nldprot   non 45 degre angle" )  
saveDerived( geomGetNon45( cap     ) "cap       non 45 degre angle" )          
saveDerived( geomGetNon45( poly2   ) "poly2     non 45 degre angle" )          
saveDerived( geomGetNon45( siprot  ) "siprot    non 45 degre angle" )  
saveDerived( geomGetNon45( contact ) "contact   non 45 degre angle" )  
saveDerived( geomGetNon45( metal1  ) "metal1    non 45 degre angle" )  
saveDerived( geomGetNon45( via     ) "via       non 45 degre angle" )  
saveDerived( geomGetNon45( metal2  ) "metal2    non 45 degre angle" )  
saveDerived( geomGetNon45( vi2     ) "via2      non 45 degre angle" )  
saveDerived( geomGetNon45( metal3  ) "metal3    non 45 degre angle" )  
saveDerived( geomGetNon45( glass   ) "glass     non 45 degre angle" )  
saveDerived( geomGetNon45( nitride ) "nitride   non 45 degre angle" )  
saveDerived( geomGetNon45( polyi   ) "polyimide non 45 degre angle" )  
;  
;  
; ****** BOND PAD DERIVATIONS ******  
;  
pad    = geomOr(geomAnd(metal1 nitride) geomAnd(metal2 nitride)) ; PAD OPENING  
pad150=geomOverlap(pad geomSize(pad -44.95))  
othpad=geomAndNot(pad pad150)  
pad126=geomOverlap(othpad geomSize(othpad -37.95))  
othpad=geomAndNot(othpad pad126)  
pad100=geomOverlap(othpad geomSize(othpad -37.45))  
;  
s12pad = geomSize( pad 12 )                          ;CREATE PAD REGION  
s30pad = geomSize( pad 30 )                          ;CREATE PAD ERROR REGION  
bpdnwl = geomOverlap( nwell  pad )                   ;FIND NWELL   UNDER     PAD  
bpdmt1 = geomOverlap( geomAnd( s30pad metal1 ) pad ) ;FIND METAL1 RELATED TO PAD  
bpdvia = geomOverlap( via pad )                      ;FIND VIA     UNDER     PAD  
bpdmt2 = geomOverlap( geomAnd( s30pad metal2 ) pad ) ;FIND METAL2 RELATED TO PAD  
bpdvi2 = geomOverlap( vi2 geomSize( pad 2 ) )        ;FIND VIA2    UNDER     PAD  
bpdmt3 = geomOverlap( geomAnd( s30pad metal3 ) pad ) ;FIND METAL3 RELATED TO PAD  
;  
; ****** FIND REGIONS NOT UNDER BOND PADS ******  
;  
nbpdnw = geomAndNot( nwell  bpdnwl ) ;FIND NWELL NOT UNDER PADS  
nbpdm1 = geomAndNot( metal1 bpdmt1 ) ;FIND METAL1 NOT UNDER PADS  
nbpdvi = geomAndNot( via bpdvia )    ;FIND VIA NOT UNDER PADS  
nbpdm2 = geomAndNot( metal2 bpdmt2 ) ;FIND METAL2 NOT UNDER PADS  
nbpdv2 = geomAndNot( vi2 bpdvi2 )    ;FIND VIA2 NOT UNDER PADS  
nbpdm3 = geomAndNot( metal3 bpdmt3 ) ;FIND METAL3 NOT UNDER PADS  
;                                                                                  
;******** ********* ********* ********* ********* ********* ********* **********   
;   ANWELL CHECKS LEVEL 40                                                         
;*******************************************************************************   
;                                                                                  
drc(anwell          width < 2.4     "Rule 40.1  anwell width              >2.4")   
drc(anwell          sep   < 3.2     "Rule 40.2  anwell space  same net    >3.2")   
drc(anwell          notch < 3.2     "Rule 40.2  anwell notch              >3.2")   
drc(anwell          sep   < 4.8 diffNet "Rule 40.3  anwell space diff net >4.8")   
drc(anwell  nwell       sep < 4.8 diffNet                                          
                            "Rule 40.4  anwell/nwell space diff net       >4.8")   
drc(anwell  nwell   0 < sep < 2.0                                                  
                            "Rule 40.5  anwell/nwell space same net       >2.0")   
saveDerived( geomAnd(anwell nwell)                                                 
                               "Rule 40.6  anwell/nwell intersec not allowed"  )   
drc(anwell  apwell  0 < sep < 1.5   "Rule 40.7  anwell/apwell space       >1.5")   
saveDerived( geomAnd(anwell apwell)                                                
                               "Rule 40.8  anwell/apwell intersec not allowed" )   
drc(anwell  pinanw  enc   < 2.4     "Rule 40.9  anwell enclos of P act 5V >2.4")   
drc(anwell  nstraps 0 < enc < 1.0   "Rule 40.10 anwell enclos of Nws str  >1.0")   
drc(anwell  ninpws 0 < sep < 2.4 "Rule 40.11 anwell dist to N+ apw/pw act >2.4")   
drc(anwell  pstrap  sep   < 0.7     "Rule 40.12 anwell dist to pstrap     >0.7")   
; Rule 40.13 "shared butted straps anwell/nwell allowed if 3.3v equipotential      
; anwell - nwell " cannot be checked, then these configuration remains error "     
nanwcros = geomCoincident( nastrap anwell )                                        
saveDerived( geomAnd( geomSize( nanwcros 0.1 ) nwell )                             
 " Rule 40.imp5 : N act butting or crossing anwell-nwell boundary not allowed ")   
drc( geomSize( anwell  0.2 ) sep < 2.8                                             
                            "Rule 40.14 anwell space after 0.2 um sizing  >2.8")   
anwellsz = geomStamp( geomSize( anwell  0.2 ) anwell)                              
drc( anwellsz  sep < 4.4 diffNet                                                   
              "Rule 40.15 anwell diff potentials space after 0.2 um sizin >4.4")   
drc( anwell geomAnd( poly active ) enc < 0.6                                       
                       "Rule 40.16 anwell enclosure of poly over active  > 0.6")   
;Rule 40.17 "anwell space to poly over active outside the anwell : already         
;             checked by Rule 41.10 "                                              
saveDerived( geomGetEdge( anwell over poly over active)                            
                       " Rule 40.17 anwell may not intersect poly over active" )   
; nwconn = geomAndNot(nbpdnw geomOutside(nbpdnw nstraps))                          
; anwnco = geomAndNot(anwell geomButting(anwell nwconn))                           
; saveDerived( geomOutside( anwnco nstraps )                                       
;                           "Rule 40.imp1  anwell not connected to any strap"  )   
; Rule 40.10b : anwell straps across anwell boudary allowed by Rule 40.10 are      
;               complemented by the following implicite rules                      
 drc( anwell nanwcros ovlp < 1.1 "Rule 40.imp3 strap width in anwell > 1.1 ")      
saveDerived( geomOutside( geomAnd( geomSize( nanwcros 0.1 ) apwell ) ninapw )      
       " Rule 40.imp4 : N active butting anwell-apwell boundary not allowed ")     
saveDerived( geomAnd( geomSize( nanwcros 0.1 ) pwell )                             
 " Rule 40.imp6 : N act butting or crossing anwell-pwell boundary not allowed ")   
;                                                                                  
;******** ********* ********* ********* ********* ********* ********* **********   
;   APWELL CHECKS LEVEL 41                                                         
;*******************************************************************************   
;                                                                                  
drc(apwell          width < 2.4     "Rule 41.1  apwell width              >2.4")   
drc(apwell          sep   < 3.2     "Rule 41.2  apwell space              >3.2")   
drc(apwell          notch < 3.2     "Rule 41.2  apwell notch              >3.2")   
drc(apwell  nwell   0 < sep < 2.0   "Rule 41.3  apwell dist to nwell      >2.0")   
saveDerived( geomAnd(apwell nwell)  "Rule 41.4  apwell not allowed on anwell  ")   
drc(apwell  ninapw 0 < enc < 2.4    "Rule 41.5  apwell enclos of N act    >2.4")   
drc(apwell  pstraps enc   < 1.0     "Rule 41.6  apwell enclos of Pw str   >1.0")   
drc(apwell  pinnws  sep   < 1.7     "Rule 41.7  apwell dist to P+ nws act >1.7")   
;Rule 41.8 "butted contacts apwell/pwell allowed" already checked by Rule 41.6     
drc( apwell geomAnd( poly active ) enc < 0.6                                       
                       "Rule 41.9  apwell enclosure of poly over active  > 0.6")   
;Rule 41.10 "apwell space to poly over active outside the apwell : already         
;             checked by Rule 40.14 "                                              
saveDerived( geomGetEdge( apwell over poly over active)                            
                       " Rule 41.11 apwell may not intersect poly over active" )   
napwcros = geomCoincident( ninapw apwell )                                         
 drc( apwell napwcros ovlp < 1.1 "Rule 41.imp3 n active width in apwell > 1.1 ")   
saveDerived( geomOutside( geomAnd( geomSize( napwcros 0.1 ) anwell ) nastrap )     
        "Rule 41.imp4 : N active crossing apwell boundary must have anstrap ")     
saveDerived( geomAnd( geomSize( napwcros 0.1 ) nwell )                             
              "Rule 41.imp5 : N active must not cross apwell-nwell boundary ")     
saveDerived( geomAnd( geomSize( napwcros 0.1 ) pwell )                             
              "Rule 41.imp6 : N active must not cross apwell-pwell boundary ")     
npwcross = geomCoincident( ninpw pwell )                                           
saveDerived( geomAnd( geomSize( npwcross 0.1 ) anwell )                            
             " Rule 41.imp8 : N active must not cross pwell-anwell boundary ")     
saveDerived( geomAnd( geomSize( npwcross 0.1 ) apwell )                            
              "Rule 41.imp9 : N active must not cross pwell-apwell boundary ")     
; saveDerived( geomOutside( pwells pstrap)  "Pwells not connected to any strap")   
;                                                                                  
;******** ********* ********* ********* ********* ********* ********* **********  
;   NWELL CHECKS LEVEL 1  
;*******************************************************************************  
;  
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  ")  
drc(nwell          notch < 2.0           "Rule 1.2  nwell notch           >2  ")  
drc(nwell          sep   < 3.0 diffNet   "Rule 1.3  nwell space  diff net >3  ")  
drc(nwell  pinnw   enc   < 1.7           "Rule 1.4  nwell enclos of P act >1.7")   
drc(nwell  nstraps 0 < enc < 0.3          "Rule 1.5  nwell enclos of Nw str>0.3")   
;drc(nwell  ninpw   sep   < 1.8           "Rule 1.6  nwell dist  to N+ act >1.8")   
drc(nwell  ninpw 0 < sep < 1.8           "Rule 1.6  nwell dist  to N+ act >1.8")   
drc(nwell  pstrap  sep   < 0.7           "Rule 1.7  nwell dist  to pw str >0.7")  
; checked by rules 1.4 & 1.6              Rule 1.8   
nwellsz = geomStamp( geomSize( nwell 0.2 ) nwell)  
drc( nwellsz       sep < 1.6             "Rule 1.9  +0.2u siz nwell space >1.6")  
drc( nwellsz       sep < 2.6 diffNet     "Rule 1.10 +0.2u siz nwell space >2.6")   
; previous 1.10 specific for HCMOS5A and kept for HCMOS5 till next info            
; saveDerived( geomOutside( nbpdnw nstrap) "Nwell not connected to any strap"  )  
nnwcross = geomCoincident( nstrap nwell )                                          
 drc( nwell nnwcross ovlp < 1.1 "Rule 1.imp3 strap width in nwell > 1.1 ")         
saveDerived( geomOutside( geomAnd( geomSize( nnwcross 0.1 ) pwell ) ninpw )        
                   " Rule 1.imp4 : N active must cross the nwell boundary ")       
saveDerived( geomOutside( geomAnd( geomSize( nnwcross 0.1 ) anwell ) nastrap )     
                   " Rule 1.imp5 : N active must cross the nwell boundary ")       
saveDerived( geomAnd( geomSize( nnwcross 0.1 ) apwell )                            
               " Rule 1.imp6 : N active must not cross nwell-apwell boundary ")    
npwcross = geomCoincident( ninpw pwell )                                           
 drc( pwell npwcross ovlp < 1.1 "Rule 1.imp7 n active width in pwell > 1.1 ")      
saveDerived( geomOutside( geomAnd( geomSize( npwcross 0.1 ) nwell ) nstrap )       
                    "Rule 1.imp8 : N active must cross the pwell boundary ")       
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;   ACTIVE CHECKS LEVEL 2  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
stndgat = geomAndNot( geomAndNot( gate awells ) nodrc )                            
analgat = geomAndNot( geomAnd( gate awells ) nodrc )                               
sramgat = geomAnd( gate nodrc )                                                    
drc( geomGetEdge( stndgat inside poly ) width < 0.8                                
                                         "Rule 2.1  standard mos width    >0.8")   
drc( geomGetEdge( sramgat inside poly ) width < 0.6                                
                                         "Rule 2.4  sram mos width        >0.6")   
drc(nactive            width < 0.6       "Rule 2.2  nactive width         >0.6")  
drc(pactive            width < 0.6       "Rule 2.3  pactive width         >0.6")  
drc(actinw             sep   < 1.0       "Rule 2.5  active 3V space       >1.0")   
drc(actinw             notch < 1.0       "Rule 2.5  active 3V notch       >1.0")   
drc(nstrap  pstrap     sep   < 1.0       "Rule 2.6  Nwstr dist to Pwstr   >1.0")  
drc( geomSize( active 0.2 ) sep < 0.6    "Rule 2.7  +0.2u siz activ space >0.6")  
drc( geomGetEdge( active inside poly ) notch < .5 only_perp     
                        "Rule 2.8 concave active corner under gate not allowed")  
drc(actinaw            sep   < 1.4       "Rule 2.9  active space in Awell >1.4")   
drc(actinaw            notch < 1.4       "Rule 2.9  active notch in Awell >1.4")   
drc( geomGetEdge( analgat inside poly ) width < 1.0                                
                                         "Rule 2.10 analog 5V trans width >1.0")   
drc( geomSize( actinaw 0.15 ) sep < 1.1                                            
                            "Rule 2.11 active 5V space after 0.2um sizing >1.1")   
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  POLY CHECKS LEVEL 13  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
drc(poly               width < 0.5       "Rule 13.1 poly width            >0.5")  
drc(poly               sep   < 0.8       "Rule 13.2 poly space            >0.8")  
drc(poly               notch < 0.8       "Rule 13.2 poly notches          >0.8")  
drc(poly    active     enc   < 0.6       "Rule 13.3 poly endcap           >0.6")  
saveDerived( geomCoincident(poly active) "Rule 13.3 poly endcap           >0.6")  
drc(poly    active     sep   < 0.4       "Rule 13.4 poly dist  to active  >0.4")  
;  
 drc( active geomGetEdge( gate coincident poly ) enc < 0.95   
                                        "Rule 13.5 pol-act min SD width  >.95")  
; Following lines will be the correct check for 13.5, once corelib cells having  
; these bad configurations have been corrected.  
; temp1   = drc( geomGetEdge( gate coincident poly ) sep < 0.95 )  
; temp2   = geomOverlap( geomAndNot( active poly ) temp1 )  
; closgat = geomOverlap( temp2 contact )  
; shortDS = drc( active geomGetEdge( gate coincident poly ) enc < 0.95 )  
; saveDerived( geomOr( shortDS closgat ) "Rule 13.5 pol-act min SD width  >.95")  
;  
drc(poly5v             width < 0.8       "Rule 13.6 poly width in 5V mos  >0.8")   
saveDerived( geomAndNot( ppoly dpoly )  
                             "Rule 13.imp1  POLY purpose PIN without DRAWING " )  
;saveDerived( geomOverlap( alstrps poly )   
;                             "Rule 13.imp2  poly over strap not allowed      ")  
;  
;******** ********* ********* ********* ********* ********* ********* **********   
;  CAP CHECKS LEVEL 12                                                             
;******** ********* ********* ********* ********* ********* ********* **********   
;                                                                                  
saveDerived( geomAnd( cap geomOr( active pplus ))                                  
                                        "Rule 12.0 cap only allowed on field  ")   
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  notches           >1.0")   
drc( cap    sipmrpo    enc   < 1.5      "Rule 12.4 cap enclosure of siprot>1.5")   
drc( cap    poly       sep   < 2.0 "Rule 12.5 cap distance to unrelated poly >2.0")   
;                                                                                  
;******** ********* ********* ********* ********* ********* ********* **********   
;  POLY2 CHECKS LEVEL 11                                                           
;******** ********* ********* ********* ********* ********* ********* **********   
;                                                                                  
saveDerived( geomOr( geomAnd(poly2 active ) geomAndNot(poly2 poly ) geomAndNot(    
  poly2 cap))                   "Rule 11.0 poly2 only allowed on field or poly")   
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 notches          >1.0")   
drc(cap      poly2      enc   < 1.0     "Rule 11.3 poly2 enclosed by cap  >1.0")   
drc(poly     poly2      enc   < 1.0     "Rule 11.4 poly2 enclosed by poly >1.0")   
drc(poly2    contact    sep   < 0.6     "Rule 11.5 poly2 dist  to contact >0.6")   
drc(poly2    contact    enc   < 0.6     "Rule 11.6 poly2 enclos of cont   >0.6")   
;saveDerived( geomAnd(poly2 metal2 )     "Rule 11.7 no metal2 allowed on poly2 ")   
;drc(poly2    metal2     sep   < 1.0     "Rule 11.8 poly2 dist to metal2   >1.0")   
drc(siprot   poly2      enc   < 0.6  "Rule 11.9 enclos of poly2 by siprot >0.6")   
;                                                                                  
;******** ********* ********* ********* ********* ********* ********* **********  
;  NLDDPROT  CHECKS LEVEL 14  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
drc( nldprot           width < 0.8       "Rule 14.1 nlddprot width        >0.8")  
drc( nldprot           sep   < 0.8       "Rule 14.2 nlddprot space        >0.8")  
drc( nldprot           notch < 0.8       "Rule 14.2 nlddprot notch        >0.8")  
drc( nldprot active    enc   < 0.5       "Rule 14.3 nlddprot enc of N+ act>0.5")  
drc( nldprot active    sep   < 0.5       "Rule 14.4 nlddprot dist to N+ ac>0.5")  
drc( nldprot ngate     enc   < 1.0       "Rule 14.5 enclosure of N gate   >1.0")  
nldgate = geomAndNot( ngate nldprot )  
drc( nldprot nldgate   sep   < 1.0       "Rule 14.6 distance to N gate    >1.0")  
drc( nldprot pplus   0 < sep < 0.8       "Rule 14.7 distance to pplus     >0.8")  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  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 active      enc   < 0.5       "Rule 17.3 pplus enc of P+ act   >0.5")  
drc( pplus active      sep   < 0.5       "Rule 17.4 pplus dist to N+ act  >0.5")  
drc( pplus pstrtn      ovlp  < 0.8       "Rule 17.5 abutt pw strap width  >0.8")  
drc( pstrtn geomGetEdge( gate inside active ) sep < 1.2 opposite  
                                         "Rule 17.6 gate to abut pw strap >1.2")  
; already checked by 17.5 & 17.6         "Rule 17.7 combined for 17.5/6   >2.0"  
drc( geomGetEdge( nstrtp butting pplus ) active ovlp < 0.8 opposite parallel  
                                         "Rule 17.8 abutt nw strap width  >0.8")  
drc( nstrtp geomGetEdge( gate inside active ) sep < 1.2 opposite  
                                         "Rule 17.9 gate to abut nw strap >1.2")  
; already checked by 17.8 & 17.9         "Rule 17.10 combined for 17.8/9  >2.0"  
drc( pplus pastrtn     ovlp  < 0.8     "Rule 17.11 abutt apw strap width  >0.8")   
drc( pastrtn geomGetEdge( gate inside active ) sep < 1.2 opposite                  
                                       "Rule 17.12 gate to abut apw strap >1.2")   
; already checked by 17.11 & 17.12     "Rule 17.13 combined for 17.11/12   >2.0"   
drc( geomGetEdge( nastrtp butting pplus ) active ovlp < 0.8 opposite parallel      
  fig                                  "Rule 17.14 abutt anw strap width  >0.8")   
drc( nastrtp geomGetEdge( gate inside active ) sep < 1.2 opposite                  
                                       "Rule 17.15 gate to abut anw strap >1.2")   
; already checked by 17.14 & 17.15      "Rule 17.16 combined for 17.14/15  >2.0"   
;   
;******** ********* ********* ********* ********* ********* ********* **********  
;  SIPROT CHECKS LEVEL 18  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
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 ext on active  >0.4")  
drc( siprot active     ovlp  < 0.6       "Rule 18.4 siprot int of active  >0.6")  
drc( active siprot     enc   < 0.8       "Rule 18.5 active ext on siprot  >0.8")  
drc( siprot geomGetEdge( gate inside active ) 0 <= enc < 1.7   
                                     "Rule 18.6 siprot extension on gate  >1.7")  
drc( siprot actct      sep   < 0.5       "Rule 18.7 siprot dist to act ct >0.5")  
drc( siprot active     sep   < 0.6       "Rule 18.8 siprot dist to active >0.6")  
drc( siprot poly       sep   < 0.6       "Rule 18.9 siprot dist to poly   >0.6")  
drc( siprot polyct     sep   < 0.5     "Rule 18.10 siprot dist to poly ct >0.5")  
drc( siprot poly       enc   < 0.4       "Rule 18.11 siprot ext on poly >  0.4")  
saveDerived( geomGetEdge( siprot inside gate )  
                    "Rule 18.12 salicide prot must overlap gate on both sides ")  
drc( siprot geomGetEdge( gate inside active ) sep < 0.9   
                                        "Rule 18.13 siprot dist  to gate  >0.9")  
saveDerived( geomGetEdge( pplus inside geomAnd( siprot poly ) )  
              " Rule 18.14 siprot intersection with P+ of P+ poly not allowed ")  
drc( siprot geomGetEdge( pplus inside poly ) sep < 1.1  
                          "Rule 18.15 siprot distance 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( geomEnclose( geomOr(pstrtns nstrtps ) geomNot( siprot ) )             
      "Rule 18.17 siprot must cross P+ implant boundary in case of abut strap ")   
drc( siprot geomGetEdge( pplus inside active ) sep < 1.1  
              "Rule 18.18 siprot dist to P+ active in case of abut strap >1.1 ")  
drc( geomGetEdge( pplus inside active ) siprot enc < 1.1  
         "Rule 18.19 P+ active extension on siprot in case of abut 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 intersection of poly for unsalicided poly > 0.6 ")  
drc( siprot poly2ct    sep   < 0.3  "Rule 18.22 siprot dist to poly2 cont >0.3")   
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  CONTACT CHECKS LEVEL 19  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
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(contact            notch < 0.8       "Rule 19.2  contact notche       >0.8")  
drc(poly    polyct     enc   < 0.3       "Rule 19.3  contact enc by poly  >0.3")   
drc(active  actct      enc   < 0.3       "Rule 19.4  contact enc by activ >0.3")   
drc(polyct  active     sep   < 0.6       "Rule 19.5  cont/poly dist to act>0.6")  
drc(actct   poly       sep   < 0.6       "Rule 19.6  cont/act dist to poly>0.6")  
; 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 silicide.  
saveDerived( geomAnd( polyct active )    "Rule 19.8  cont poly/activ forbidden")  
saveDerived( geomAnd( contact siprot )   "Rule 19.9  siprot on cont forbidden ")  
saveDerived( geomAndNot( contact geomOr( actct polyct poly2ct ))                   
                "Rule 19.imp1 cont without poly nor poly2 nor active forbidden")   
saveDerived( geomAndNot(contact metal1)    
                                  "Rule 19.imp2 contact not covered by metal1 ")  
;saveDerived( geomOutside( geomAndNot( active poly ) contact )   
;                                     "Rule 19.imp3 source/drain not contacted")  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  METAL1 CHECKS LEVEL 23  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
drc(metal1             width < 0.8       "Rule 23.1 metal1 width          >0.8")   
drc(metal1             sep   < 0.8       "Rule 23.2 metal1 space          >0.8")  
drc(metal1             notch < 0.8       "Rule 23.2 metal1 notche         >0.8")  
drc(metal1  actct      enc   < 0.3       "Rule 23.3 metal1 enc of activ ct>0.3")   
drc(metal1  polyct     enc   < 0.3       "Rule 23.4 metal1 enc of poly ct >0.3")   
saveDerived( geomSize( nbpdm1 -12.5 )    "Rule 23.5 metal1 max width X & Y <25")  
drc(metal1  poly2ct    enc   < 0.3      "Rule 23.6 metal1 enc of poly2 ct >0.3")   
saveDerived( geomAndNot( pmetal1 dmetal1 )  
                             "Rule 23.imp1  MET1 purpose PIN without DRAWING " )  
; level 2 checks  
m1power = geomOr( "m1vdd" "m1gnd" )  
m1powz = geomSize( m1power 0.1 )  
m1gndz = geomSize( m1gnd 0.1 )  
saveDerived( geomAnd( m1gndz m1vdd )     "Rule 23.imp2 m1vdd short to m1gnd   ")  
saveDerived( geomAnd( m1io m1power )       
                            "Rule 23.imp3 m1io must not overlap m1 power      ")  
saveDerived( geomAnd( m1io m1int   )       
                            "Rule 23.imp4 m1io must not overlap m1int         ")  
m1int  = geomAndNot( m1int mshort )  
saveDerived( geomAnd( m1powz m1int )     "Rule 23.imp5 m1int short to m1 power")  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  VIA1 CHECKS LEVEL 25  
;******** ********* ********* ********* ********* ********* ********* **********  
;
saveDerived( geomAnd( poly2 via )
                      "Rule 25.0  via1 over poly2 of POLY2/POLY cap forbidden ")  
drc(via                width < 0.6       "Rule 25.1a via width            =0.6")  
drc(via                 area > 0.36      "Rule 25.1b via width            =0.6")  
drc(via                sep   < 0.8       "Rule 25.2  via space            >0.8")  
drc(metal1  nbpdvi     enc   < 0.3       "Rule 25.3  via enclos by metal1 >0.3")   
; Bad vias  
saveDerived( geomAndNot(via metal1)    "Rule 25.imp1 via not covered by metal1")  
saveDerived( geomAndNot(via metal2)    "Rule 25.imp2 via not covered by metal2")  
; Level 2 checks  
m2power = geomOr( "m2vdd" "m2gnd" )  
saveDerived( geomAnd( m1int geomAnd( via m2power ))   
                                        "Rule 25.imp3 m1int short to me2 power")  
saveDerived( geomAnd( m2vdd geomAnd( via m1gnd ))   
                                        "Rule 25.imp4 m1gnd short to m2vdd")  
saveDerived( geomAnd( m2gnd geomAnd( via m1vdd ))   
                                        "Rule 25.imp5 m1vdd short to m2gnd")  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  METAL2 CHECKS LEVEL 27  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
drc(metal2             width < 1.0       "Rule 27.1 metal2 width          >1.0")   
drc(metal2             sep   < 0.9       "Rule 27.2 metal2 space          >0.9")  
drc(metal2             notch < 0.9       "Rule 27.2 metal2 notche         >0.9")  
drc(metal2  nbpdvi     enc   < 0.3       "Rule 27.3 metal2 enclos of via  >0.3")   
saveDerived( geomSize( nbpdm2 -12.5 )    "Rule 27.5 metal2 max width X & Y <25")  
; level 2 checks  
m2powz = geomSize( m2power 0.1 )  
m2gndz = geomSize( m2gnd 0.1 )  
saveDerived( geomAnd( m2gndz m2vdd )     "Rule 27.imp2 m2vdd short to m2gnd")  
saveDerived( geomAnd( m2io m2power )   
                                  "Rule 27.imp3 m2io must not overlap m2 power")  
saveDerived( geomAnd( m2io m2int   ) "Rule 27.imp4 m2io must not overlap m2int")  
m2int  = geomAndNot( m2int mshort )  
saveDerived( geomAnd( m2powz m2int )     "Rule 27.imp5 m2int short to m2 power")  
saveDerived( geomAnd( m1power geomAnd( via m2int ))   
                                       "Rule 27.imp6 met1 power short to m2int")  
saveDerived( geomAndNot( pmetal2 dmetal2 )  
                             "Rule 27.imp1  MET2 purpose PIN without DRAWING " )  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  VIA2 CHECKS LEVEL 32  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
drc(vi2                width < 0.7       "Rule 32.1a vi2 width            =0.7")  
drc(vi2                 area > 0.49      "Rule 32.1b vi2 width            =0.7")  
drc(vi2                sep   < 1.0       "Rule 32.2  vi2 space            >1.0")  
drc(metal2  nbpdv2     enc   < 0.3       "Rule 32.3  vi2 enclos by metal2 >0.3")   
; Bad vias  
saveDerived( geomAndNot( vi2 metal2)   "Rule 32.imp1 vi2 not covered by metal2")  
saveDerived( geomAndNot( vi2 metal3)   "Rule 32.imp2 vi2 not covered by metal3")  
; Level 2 checks  
m3power = geomOr( "m3vdd" "m3gnd" )  
saveDerived( geomAnd( m2int geomAnd( vi2 m3power ))  
                                         "Rule 32.imp3 m2int short to m3 power")  
saveDerived( geomAnd( m3vdd geomAnd( vi2 m2gnd ))  
                                            "Rule 32.imp4 m2gnd short to m3vdd")  
saveDerived( geomAnd( m3gnd geomAnd( vi2 m2vdd ))  
                                            "Rule 32.imp5 m2vdd short to m3gnd")  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  METAL3 CHECKS LEVEL 34  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
drc(metal3             width < 1.3       "Rule 34.1 metal3 width          >1.3")   
drc(metal3             sep   < 1.2       "Rule 34.2 metal3 space          >1.2")   
drc(metal3             notch < 1.2       "Rule 34.2 metal3 notche         >1.2")   
drc(metal3  nbpdv2     enc   < 0.3       "Rule 34.3 metal3 enclos of vi2  >0.3")   
saveDerived( geomSize( nbpdm3 -12.5 )    "Rule 34.5 metal3 max width X & Y <25")  
; level 2 checks  
m3powz = geomSize( m3power 0.1 )  
m3gndz = geomSize( m3gnd 0.1 )  
saveDerived( geomAnd( m3gndz m3vdd )     "Rule 34.imp2 m3vdd short to m3gnd")  
saveDerived( geomAnd( m3io m3power )  
                                  "Rule 34.imp3 m3io must not overlap m3 power")  
saveDerived( geomAnd( m3io m3int   ) "Rule 34.imp4 m3io must not overlap m3int")  
m3int  = geomAndNot( m3int mshort )  
saveDerived( geomAnd( m3powz m3int )    "Rule 34.imp5 m3int1 short to m3 power")  
saveDerived( geomAnd( m2power geomAnd( vi2 m3int ))  
                                         "Rule 34.imp6 m2 power short to m3int")  
saveDerived( geomAndNot( pmetal3 dmetal3 )  
                             "Rule 34.imp1  MET3 purpose PIN without DRAWING " )  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  NITRIDE CHECKS LEVEL 30  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
saveDerived( geomAnd(s12pad contact)       "Rule 30.imp1 no contact under pad ")  
;saveDerived( geomAndNot(pad nwell(s) )    "Rule 30.imp2 nwell   required     ")  
saveDerived( geomAndNot(pad metal1)        "Rule 30.imp3 metal1  required     ")  
saveDerived( geomAndNot(nitride metal2)    "Rule 30.imp4 metal2  required     ")  
saveDerived( geomAndNot(pad metal3)        "Rule 30.imp5 metal3  required     ")  
saveDerived( geomAndNot(pad glass)         "Rule 30.imp8 glass   required     ")  
saveDerived( geomAnd(s12pad polyi)         "Rule 30.imp9 no polyimide over pad")  
drc( bpdvia bpdvi2     sep   < 0.49  
                             "Rule 30.imp10  vi2 shift versus vi1 in pad = 1.0")  
saveDerived( geomAndNot(glass s12pad)      "Rule 30.imp11 glass only on pads  ")  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;  BOND PADS RULES for 126 um (3 mil) or 150 um (4 mil) pad pitch  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
;  Pad Architecture Rules  
;  
; no check, pad is defined from nitride  "Rule 30.1  nitride enclos of pad =0 "  
drc(bpdmt3  pad        enc   < 10        "Rule 30.3  metal3  encl of pad >10.0")   
drc(bpdmt2  pad        enc   < 7         "Rule 30.4  metal2  encl of pad > 7.0")   
drc(bpdmt1  pad        enc   < 4         "Rule 30.5  metal1  encl of pad > 4.0")   
drc(bpdnwl  pad        enc   < 12        "Rule 30.6  nwell   encl of pad >12.0")  
drc(bpdmt1  bpdvia     enc   < 5         "Rule 30.7  m1 enc of pad vi1   > 5.0")  
drc(bpdmt2  bpdvi2     enc   < 5         "Rule 30.8  m2 enc of pad vi2   > 5.0")  
; already checked by 25.1                "Rule 30.10 vi1 size in pad     = 0.6"  
drc( bpdvia            sep   < 1.4       "Rule 30.11 vi1 space in pad    = 1.4")  
viapad = geomOverlap( nitride geomSize( bpdvia .7 ) keep == 1)  
saveDerived( geomAndNot( nitride viapad ) "Rule 30.11 via1 space in pad  = 1.4")  
; already checked by 32.1                "Rule 30.12 vi2 size in pad     = 0.7"  
drc( bpdvi2            sep   < 1.3       "Rule 30.13 vi2 space in pad    = 1.3")  
vi2pad = geomOverlap( nitride geomSize( bpdvi2 .65 ) keep == 1)  
saveDerived( geomAndNot( nitride vi2pad ) "Rule 30.13 via2 space in pad  = 1.3")  
saveDerived( geomAnd(s12pad active)      "Rule 30.14 no active under pad      ")  
saveDerived( geomAnd(s12pad poly)        "Rule 30.15 no poly under pad        ")  
drc(polyi              width < 50        "Rule 30.16 min polyimide width >50.0")  
drc(polyi              sep   < 25        "Rule 30.17 min polyimide space >25.0")  
drc(polyi              notch < 25        "Rule 30.17 min polyimide notch >25.0")  
;  
;  Assembly Rules Specification  
;  
saveDerived(geomAndNot(othpad pad100) "Rule 31.00 Nitride min width = 75um")  
saveDerived(geomButting(pad150 drc(pad sep < 60))   
                              "Rule 31.01 min width for 150 um pitch pad >60.0")  
saveDerived(geomButting(pad126 drc(pad sep < 50))   
                              "Rule 31.02 min width for 126 um pitch pad >50.0")  
drc(pad                sep < 25          "Rule 31.03 minimum pad space  = 25um")  
pad90=geomAndNot(pad150 drc(pad 8099 < area < 8101))  
drc(pad90        90 < width < 175     "Rule 31.06 min double pad width > 175um")  
dbl126=geomAndNot(pad126 drc(pad126 1 < area < 8100))   
dbl150=geomAndNot(pad100 drc(pad100 1 < area < 5776))  
saveDerived( geomOr( dbl126 dbl150 )  "Rule 31.07 min double pad height > 90um")  
drc(pad    active      sep   < 20        "Rule 31.08 pad distance to act >20.0")  
drc(pad    nbpdnw      sep   < 20        "Rule 31.09 pad distance to nwl >20.0")  
drc(pad    poly        sep   < 20        "Rule 31.10 pad distance to poly>20.0")  
drc(pad    contact     sep   < 20        "Rule 31.11 pad distance to cont>20.0")  
drc(pad    nbpdm1      sep   < 20        "Rule 31.12 pad distance to m1  >20.0")  
drc(pad    nbpdvi      sep   < 20        "Rule 31.13 pad distance to via >20.0")  
drc(pad    nbpdm2      sep   < 20        "Rule 31.14 pad distance to m2  >20.0")  
drc(pad    nbpdv2      sep   < 20        "Rule 31.15 pad distance to vi2 >20.0")  
drc(pad    nbpdm3      sep   < 20        "Rule 31.16 pad distance to m3  >20.0")  
drc(polyi  pad         sep   < 25        "Rule 31.17 polyim dist  to pad >25.0")  
; not  manageable                        "Rule 31.18 polyim dist to edge of die"  
;drc(glass  pad         enc   < 5         "Rule 31.4  glass enclos of pad = 5.0")   
;drc(glass  pad     5 < enc   < 50        "Rule 31.4  glass enclos of pad = 5.0")  
;  
;  
)                                  ; end of the drc section  
;  
;  
;**************************************  
;********  EXTRACT  SECTION  **********  
;**************************************  
;  
 ivIf( ( switch("extract?") || switch("pair") || switch("single") ) then  
;               beginning of the extract section  
;  
nowell = geomOutside( geomOverlap( nwells geomOr(poly2 nitride )) active )       
nwells = geomAndNot( nwells nowell )                                             
pwells  = geomAndNot( sub nwells )      ; DERIVED PWELL AREA EVENTUALLY          
;                                       ; SPLITTED BY "MSUB"                     
; to avoid floating nwell under pads  
)  
;  
ivIf( (switch("extract?") && switch( "usenotext" )) then  
               geomConnect(  
                via( vi2       metal3   metal2 )  
                via( via       metal2   metal1 )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2 )                                  
                via( actct     metal1   sali )  
                via( ndifct    sali     ndifsi )  
                via( pdifct    sali     pdifsi )  
                via( dpct      sali     dpter )  
                via( dnct      sali     dnter )  
                via( pstraps   sali     pstrapL  )                               
                via( nstraps   sali     nstrapL )                                
                          )  
      nwells = geomStamp( nwells nstrapL error )  
      pwells = geomStamp( pwells pstrapL error )  
      subst  = geomStamp( subst  pstrapL error )  
    )  
ivIf( (switch("extract?") && switch( "nodetext" )) then  
               geomConnect(  
                via( vi2       metal3   metal2 )  
                via( via       metal2   metal1 )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2 )                                  
                via( actct     metal1   sali )  
                via( ndifct    sali     ndifsi )  
                via( pdifct    sali     pdifsi )  
                via( dpct      sali     dpter )  
                via( dnct      sali     dnter )  
                via( pstraps   sali     pstrapL  )                               
                via( nstraps   sali     nstrapL )                                
                label( "pintext" metal3 metal2 metal1 )                          
                label( "nodetext" sali metal3 metal2 metal1 )                    
                          )  
      nwells = geomStamp( nwells nstrapL error )  
      pwells = geomStamp( pwells pstrapL error )  
      subst  = geomStamp( subst  pstrapL error )  
     )  
;  
ivIf( switch("extract?") then  
 ivIf( !switch( "usenotext" ) && !switch( "nodetext" ) then  
               geomConnect(  
                via( vi2       metal3   metal2 )  
                via( via       metal2   metal1 )  
                via( polyct    metal1   polconn )  
                via( poly2ct   metal1   poly2 )                                  
                via( actct     metal1   sali )  
                via( ndifct    sali     ndifsi )  
                via( pdifct    sali     pdifsi )  
                via( dpct      sali     dpter )  
                via( dnct      sali     dnter )  
                via( pstraps   sali     pstrapL  )                               
                via( nstraps   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  pstrapL error )  
      )  
;  
;**  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  
   angate = geomAnd( angate geomEnclose( polnosub contact)) ; ANmos gates        
   ngates  = geomOr( ngate angate )                                              
   ;  
   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  
   apgate = geomAnd( apgate geomEnclose( polnowel contact)) ; APmos gates        
   pgates  = geomOr( pgate apgate )                                              
      )  
;  
;******** ********* ********* ********* ********* ********* ********* **********  
;**  
;**         DEFINING  TRANSISTORS,  DIODES  AND  RESISTORS  ELEMENTS  
;**         CALCULATE  ELEMENTS  PARAMETERS  
;**  
;******** ********* ********* ********* ********* ********* ********* **********  
;  
;******** AN-MOS  CAPACITOR   DEVICES  ******                                       
;                                                                                   
extractDevice( angate (polconn "PLUS") (ndifsi "MINUS") (pwells "B") "capane3 ivpcell" ) 
;                                                                                    
;********  ANMOS    DEVICES  ******                                                  
;                                                                                    
extractDevice(angate polconn("G") ndifsi("S" "D") pwells("B") "anmos4 ivpcell")      
    anlength = measureParameter( length ( angate inside poly ) 5e-07 )               
    an_wid   = measureParameter( length ( angate coincident poly ) 5e-07 )           
    anbends_f = measureParameter( bends_full ( angate coincident poly over nmosc ) ) 
    anbends_p = measureParameter( bends_part ( angate coincident poly over nmosc ) ) 
    anwidth  = calculateParameter(                                                   
          an_wid - anlength * ( 0.5 * anbends_f + 0.25 * anbends_p ) )               
    saveParameter( anlength "l" )                                                    
    saveParameter( anwidth "w" )                                                     
    saveParameter( anlength "lc" )                                                   
    saveParameter( anwidth "wc" )                                                    
;                                                                                    
;******** 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")  
    nlength = measureParameter( length ( ngate inside poly ) 5e-07 )  
    n_wid   = measureParameter( length ( ngate coincident poly ) 5e-07 )  
    nbends_f = measureParameter( bends_full ( ngate coincident poly over nmosc ) )  
    nbends_p = measureParameter( bends_part ( ngate coincident poly over nmosc ) )  
    nwidth  = calculateParameter(  
          n_wid - nlength * ( 0.5 * nbends_f + 0.25 * nbends_p ) )  
    saveParameter( nlength "l" )  
    saveParameter( nwidth "w" )  
    saveParameter( nlength "lc" )  
    saveParameter( nwidth "wc" )  
;                                                                                    
;******** AP-MOS  CAPACITOR   DEVICES  ******                                        
;                                                                                    
extractDevice( apgate (polconn "PLUS") (pdifsi "MINUS") (nwells "B") "capape3 ivpcell" ) 
;                                                                                    
;********  APMOS    DEVICES  ******                                                  
;                                                                                    
extractDevice( apgate polconn("G") pdifsi("S" "D") nwells("B") "apmos4 ivpcell")     
    aplength = measureParameter( length ( apgate inside poly ) 5e-07 )               
    ap_wid   = measureParameter( length ( apgate coincident poly ) 5e-07 )           
    apbends_f = measureParameter( bends_full ( apgate coincident poly over pmosc ) ) 
    apbends_p = measureParameter( bends_part ( apgate coincident poly over pmosc ) ) 
    apwidth  = calculateParameter(                                                   
          ap_wid - aplength * ( 0.5 * apbends_f + 0.25 * apbends_p ) )               
    saveParameter( aplength "l" )                                                    
    saveParameter( apwidth "w" )                                                     
    saveParameter( aplength "lc" )                                                   
    saveParameter( apwidth "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")  
    plength = measureParameter( length ( pgate inside poly ) 5e-07 )  
    p_wid   = measureParameter( length ( pgate coincident poly ) 5e-07 )  
    pbends_f = measureParameter( bends_full ( pgate coincident poly over pmosc ) )  
    pbends_p = measureParameter( bends_part ( pgate coincident poly over pmosc ) )  
    pwidth  = calculateParameter(  
          p_wid - plength * ( 0.5 * pbends_f + 0.25 * pbends_p ) )  
    saveParameter( plength "l" )  
    saveParameter( pwidth "w" )  
    saveParameter( plength "lc" )  
    saveParameter( pwidth "wc" )  
;  
;********  PO1/PO2  CAPACITOR   DEVICES  ******                                      
;                                                                                    
extractDevice( cpo1po2 (polconn  "PLUS") (poly2 "MINUS") "cpo1po2 ivpcell" )         
    capaval = measureParameter( area ( cpo1po2 ) 1.1e-15 )                           
    saveParameter( capaval "c" )                                                     
;                                                                                    
;********  P.N.P.  VERTICAL  TRANSISTOR  ****                                        
; Terminals are : E = pnpem , B = nwells , C = subst                                 
;                                                                                    
extractDevice( pnpem (pdifsi "E") (nwells "B") (subst "C") "pnpw ivpcell" )          
    saveProperty( pnpem "ModelName" "PNPBG25" )                                      
    saveProperty( pnpem "model" "PNPBG25" )                                          
;                                                                                    
;********  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 ( the square value is 2.2 ohm ) ; an estimation of the length is   
;   done, using the min distance of the siprot to contact ( d=0.5um ).  
; 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)  
;       =  27/W + 1.1/W + 2.3/(((W-1.2)/1.4)+1) =  28.1/W+3.22/(W+0.2)    for N+  
;       =  70/W + 1.1/W + 2.7/(((W-1.2)/1.4)+1) =  71.1/W+3.78/(W+0.2)    for P+  
;       =  75/W + 1.1/W + 2.5/(((W-1.2)/1.4)+1) =  76.1/W+3.50/(W+0.2)    for Poly-N+  
;       =  75/W + 1.1/W + 2.5/(((W-1.2)/1.4)+1) =  76.1/W+3.50/(W+0.2)    for Poly-Cap  
;  
;extractDevice(respp pdifsi("PLUS" "MINUS") (nwells "WELL") "rpdiff ivpcell")  
extractDevice(respp pdifsi("PLUS" "MINUS") "rpdiff ivpcell")  
area    = measureParameter( area (respp) )  
width   = measureParameter( length (respp butting pdifsi) 0.5 )  
widthw  = calculateParameter( width - 0.00 )  
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)*46)+(2*((71.1/widthw)+3.78/(widthw+0.2))))  
saveParameter(resist "r")  
saveParameter(widthw "w")  
;  
;extractDevice(resnp ndifsi("PLUS" "MINUS") (pwells "WELL") "rndiff ivpcell")  
extractDevice(resnp ndifsi("PLUS" "MINUS") "rndiff ivpcell")  
area    = measureParameter( area (resnp) )  
width   = measureParameter( length (resnp butting ndifsi) 0.5 )  
widthw  = calculateParameter( width - 0.00 )  
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*((28.1/widthw)+3.22/(widthw+0.2))))  
saveParameter(resist "r")  
saveParameter(widthw "w")  
;  
extractDevice(rpocap polconn("PLUS" "MINUS") "rpocap ivpcell")                       
area    = measureParameter( area (rpocap) )                                          
width   = measureParameter( length (rpocap butting polconn) 0.5 )                    
widthw  = calculateParameter( width - 0.00 )                                         
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*((76.1/widthw)+3.50/(widthw+0.2)))) 
saveParameter(resist "r")                                                            
saveParameter(widthw "w")                                                            
;                                                                                    
extractDevice(rpoly polconn("PLUS" "MINUS") "rpo1 ivpcell")  
area    = measureParameter( area (rpoly) )  
width   = measureParameter( length (rpoly butting polconn) 0.5 )  
widthw  = calculateParameter( width - 0.00 )  
po_bendf = measureParameter( bends_full ( rpoly coincident poly ))    
po_bendp = measureParameter( bends_part ( rpoly coincident poly ))   
length  = calculateParameter((area / width) - width * ( 0.5 * po_bendf + 0.25 * po_bendp ) )   
resist = calculateParameter(((length/widthw)*120)+(2*((76.1/widthw)+3.50/(widthw+0.2))))  
saveParameter(resist "r")  
saveParameter(widthw "w")  
;  
;********  DIODE-DEVICES  ******  
;  
  ivIf( !switch( "mdiode" ) then  
   ivIf( !switch( "nodiode" ) then     
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
extractDevice(diop dpter("PLUS") nwells("MINUS") "dp ivpcell")  
    dioparea = measureParameter( area ( diop ) 1e-12 )  
    diopperi = measureParameter( perimeter ( diop ) 1e-6 )  
    saveParameter( dioparea "area" )  
    saveParameter( diopperi "peri" )  
;  
extractDevice(dion pwells("PLUS") dnter("MINUS") "dn ivpcell")  
    dionarea = measureParameter( area ( dion ) 1e-12 )  
    dionperi = measureParameter( perimeter ( dion ) 1e-6 )  
    saveParameter( dionarea "area" )  
    saveParameter( dionperi "peri" )  
;  
    saveRecognition( diop  "instance" )  
    saveRecognition( dion  "instance" )  
     )  
  else   ; if "mdiode" switch invoked  
ivIf((switch("drc?") && switch("extract?")) then geomConnect( via( vi2 metal3 metal2 )))  
extractDevice(diopx dpter("PLUS") nwells("MINUS") "dp ivpcell")  
    dioparea = measureParameter( area ( diopx ) 1e-12 )  
    diopperi = measureParameter( perimeter ( diopx ) 1e-6 )  
    saveParameter( dioparea "area" )  
    saveParameter( diopperi "peri" )  
   
extractDevice(dionx pwells("PLUS") dnter("MINUS") "dn ivpcell")  
    dionarea = measureParameter( area ( dionx ) 1e-12 )  
    dionperi = measureParameter( perimeter ( dionx ) 1e-6 )  
    saveParameter( dionarea "area" )  
    saveParameter( dionperi "peri" )  
;  
    saveRecognition( diopx  "instance" )  
    saveRecognition( dionx  "instance" )  
   )  
;  
;********  GRAPHICS DATABASE OUTPUT  ***********  
;  
;  
    saveInterconnect( metal3 )  
    saveInterconnect( metal2 )  
    saveInterconnect( metal1 )  
    saveInterconnect(( sali "active" )  
                     ( poly2 "poly2" )                                           
                     ( polconn "poly" )  
                     ( ndifsi "nplus" )  
                     ( pdifsi "pplus" )  
                     ( dpter "pplus" )  
                     ( dnter "nplus" )  
                     ( nstraps "nplus" )                                         
                     ( pstraps "pplus" )                                         
                     ( vi2 "v2" )  
                     ( via "v1" )  
                     ( polyct "contact" )  
                     ( poly2ct "contact" )                                       
                     ( actct "contact" )  
                     ( nwells "nwell" ))  
;  
    saveDerived( pgates ( "active" "drawing" ) ext_view tile )                   
    saveDerived( ngates ( "active" "drawing" ) ext_view tile )                   
    saveDerived( respp ( "mres" "drawing" ) ext_view tile )  
    saveDerived( resnp ( "mres" "drawing" ) ext_view tile )  
    saveDerived( rpoly ( "poly" "drawing" ) ext_view tile )  
    saveDerived( rpocap ( "poly" "drawing" ) ext_view tile )                     
    saveDerived( rpocap ( "cap" "drawing" ) ext_view tile )                      
    saveDerived( cpo1po2 ( "poly2" "drawing" ) ext_view tile )                   
    saveDerived( pnpem ( "pplus" "drawing" ) ext_view tile )                     
    saveDerived( diop ( "pplus" "drawing" ) ext_view tile )  
    saveDerived( dion ( "mdiode" "drawing" ) ext_view tile )  
;  
    saveRecognition( angate "instance" )                                         
    saveRecognition( apgate "instance" )                                         
    saveRecognition( ngate "instance" )  
    saveRecognition( pgate "instance" )  
    saveRecognition( respp "instance" )  
    saveRecognition( resnp "instance" )  
    saveRecognition( rpoly "instance" )  
    saveRecognition( rpocap "instance" )                                         
    saveRecognition( cpo1po2 "instance" )                                        
    saveRecognition( pnpem "instance")                                           
    copyGraphics( ("msub" "drawing") )  
    copyGraphics( ("pin" "drawing") )  
    copyGraphics( ("polytext" "drawing") )  
    copyGraphics( ("m1text" "drawing") )  
    copyGraphics( ("m2text" "drawing") )  
    copyGraphics( ("m3text" "drawing") )  
;  
;  
    )                              ; end of the extract section  
;  
;  
     ivIf(( switch("extract?") && switch("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 )  
  attachParasitic( a ("as" "S") ("ad" "D") angate shared )                       
  b = measureParasitic( length ( ndifsi outside poly ) 1e-06 figure )  
  attachParasitic( b ("ps" "S") ("pd" "D") ngate shared )  
  attachParasitic( b ("ps" "S") ("pd" "D") angate shared )                       
;  
/******************************************************************************/  
/******************************************************************************/  
/* PMOS capa drain-source */  
  c = measureParasitic( area ( pdifsi ) 1e-12 figure )  
  attachParasitic( c ("as" "S") ("ad" "D") pgate shared )  
  attachParasitic( c ("as" "S") ("ad" "D") apgate shared )                       
  d = measureParasitic( length ( pdifsi outside poly ) 1e-06 figure )  
  attachParasitic( d ("ps" "S") ("pd" "D") pgate shared )  
  attachParasitic( d ("ps" "S") ("pd" "D") apgate 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)   
  8.30e-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 ) * 5.00e-17 )    
 Cpolynwell  = calculateParasitic( Ppolynwell + Spolynwell )  
;  
;*******************************************************************************  
;**************  Crossing capacitance   poly - pwellfield     ******************  
;*******************************************************************************  
 Ppolypwell  = measureParasitic( area ( polconn over pwells not_over active)   
  8.30e-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 ) * 5.00e-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  * 7.00e-17 )                        
 CS0polyMET1 = calculateParasitic( S0polyMET1 * 5.50e-17 )                        
 CS1polyMET1 = calculateParasitic( S1polyMET1 * 5.50e-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  * 3.00e-17 )                        
 CS0polyMET2 = calculateParasitic( S0polyMET2 * 4.60e-17 )                        
 CS1polyMET2 = calculateParasitic( S1polyMET2 * 4.60e-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.90e-17 )                        
 CS0polyMET3 = calculateParasitic( S0polyMET3 * 4.50e-17 )                        
 CS1polyMET3 = calculateParasitic( S1polyMET3 * 4.50e-17 )                        
 CpolyMET3   = calculateParasitic( CPpolyMET3 + CS0polyMET3 + CS1polyMET3 )  
;  
;* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! **   
    CAPApoly = calculateParasitic(  
            Cpolynwell + Cpolypwell + CpolyMET1 + CpolyMET2 + CpolyMET3  
                                 )  
;* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! **  
;  
;*******************************************************************************  
;**************  Crossing capacitance   metal1 - dnplus       ******************  
;*******************************************************************************  
 PMET1dnplus  = measureParasitic( area ( metal1 over ndifsi ) 3.80e-17 two_net )  
 SaMET1dnplus = measureParasitic( length ( metal1 inside ndifsi ) two_net )  
 SbMET1dnplus = measureParasitic( length ( metal1 butting ndifsi ) two_net )  
 SMET1dnplus  = calculateParasitic(( SaMET1dnplus + SbMET1dnplus ) * 4.60e-17)    
 CMET1dnplus  = calculateParasitic( PMET1dnplus + SMET1dnplus )  
   
;*******************************************************************************  
;**************  Crossing capacitance   metal1 - dpplus      *******************  
;*******************************************************************************  
 PMET1dpplus = measureParasitic( area ( metal1 over pdifsi ) 3.80e-17 two_net )   
 SaMET1dpplus = measureParasitic( length ( metal1 inside pdifsi ) two_net )  
 SbMET1dpplus = measureParasitic( length ( metal1 butting pdifsi ) two_net )  
 SMET1dpplus = calculateParasitic(( SaMET1dpplus + SbMET1dpplus ) * 4.60e-17)     
 CMET1dpplus = calculateParasitic( PMET1dpplus + SMET1dpplus )  
   
;*******************************************************************************  
;****************  Crossing capacitance   metal1 - nwellfield  *****************  
;*******************************************************************************  
;* No capacitance when nwellfield - (poly) - metal1           ******************  
 PMET1nwell = measureParasitic( area ( metal1 over nwells not_over poloract)   
  3.20e-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.40e-17 )      
 CMET1nwell = calculateParasitic( PMET1nwell + SMET1nwell )  
;  
;*******************************************************************************  
;***************  Crossing capacitance   metal1 - pwellfield  ******************  
;*******************************************************************************  
;* No capacitance when pwellfield - (poly) - metal1           ******************  
 PMET1pwell = measureParasitic( area ( metal1 over pwells not_over poloract)   
  3.20e-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.40e-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   * 5.10e-17 )                        
 CS0MET1MET2 = calculateParasitic( S0MET1MET2 * 5.30e-17 )                        
 CS1MET1MET2 = calculateParasitic( S1MET1MET2 * 5.30e-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   * 2.70e-17 )                        
 CS0MET1MET3 = calculateParasitic( S0MET1MET3 * 4.90e-17 )                        
 CS1MET1MET3 = calculateParasitic( S1MET1MET3 * 4.90e-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 )   
  2.30e-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 ) * 4.30e-17)      
 CMET2dnplus  = calculateParasitic( PMET2dnplus + SMET2dnplus )   
;  
;*******************************************************************************  
;***************  Crossing capacitance   metal2 - dpplus     *******************  
;*******************************************************************************  
;* No capacitance when dpplus - (metal1) - metal2            *******************  
 PMET2dpplus  = measureParasitic( area ( metal2 over pdifsi not_over metal1 )   
  2.30e-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 ) * 4.30e-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 )   
  2.20e-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 ) * 4.20e-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 )   
  2.20e-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 ) * 4.20e-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   * 5.10e-17 )                          
 CS0MET2MET3 = calculateParasitic( S0MET2MET3 * 5.80e-17 )                          
 CS1MET2MET3 = calculateParasitic( S1MET2MET3 * 5.80e-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 )   
  1.60e-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 ) *  
  4.20e-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 )   
  1.60e-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 ) *  
  4.20e-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 )   
  1.60e-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 ) *  
  4.20e-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 )   
  1.60e-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 ) *   
  4.20e-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(( 1.00e-17 * l * 0.8 ) / s )  
       sep < 2.0  parallel opposite diffNet )  
   
;*******************************************************************************  
;*****************    metal1 Coupling capacitance         **********************  
;*******************************************************************************  
    fringemetal1 = measureFringe( metal1 calculate(( 2.70e-17 * l * 0.8 ) / s)  
       sep < 2.0  parallel opposite diffNet )  
   
;*******************************************************************************  
;*****************   metal2 Coupling capacitance          **********************  
;*******************************************************************************  
    fringemetal2 = measureFringe( metal2 calculate(( 3.10e-17 * l * 0.9 ) / s )  
       sep < 2.25 parallel opposite  diffNet )  
   
;*******************************************************************************  
;*****************   metal3 Coupling capacitance          **********************  
;*******************************************************************************  
    fringemetal3 = measureFringe( metal3 calculate(( 3.30e-17 * l * 1.2 ) / s )  
       sep < 3.0 parallel opposite  diffNet )  
;  
;*******************************************************************************  
;*****************   metal3-metal2 Coupling capacitance     ********************  
;*******************************************************************************  
    fringeme3me2 = measureFringe( metal3 metal2   
calculate(( 5.58e-17 - ( 3.58e-17 * s )) * l ) 0 < sep < 1.2 parallel opposite )  
;  
;*******************************************************************************  
;*****************   metal2-metal3 Coupling capacitance     ********************  
;*******************************************************************************  
    fringeme2me3 = measureFringe( metal2 metal3  
calculate(( 5.58e-17 - ( 3.58e-17 * s )) * l ) 0 < sep < 1.2 parallel opposite )  
;  
;*******************************************************************************  
;*****************   metal2-metal1 Coupling capacitance     ********************  
;*******************************************************************************  
    fringeme2me1 = measureFringe( metal2 metal1  
calculate(( 5.53e-17 - ( 3.53e-17 * s )) * l ) 0 < sep < 0.9 parallel opposite )  
;  
;*******************************************************************************  
;*****************   metal1-metal2 Coupling capacitance     ********************  
;*******************************************************************************  
    fringeme1me2 = measureFringe( metal1 metal2  
calculate(( 5.53e-17 - ( 3.53e-17 * s )) * l ) 0 < sep < 0.9 parallel opposite )  
;  
;*******************************************************************************  
;****************   metal1-polconn Coupling capacitance     ********************  
;*******************************************************************************  
    fringeme1pol = measureFringe( metal1 polconn  
calculate(( 5.55e-17 - ( 3.55e-17 * s )) * l ) 0 < sep < 0.8 parallel opposite )  
;  
;*******************************************************************************  
;****************   polconn-metal1 Coupling capacitance     ********************  
;*******************************************************************************  
    fringepolme1 = measureFringe( polconn metal1  
calculate(( 5.55e-17 - ( 3.55e-17 * s )) * l ) 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("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 )  
  attachParasitic( a ("as" "S") ("ad" "D") angate shared )                       
  b = measureParasitic( length ( ndifsi outside poly ) 1e-06 figure )  
  attachParasitic( b ("ps" "S") ("pd" "D") ngate shared )  
  attachParasitic( b ("ps" "S") ("pd" "D") angate shared )                       
;  
/******************************************************************************/  
/******************************************************************************/  
/* PMOS capa drain-source */  
  c = measureParasitic( area ( pdifsi ) 1e-12 figure )  
  attachParasitic( c ("as" "S") ("ad" "D") pgate shared )  
  attachParasitic( c ("as" "S") ("ad" "D") apgate shared )                       
  d = measureParasitic( length ( pdifsi outside poly ) 1e-06 figure )  
  attachParasitic( d ("ps" "S") ("pd" "D") pgate shared )  
  attachParasitic( d ("ps" "S") ("pd" "D") apgate shared )                       
;  
;*******************************************************************************  
;*****      EXTRACT  PARASITIC  CAPACITANCES  by  SINGLE - NODE          *******  
;*****      ###################################################          *******  
;*****                                                                   *******  
;*                                                                            **  
;*  crossing capacitances, including area and side capacitors, 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 )   
  8.30e-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 ) * 5.00e-17 )    
 Cpolynwell = calculateParasitic( Ppolynwell + Spolynwell )  
;  
;*******************************************************************************  
;**************  Crossing capacitance   poly - pwellfield     ******************  
;*******************************************************************************  
 Ppolypwell = measureParasitic( area ( polconn over pwells not_over active )   
  8.30e-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 ) * 5.00e-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  * 7.00e-17 )                        
 CS0polyMET1 = calculateParasitic( S0polyMET1 * 5.50e-17 )                        
 CS1polyMET1 = calculateParasitic( S1polyMET1 * 5.50e-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  * 7.00e-17 )                        
 CS0MET1poly = calculateParasitic( S0MET1poly * 5.50e-17 )                        
 CS1MET1poly = calculateParasitic( S1MET1poly * 5.50e-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  * 3.00e-17 )                       
 CS0polyMET2 = calculateParasitic( S0polyMET2 * 4.60e-17 )                       
 CS1polyMET2 = calculateParasitic( S1polyMET2 * 4.60e-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  * 3.00e-17 )                       
 CS0MET2poly = calculateParasitic( S0MET2poly * 4.60e-17 )                       
 CS1MET2poly = calculateParasitic( S1MET2poly * 4.60e-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.90e-17 )                       
 CS0polyMET3 = calculateParasitic( S0polyMET3 * 4.50e-17 )                       
 CS1polyMET3 = calculateParasitic( S1polyMET3 * 4.50e-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.90e-17 )                       
 CS0MET3poly = calculateParasitic( S0MET3poly * 4.50e-17 )                       
 CS1MET3poly = calculateParasitic( S1MET3poly * 4.50e-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 ) 3.80e-17 one_net )  
 SaMET1dnplus = measureParasitic( length ( metal1 inside ndifsi ) one_net )  
 SbMET1dnplus = measureParasitic( length ( metal1 butting ndifsi ) one_net )  
 SMET1dnplus  = calculateParasitic(( SaMET1dnplus + SbMET1dnplus ) * 4.60e-17)    
 CMET1dnplus = calculateParasitic( PMET1dnplus + SMET1dnplus )  
   
;*******************************************************************************  
;**************  Crossing capacitance   metal1 - dpplus      *******************  
;*******************************************************************************  
 PMET1dpplus = measureParasitic( area ( metal1 over pdifsi ) 3.80e-17 one_net )   
 SaMET1dpplus = measureParasitic( length ( metal1 inside pdifsi ) one_net )  
 SbMET1dpplus = measureParasitic( length ( metal1 butting pdifsi ) one_net )  
 SMET1dpplus = calculateParasitic(( SaMET1dpplus + SbMET1dpplus ) * 4.60e-17)     
 CMET1dpplus = calculateParasitic( PMET1dpplus + SMET1dpplus )  
   
;*******************************************************************************  
;****************  Crossing capacitance   metal1 - nwellfield  *****************  
;*******************************************************************************  
;* No capacitance when nwellfield - (poly) - metal1           ******************  
 PMET1nwell = measureParasitic( area ( metal1 over nwells not_over poloract)  
  3.20e-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.40e-17 )      
 CMET1nwell = calculateParasitic( PMET1nwell + SMET1nwell )  
;  
;*******************************************************************************  
;***************  Crossing capacitance   metal1 - pwellfield  ******************  
;*******************************************************************************  
;* No capacitance when pwellfield - (poly) - metal1           ******************  
 PMET1pwell = measureParasitic( area ( metal1 over pwells not_over poloract)   
  3.20e-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.40e-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   * 5.10e-17 )                        
 CS0MET1MET2 = calculateParasitic( S0MET1MET2 * 5.30e-17 )                        
 CS1MET1MET2 = calculateParasitic( S1MET1MET2 * 5.30e-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   * 5.10e-17 )                        
 CS0MET2MET1 = calculateParasitic( S0MET2MET1 * 5.30e-17 )                        
 CS1MET2MET1 = calculateParasitic( S1MET2MET1 * 5.30e-17 )                        
;   
;*** Capas between metal1 and metal2 , summed by nodes ***  
;* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *  
 CMET1MET2 = calculateParasitic( CPMET1MET2 + CS0MET1MET2 + CS1MET1MET2 +  
                                        CPMET2MET1 + CS0MET2MET1 + CS1MET2MET1 )  
;* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   
;  
;*******************************************************************************  
;**************  Crossing capacitance   metal1 - metal3       ******************  
;*******************************************************************************  
;*** These following Capas are seen from metal1 ***  
;* No capacitance when metal1 - (metal2) - metal3            ******************  
 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   * 2.70e-17 )                        
 CS0MET1MET3 = calculateParasitic( S0MET1MET3 * 4.90e-17 )                        
 CS1MET1MET3 = calculateParasitic( S1MET1MET3 * 4.90e-17 )                        
;   
;*** These following Capas are seen from metal3 ***  
;* No capacitance when metal1 - (metal2) - 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   * 2.70e-17 )                        
 CS0MET3MET1 = calculateParasitic( S0MET3MET1 * 4.90e-17 )                        
 CS1MET3MET1 = calculateParasitic( S1MET3MET1 * 4.90e-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 )   
  2.30e-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 ) * 4.30e-17)      
 CMET2dnplus = calculateParasitic( PMET2dnplus + SMET2dnplus )   
;  
;*******************************************************************************  
;***************  Crossing capacitance   metal2 - dpplus     *******************  
;*******************************************************************************  
;* No capacitance when dpplus - (metal1) - metal2            *******************  
 PMET2dpplus = measureParasitic( area ( metal2 over pdifsi not_over metal1 )   
  2.30e-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 ) * 4.30e-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 )   
  2.20e-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 ) * 4.20e-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)   
  2.20e-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 ) * 4.20e-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   * 5.10e-17 )                          
 CS0MET2MET3 = calculateParasitic( S0MET2MET3 * 5.80e-17 )                          
 CS1MET2MET3 = calculateParasitic( S1MET2MET3 * 5.80e-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   * 5.10e-17 )                          
 CS0MET3MET2 = calculateParasitic( S0MET3MET2 * 5.80e-17 )                          
 CS1MET3MET2 = calculateParasitic( S1MET3MET2 * 5.80e-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 )   
  1.60e-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 ) *  
  4.20e-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 )   
  1.60e-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 ) *  
  4.20e-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 )   
  1.60e-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 ) *  
  4.20e-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 )   
  1.60e-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 ) *  
  4.20e-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  
 + 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")  
;  
;  
;  
*/  
;  
;*******************************************************************************  
;*******************************************************************************  
;  
  )                                ; end of the single section  
;  
)                                  ; end of drcExtractRules  


