08 : Parasitic Extraction For Advanced Process Technologies

08 : Parasitic Extraction For Advanced Process Technologies

08 : Parasitic Extraction For Advanced Process Technologies

Minimum Required Versions: Expert 5.2204.3.R, Hipex 3.8.7.R

Hipex RC is capable of extracting parasitic resistance and capacitance with high accuracy using complex routines that are employed in the design kits of advanced technology nodes. This is possible due to the built-in equations as well as options for custom-built functions for parasitic calculation. This example shows the usage of Hipex-C with technology files that represent the level of complexity seen in many advanced process technologies.

Expert and Hipex Setup

Open Expert and load the example circuit in the Expert project hipex_ex08.eld and open the sample layout cell named DFF. Next, all extraction decks must be specified in the LPE setup in Expert by selecting Verification->Extraction->Setup , which opens the LPE setup window. Selecting the Technology tab in the left section of the window brings up the dialog box, in which the layer generation script ( silvaco_dev_extract.dsf ), the parasitic capacitance script ( silvaco_para_c.lisa ), and the parasitic resistance script ( silvaco_para_r.lisa ) must be chosen.

Custom Functions Using Conditional Statements

Some of the ways that a custom capacitance function can be created to account for various layout conditions is shown in Figure1.
This example function will calculate capacitance using one of several different equations based on the specific layout condition that is encountered. Multiple factors are taken into account to determine what formula is used, such as distance between the shapes, the nodal information of the shapes, enclosure of one shape by another, and the width of the conducting shape.

Shielding Layers

Hipex-C accounts for the vertical shielding that occurs when a conduction layer between two primary capacitance layers shields the capacitance effect between them by using the CPX ORDER statement to specify the order of conduction layers. Once the CPX ORDER is set, the vertical shielding effects are calculated automatically in the individual capacitance functions.

The option /INSIDE_LAYERS is available for lateral capacitance functions to account for lateral shielding. Figure2
shows a function that calculates lateral poly capacitance and uses the /INSIDE_LAYERS option.

Charge Sharing Effects

The charge sharing effects caused by shapes above and below the primary capacitance layer can be modeled in Hipex-C by using the /OUTSIDE_LAYERS option in the capactiance command. Figure3
shows a sample capacitance function that calculates metal1 lateral capacitance and uses the /OUTSIDE_LAYERS option

Hipex RC Resutls

In order to extract an RC parasitic netlist using the example calculations shown, first create the derived layers and connectivity database by selecting Verification->Extraction->Hipex-Net->Run from the Expert menu. Then the RC parasitic netlist can be generated by selecting Verification->Extraction->Hipex-RC->Run.

Graphics

figure1.png
figure2.png
figure3.png

Input Files

hipex_ex08_net_cmd.lisa

!--------------------------------------------------------------------
!Net command file
!DESIGN    : design
!TECHNO    : techno
!USER      : 
!TIME      : Thu May 28 22:04:41 2020

!--------------------------------------------------------------------

! HIPEX to CUP map table

cup layer "metal4" /hipex_layer="METAL4";
cup layer "metal5" /hipex_layer="METAL5";
cup layer "metal6" /hipex_layer="METAL6";
cup layer "metal2" /hipex_layer="METAL2";
cup layer "metal3" /hipex_layer="METAL3";
cup layer "poly1" /hipex_layer="connect_poly";
cup layer "substrate" /hipex_layer="substrate";
cup layer "metal1" /hipex_layer="connect_metal1";

! GDS LAYER MAP

hipex layer /gds_layer=   0 /gds_type= 0 /geom_layer="pnp_id";
hipex layer /gds_layer=  25 /gds_type= 0 /geom_layer="CONTACT";
hipex layer /gds_layer=  30 /gds_type= 0 /geom_layer="VIA3";
hipex layer /gds_layer=  31 /gds_type= 0 /geom_layer="METAL4";
hipex layer /gds_layer=  31 /gds_type= 1 /geom_layer="M4_LABEL";
hipex layer /gds_layer=  32 /gds_type= 0 /geom_layer="VIA4";
hipex layer /gds_layer=  33 /gds_type= 0 /geom_layer="METAL5";
hipex layer /gds_layer=  33 /gds_type= 1 /geom_layer="M5_LABEL";
hipex layer /gds_layer=  36 /gds_type= 0 /geom_layer="VIA5";
hipex layer /gds_layer=  37 /gds_type= 0 /geom_layer="METAL6";
hipex layer /gds_layer=  37 /gds_type= 1 /geom_layer="M6_LABEL";
hipex layer /gds_layer=  38 /gds_type= 0 /geom_layer="DEEP_N_WELL";
hipex layer /gds_layer=  42 /gds_type= 5 /geom_layer="NWEL_port";
hipex layer /gds_layer=  46 /gds_type= 5 /geom_layer="GC_port";
hipex layer /gds_layer=  49 /gds_type= 1 /text_layer="M1_LABEL";
hipex layer /gds_layer=  49 /gds_type= 5 /geom_layer="METAL1_port";
hipex layer /gds_layer=  50 /gds_type= 0 /geom_layer="VIA";
hipex layer /gds_layer=  51 /gds_type= 0 /geom_layer="METAL2";
hipex layer /gds_layer=  51 /gds_type= 1 /geom_layer="M2_LABEL";
hipex layer /gds_layer=  51 /gds_type= 5 /geom_layer="METAL2_port";
hipex layer /gds_layer=  56 /gds_type= 0 /geom_layer="POLY2";
hipex layer /gds_layer=  58 /gds_type= 0 /geom_layer="PBASE";
hipex layer /gds_layer=  59 /gds_type= 5 /geom_layer="PSUB_port";
hipex layer /gds_layer=  61 /gds_type= 0 /geom_layer="VIA2";
hipex layer /gds_layer=  62 /gds_type= 0 /geom_layer="METAL3";
hipex layer /gds_layer=  62 /gds_type= 1 /geom_layer="M3_LABEL";
hipex layer /gds_layer=  63 /gds_type= 0 /geom_layer="pnp_e";
hipex layer /gds_layer=  64 /gds_type= 0 /geom_layer="pnp_c";
hipex layer /gds_layer=  65 /gds_type= 0 /geom_layer="npn_e";
hipex layer /gds_layer=  66 /gds_type= 0 /geom_layer="npn_b";
hipex layer /gds_layer=  67 /gds_type= 0 /geom_layer="p_sd";
hipex layer /gds_layer=  68 /gds_type= 0 /geom_layer="n_sd";
hipex layer /gds_layer=  69 /gds_type= 0 /geom_layer="cmosp_id";
hipex layer /gds_layer=  70 /gds_type= 0 /geom_layer="cmosn_id";
hipex layer /gds_layer=  71 /gds_type= 0 /geom_layer="hvcmosp_id";
hipex layer /gds_layer=  72 /gds_type= 0 /geom_layer="hvpmos_d";
hipex layer /gds_layer=  73 /gds_type= 0 /geom_layer="hvpmos_s";
hipex layer /gds_layer=  74 /gds_type= 0 /geom_layer="hvcmosn_id";
hipex layer /gds_layer=  75 /gds_type= 0 /geom_layer="hvnmos_d";
hipex layer /gds_layer=  76 /gds_type= 0 /geom_layer="hvnmos_s";
hipex layer /gds_layer=  77 /gds_type= 0 /geom_layer="rpplus_id";
hipex layer /gds_layer=  78 /gds_type= 0 /geom_layer="rnpoly_id";
hipex layer /gds_layer=  79 /gds_type= 0 /geom_layer="rpoly_id";
hipex layer /gds_layer=  80 /gds_type= 0 /geom_layer="rnwell_id";
hipex layer /gds_layer=  81 /gds_type= 0 /geom_layer="rpplus_pin";
hipex layer /gds_layer=  82 /gds_type= 0 /geom_layer="connect_poly";
hipex layer /gds_layer=  83 /gds_type= 0 /geom_layer="connect_nwell";
hipex layer /gds_layer=  84 /gds_type= 0 /geom_layer="substrate";
hipex layer /gds_layer=  85 /gds_type= 0 /geom_layer="sub_tie";
hipex layer /gds_layer=  86 /gds_type= 0 /geom_layer="well_tie";
hipex layer /gds_layer=  87 /gds_type= 0 /geom_layer="deepnwell_tie";
hipex layer /gds_layer=  88 /gds_type= 0 /geom_layer="p1p2_id";
hipex layer /gds_layer=  89 /gds_type= 0 /geom_layer="poly_con";
hipex layer /gds_layer=  90 /gds_type= 0 /geom_layer="poly2cap_con";
hipex layer /gds_layer=  91 /gds_type= 0 /geom_layer="ind_plus";
hipex layer /gds_layer=  92 /gds_type= 0 /geom_layer="ind_minus";
hipex layer /gds_layer=  93 /gds_type=255 /geom_layer="connect_metal1";
hipex layer /gds_layer=  94 /gds_type= 0 /geom_layer="HPX$npn_e";

! TEXT TYPES


! PORT LAYERS

hipex port_layer "M1_LABEL";

! SOFT LAYERS


! MISC (optional) statementsS


! CONNECTIVITY

hipex connect "DEEP_N_WELL" "deepnwell_tie";
hipex connect "GC_port" "connect_poly";
hipex connect "M2_LABEL" "ind_minus";
hipex attach "M1_LABEL" "METAL1_port";
hipex connect "METAL2" "METAL2_port";
hipex connect "METAL2" "METAL3" /contact="VIA2";
hipex connect "METAL3" "METAL4" /contact="VIA3";
hipex connect "METAL4" "METAL5" /contact="VIA4";
hipex connect "METAL5" "METAL6" /contact="VIA5";
hipex connect "NWEL_port" "connect_nwell";
hipex connect "PBASE" "npn_b";
hipex connect "PSUB_port" "substrate";
hipex connect "connect_metal1" "POLY2" /contact="poly2cap_con";
hipex connect "connect_metal1" "METAL1_port";
hipex connect "connect_metal1" "METAL2" /contact="VIA";
hipex connect "connect_metal1" "pnp_e" /contact="CONTACT";
hipex connect "connect_metal1" "pnp_c" /contact="CONTACT";
hipex connect "connect_metal1" "npn_e" /contact="CONTACT";
hipex connect "connect_metal1" "npn_b" /contact="CONTACT";
hipex connect "connect_metal1" "p_sd" /contact="CONTACT";
hipex connect "connect_metal1" "n_sd" /contact="CONTACT";
hipex connect "connect_metal1" "hvpmos_d" /contact="CONTACT";
hipex connect "connect_metal1" "hvpmos_s" /contact="CONTACT";
hipex connect "connect_metal1" "hvnmos_d" /contact="CONTACT";
hipex connect "connect_metal1" "hvnmos_s" /contact="CONTACT";
hipex connect "connect_metal1" "rpplus_pin" /contact="CONTACT";
hipex connect "connect_metal1" "connect_poly" /contact="poly_con";
hipex connect "connect_metal1" "sub_tie" /contact="CONTACT";
hipex connect "connect_metal1" "well_tie" /contact="CONTACT";
hipex connect "connect_metal1" "ind_plus";
hipex connect "connect_metal1" "ind_minus";
hipex attach "M1_LABEL" "connect_metal1";
hipex connect "connect_nwell" "well_tie";
hipex connect "deepnwell_tie" "connect_metal1" /contact="CONTACT";
hipex connect "substrate" "sub_tie";

! DEVICES TEXTS


! DEVICE DEFINITIONS

hipex define_device PMOS "cmosp_id" /drain="p_sd" /gate="connect_poly" /source="p_sd" /subs="connect_nwell" /model_name="CMOSP";
hipex define_device NMOS "cmosn_id" /drain="n_sd" /gate="connect_poly" /source="n_sd" /subs="substrate" /model_name="CMOSN";
hipex define_device C "p1p2_id" /pin1="POLY2" /pin2="connect_poly" /area_cap=0.0075 /perim_cap=0.00625 /model_name="PIPCAP";
hipex define_device PMOS "hvcmosp_id" /drain="hvpmos_d" /gate="connect_poly" /source="hvpmos_s" /subs="DEEP_N_WELL" /model_name="HVCMOSP";
hipex define_device NMOS "hvcmosn_id" /drain="hvnmos_d" /gate="connect_poly" /source="hvnmos_s" /subs="substrate" /model_name="HVCMOSN";
hipex define_device NPN "HPX$npn_e" /collector="connect_nwell" /base="PBASE" /emitter="npn_e" /subs="substrate" /area_unit=36 /model_name="NPN";
hipex define_device PNP "pnp_id" /collector="pnp_c" /base="connect_nwell" /emitter="pnp_e" /area_unit=38.3819 /model_name="PNP";
hipex define_device R "rnwell_id" /pin1="connect_nwell" /pin2="connect_nwell" /subs="substrate" /cont_res=0 /delta_l=0.4 /delta_w=-0.02 /head_res=0 /sheet_res=10000 /model_name="RNWELL";
hipex define_device R "rpplus_id" /pin1="rpplus_pin" /pin2="rpplus_pin" /subs="connect_nwell" /cont_res=0 /delta_l=0.5 /delta_w=-0.05 /head_res=0 /sheet_res=200 /model_name="RPPLUS";
hipex define_device R "rnpoly_id" /pin1="connect_poly" /pin2="connect_poly" /cont_res=0 /delta_l=0.4 /delta_w=0.02 /head_res=0 /sheet_res=50 /model_name="RNPOLY";
hipex define_device R "rpoly_id" /pin1="connect_poly" /pin2="connect_poly" /cont_res=0 /delta_l=0.4 /delta_w=0.02 /head_res=0 /sheet_res=50 /model_name="RPOLY";

! GEOMETRICAL OPERATIONS

    hipex copy "npn_e" "HPX$npn_e";


! SOFT/WELL CHECKS


! MASKED DIELECTRIC LAYERS

hipex_ex08_opt.lisa

!--------------------------------------------------------------------
!Run file
!DESIGN    : design
!TECHNO    : techno
!USER      : 
!TIME      : Thu May 28 22:05:18 2020

!--------------------------------------------------------------------
TOP_CELL                                = "DFF";

HIPEX_DB_DIRECTORY                      = "database";
!--------------------------------------------------------------------
!Extraction: LISA template command file
!--------------------------------------------------------------------

!--------------------------------------------------------------------
!Layout parameters
!--------------------------------------------------------------------
HIPEX_LAYOUT_FORMAT                     = "GDS";
HIPEX_LAYOUT_FILE                       = "DFF$HPX.gds";
HIPEX_OVERLAP_INSTANCE_CHECK            = "NO";
HIPEX_SUPPRESS_NOTEMPTY                 = "YES";
HIPEX_NON45_FLAG                        = "NO";

!--------------------------------------------------------------------
!Connectivity parameters
!--------------------------------------------------------------------
HIPEX_TERNARY_CONNECT_THROUGH_TOUCH     = "NO";

!--------------------------------------------------------------------
!Output parameters
!--------------------------------------------------------------------
HIPEX_COMMENT_MODEL                     = "NO";
HIPEX_COMMENT_TOP_SUBCKT                = "NO";
HIPEX_HIER_SPICE_WL_NAME                = "/home/alexa/2020_06/08/DFF_hier.spice";
HIPEX_MOSFET_LW_ONLY                    = "NO";
HIPEX_MOSFET_EXCLUDE_W_SD               = "NO";
HIPEX_OUTPUT_SPICE_ATTRIBUTES           = "YES";
HIPEX_CAP_OUTPUT_LW                     = "NO";
HIPEX_RES_OUTPUT_LW                     = "YES";
HIPEX_CAP_OUTPUT_AREA_PERIMETER         = "YES";
HIPEX_OUTPUT_SPICE_FORMAT               = "HSPICE";
HIPEX_PININFO                           = "NO";
HIPEX_PRINT_MESSAGES                    = "NO";
NETLIST_OUTPUT_PM                       = "NO";
NETLIST_DISTRIBUTION_MODE               = "ACCURATE";
NETLIST_LINE_LENGTH                     = 80;
NETLIST_EXCLUDE_LIBRARY_PREFIX          = "NO";
NETLIST_GLOBALS_IN_SUBCKT_PINS          = "YES";
NETLIST_TEXTED_PINS                     = "YES";
NETLIST_LIBRARIES                       = {};

!--------------------------------------------------------------------
!ERC parameters
!--------------------------------------------------------------------
HIPEX_DANGLE_FLAG                       = "YES";
HIPEX_CAP_MESSAGE                       = "NO";
HIPEX_DIODE_MESSAGE                     = "NO";
HIPEX_RENAME_OPENS                      = "NO";
HIPEX_MULTILABEL_NAME                   = "";
HIPEX_SOFTCHECK_WARNINGS_AS_ERRORS      = "NO";

!--------------------------------------------------------------------
!Node Name parameters
!--------------------------------------------------------------------
HIPEX_HIERARCHY_SEPARATOR               = "/";
HIPEX_NODE_NAME_SEPARATOR               = "_";
HIPEX_DEFAULT_INSTANCE_PREFIX           = "I";
HIPEX_DEFAULT_NODE_PREFIX               = "#";
HIPEX_DELETE_BAD_CHAR                   = "NO";
HIPEX_XY_LOCATION                       = "NO";
HIPEX_CASE_SENSITIVE_NET_NAMES          = "YES";
HIPEX_AUTOGENERATE_LOCAL                = "YES";
POWER_NODE                              = {"VDD"};
GROUND_NODE                             = {"VSS"};
GLOBAL_TEXT_LIST                        = {"VDD", "VSS"};
HIPEX_PIN_DELIMITER                     = ":";

!--------------------------------------------------------------------
!Explosion parameters
!--------------------------------------------------------------------
HIPEX_WIRING_EXPLODE                    = "NO";
HIPEX_KEEP_FLATTEN_CELLS                = "YES";
HIPEX_TEXT_TOP                          = "NO";
HIPEX_AUTO_EXPLODE                      = "NO";
HIPEX SET_CELL_OPTIONS {"DFF"} /EXPLODE;

!--------------------------------------------------------------------
!Pins parameters
!--------------------------------------------------------------------
HIPEX_IGNORE_DANGLE_PINS                = "NO";

!--------------------------------------------------------------------
!BackAnnotate parameters
!--------------------------------------------------------------------
HIPEX_BACKANNOTATE                      = "NO";

!--------------------------------------------------------------------
!Capacitance Extraction parameters
!--------------------------------------------------------------------
CPX_COUPLED_THRESHOLD                   = 0.0;
CPX_EXTRACT_DANGLES                     = "NO";
CPX_OUTPUT_DUMMY_CAPA                   = "NO";
CPX_FIELD_SOLVER                        = "NO";

!--------------------------------------------------------------------
!Field Solver C-extraction (Stellar) parameters
!--------------------------------------------------------------------
CPX_STEP_X                              = 0.5;
CPX_STEP_Y                              = 0.5;
CPX_STEP_Z                              = 0.5;
CPX_PRECISION                           = 0.01;
CPX_MAX_ITER                            = 100;
CPX_DECOMPOSITION                       = "YES";
CPX_DEC_STEP                            = "NO";
CPX_DEC_VALUE                           = -1.0;
CPX_BOX                                 = "NO";
CPX_BOX_VALUES_XMIN                     = 0.0;
CPX_BOX_VALUES_XMAX                     = 0.0;
CPX_BOX_VALUES_YMIN                     = 0.0;
CPX_BOX_VALUES_YMAX                     = 0.0;
CPX_FILTER                              = "NO";
CPX_CAPA_MIN                            = 1e-20;
CPX_RENEW                               = "NO";
CPX_SAVE_FILE                           = "/home/alexa/2020_06/08/RenewSavedFile.sav";
CPX_THREED_GENERATION                   = "NO";
CPX_THREED_FILENAME                     = "/home/alexa/2020_06/08/3DStructureFile.str";

!--------------------------------------------------------------------
!Field Solver C-extraction (Clever) parameters
!--------------------------------------------------------------------

!--------------------------------------------------------------------
!Resistance Extraction parameters
!--------------------------------------------------------------------
RPX_SERIAL_MERGE_THRESHOLD              = 0.0;
RPX_OUTPUT_XY                           = "YES";
RPX_OUTPUT_LAYER_NAMES                  = "YES";
RPX_SKIP_POWER                          = "YES";
RPX_USE_TEXTS_AS_SUBNODES               = "NO";
RPX_USE_FIELD_SOLVER                    = "NO";

!--------------------------------------------------------------------
!Netlist RC Reduction parameters
!--------------------------------------------------------------------
NETLIST_CRC                             = "NO";

!--------------------------------------------------------------------
!Coefficient Units parameters
!--------------------------------------------------------------------
HIPEX SET_UNIT /CAPACITANCE "pF";
HIPEX SET_UNIT /RESISTANCE "Ohm";
HIPEX SET_UNIT /LENGTH "um";

run_net.lisa

INCLUDE ("hipex_ex08_opt.lisa");
INCLUDE ("hipex_ex08_net_cmd.lisa");

HIPEX_SUMMARY_PATH                      = "/home/alexa/2020_06/08";
HIPEX_NET_MAIN();

run_rc.lisa

INCLUDE ("hipex_ex08_opt.lisa");
INCLUDE ("hipex_ex08_net_cmd.lisa");
INCLUDE ("../silvaco_para_r.lisa");
INCLUDE ("../silvaco_para_c.lisa");

HIPEX_SUMMARY_PATH                      = "/home/alexa/2020_06/08";
HDB READ;
print("Writing Stripe Database  ...");
HDB WRITE_STRIPES /FULL  "default" 200 10;
print("Stripes OK.");
print("Parasitic capacitance extraction...");
CPX MAIN "default" /rewrite;
print("Parasitic resistance extraction...");
RPX MAIN "default" /rewrite;
netlist spice/hier/rc "/home/alexa/2020_06/08/DFF_rc_hier.spice";

silvaco_dev_extract.dsf

/* *********************************************************** */
/*                         DRC Script                          */
/* *********************************************************** */

Layers:
    N_WELL   (42   /* Original */)
,   P_WELL   (59   /* Original */)
,   ACTIVE   (43   /* Original */)
,   THICK_ACTIVE   (60   /* Original */)
,   PBASE   (58   /* Original */)
,   POLY_CAP1   (28   /* Original */)
,   POLY   (46   /* Original */)
,   SILICIDE_BLOCK   (29   /* Original */)
,   N_PLUS_SELECT   (45   /* Original */)
,   P_PLUS_SELECT   (44   /* Original */)
,   POLY2   (56   /* Original */)
,   HI_RES_IMPLANT   (34   /* Original */)
,   CONTACT   (25   /* Original */)
,   METAL1   (49   /* Original */)
,   VIA   (50   /* Original */)
,   METAL2   (51   /* Original */)
,   VIA2   (61   /* Original */)
,   METAL3   (62   /* Original */)
,   VIA3   (30   /* Original */)
,   METAL4   (31   /* Original */)
,   CAP_TOP_METAL   (35   /* Original */)
,   VIA4   (32   /* Original */)
,   METAL5   (33   /* Original */)
,   VIA5   (36   /* Original */)
,   METAL6   (37   /* Original */)
,   DEEP_N_WELL   (38   /* Original */)
,   GLASS   (52   /* Original */)
,   PADS   (26   /* Original */)
,   RES_ID   (1, 0   /* Original */)
,   INDDMY_ID   (2, 0   /* Original */)
;

/*    1 */ free_layer_definition_order: yes;
/*    2 */ Merge_Input: on;
/*    3 */ Database_Precision: 1000;
/*    4 */ Grid_Resolution: GridX = 1, GridY = 1;
/*    5 */ Unit: 1um;
/*    6 */ Incremental_Connect: no;
/*    7 */ Update_layout: input=no, technology=no, new=no, layers=
(pnp_id,pnp_e,pnp_c,npn_e,npn_b,gate,p_sd,n_sd,cmosp_id,cmosn_id,hvcmosp_id,
hvpmos_d,hvnmos_s,rpplus_id,rnpoly_id,rpoly_id,rnwell_id,rpplus_pin,connect_poly,
connect_nwell,substrate,sub_tie,well_tie,deepnwell_tie,p1p2_id,poly_con,poly2cap_con,
ind_id,connect_metal1,ind_plus,ind_minus,NR_counter,width,space,radius
);

Select: Layer1=PBASE, Layer2=N_PLUS_SELECT, LayerR=&PNP_PBASE, Relation=overlap, options=(not);
UnderSize: Value=1um, Layer=&PNP_PBASE, LayerR=&A;
Logicform: pnp_id=&A.dif.(ACTIVE);

Contours: Layer=pnp_id, LayerR=pnp_e, options=(holes);
Logicform: pnp_c=PBASE.and.ACTIVE.dif.(pnp_e.or.P_PLUS_SELECT.or.N_PLUS_SELECT);

Logicform: npn_e=PBASE.and.N_PLUS_SELECT.AND.ACTIVE;
LogicForm: npn_b=PBASE.and.ACTIVE.and.P_PLUS_SELECT;
Logicform: gate=POLY.and.ACTIVE;
Logicform: p_sd=(P_PLUS_SELECT.and.ACTIVE.AND.N_WELL).dif.(POLY.or.DEEP_N_WELL.or.RES_ID);
Logicform: n_sd=(N_PLUS_SELECT.and.ACTIVE).dif.(POLY.or.THICK_ACTIVE.or.N_WELL);
Logicform: cmosp_id=gate.and.P_PLUS_SELECT.and.N_WELL;
Logicform: cmosn_id=gate.and.N_PLUS_SELECT.dif.THICK_ACTIVE;
Logicform: hvcmosp_id=gate.and.P_PLUS_SELECT.and.THICK_ACTIVE.dif.P_WELL;
Select: Layer1=ACTIVE, Layer2=hvcmosp_id, Relation=overlap, LayerR=&A1;
Logicform: hvpmos_d=&A1.dif.(POLY.or.P_WELL.or.N_WELL);
Select: Layer1=ACTIVE, Layer2=hvcmosp_id, Relation=overlap, LayerR=&A2;
Logicform: hvpmos_s=&A2.dif.(hvcmosp_id.or.N_WELL.or.hvpmos_d);
Logicform: hvcmosn_id=gate.and.N_PLUS_SELECT.and.THICK_ACTIVE;
Select: Layer1=ACTIVE, Layer2=hvcmosn_id, Relation=overlap, LayerR=&A3;
Logicform: hvnmos_d=&A3.dif.(POLY.or.P_PLUS_SELECT.or.N_WELL);
Select: Layer1=ACTIVE, Layer2=hvcmosn_id, Relation=overlap, LayerR=&A4;
Logicform: hvnmos_s=&A4.dif.(hvcmosn_id.or.hvnmos_d.or.P_PLUS_SELECT);
Logicform: rpplus_id=N_WELL.and.P_PLUS_SELECT.and.ACTIVE.and.RES_ID;
Logicform: rnpoly_id=N_PLUS_SELECT.and.POLY.and.RES_ID;
Logicform: rpoly_id=(POLY.and.RES_ID).dif.N_PLUS_SELECT;
Logicform: rnwell_id=(N_WELL.and.RES_ID).dif.P_PLUS_SELECT;
LogicForm: &rpplus_pin1=(ACTIVE.and.P_PLUS_SELECT).dif.RES_ID;
Select: Relation=touch, Layer1=&rpplus_pin1, Layer2=rpplus_id, LayerR=rpplus_pin;
Logicform: connect_poly=POLY.dif.(RES_ID.or.POLY2);
Logicform: connect_nwell=N_WELL.dif.(RES_ID);
Substrate: LayerR=substrate;
Logicform: sub_tie=(ACTIVE.AND.P_PLUS_SELECT).dif.(DEEP_N_WELL.or.N_WELL);
Logicform: well_tie=(ACTIVE.AND.N_PLUS_SELECT.AND.N_WELL).dif.npn_e;
Logicform: &deepnwell_tie1=ACTIVE.AND.N_PLUS_SELECT.AND.DEEP_N_WELL;
Select: Relation=touch, Layer1=&deepnwell_tie1, Layer2=hvpmos_s, LayerR=&tempA;
LogicForm: deepnwell_tie=&deepnwell_tie1.dif.&tempA;
Logicform: p1p2_id=(POLY2.and.POLY).dif.ACTIVE;
Logicform: poly_con=(POLY.dif.POLY2).and.CONTACT;
Logicform: poly2cap_con=POLY.AND.POLY2.and.CONTACT;

LogicForm: &ind_id1=METAL1.and.INDDMY_ID;
PERIMETER: Layer=&ind_id1, Value=75, Type=GT, LayerR=ind_id;
select: relation=vertex, Layer=METAL1, Options=(5:99999), LayerR=&metal1;
//LogicForm: connect_metal1=&metal1.dif.ind_id;
Corner: Layer=ind_id, Value=0.1, Options=(INSIDE,A90),LayerR=&temp11;
Select: Relation=flush, Layer1=&temp11, Layer2=INDDMY_ID, LayerR=&temp2;
Size: Layer=&temp2, within=ind_id, Options=(cut), step=0.5, Value=10, LayerR=ind_plus;
Corner: Layer=ind_id, Value=0.2, Options=(inside,A90), LayerR=&temp12;
Size: Layer=&temp12, within=ind_id, Options=(cut), step=0.5, Value=10, LayerR=&temp;
//Select: Relation=flush, Layer1=&temp, Layer2=INDDMY_ID, LayerR=ind_minus, Options=(not);
//Added new by AK 09/10/08
Select: Relation=vertex, Layer=&ind_id1, Options=(1:4), LayerR=&ind_minus1;
LogicForm: ind_minus2=METAL2.and.INDDMY_ID.and.&ind_minus1;
LogicForm: connect_metal1=(METAL1.dif.ind_id); //so that the 4-vertex M1 piece inside INDDMY will also get connectivity
Select: Relation=overlap, Layer1=METAL2, Layer2=ind_id, LayerR=ind_minus;


//New code ends

Corner: Layer=ind_id, Value=0.1, Options=(inside,any), LayerR=NR_counter;
LogicForm: width=(METAL1.and.METAL2.and.INDDMY_ID).dif.ind_minus2;
LogicForm: &space1=(METAL2.and.INDDMY_ID).dif.METAL1;
PERIMETER: Layer=&space1, LayerR=&space2, Value=79, Type=LT;
SELECT: Relation=touch, layer1=&space2, Layer2=ind_id, LayerR=&space3;
SELECT_edges: Relation=coincide, layer1=&space3, Layer2=ind_id, LayerR=&space4;
SELECT: Relation=touch, layer1=&space3, Layer2=&space4, LayerR=space, options=(2:2);
LogicForm: &space1A=(METAL2.and.INDDMY_ID).dif.METAL1;
PERIMETER: Layer=&space1A, LayerR=radius, Value=80, Type=GE;

silvaco_para_c.lisa

!*******************************************************************************
!**
!** Silvaco Hipex Example Capacitance Extraction Deck
!**
!*******************************************************************************

!* LAYER THICKNESSES
!**********************************************************************************
poly1_thickness = 0.120000;
metal1_thickness = 0.410000;
metal2_thickness = 0.310000;




hipex set_unit/capacitance "fF"; 
hipex set_unit/length "um";
cpx order "substrate","poly1","metal1","metal2";

!* CAPACITANCE INTRINSIC PLATE poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "area_poly1_substrate"
PARAMETER area
DO BEGIN
    C = 0.0;
    (C = 0.12637 * area);
    RETURN (C);
END;

cpx area "poly1" "substrate"
    /func = "area_poly1_substrate"
;

!* CAPACITANCE INTRINSIC PLATE metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "area_metal1_substrate"
PARAMETER area
DO BEGIN
    C = 0.0;
    (C = 0.04106 * area);
    RETURN (C);
END;

cpx area "metal1" "substrate"
    /func = "area_metal1_substrate"
;

!* CAPACITANCE INTRINSIC PLATE metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "area_metal2_substrate"
PARAMETER area
DO BEGIN
    C = 0.0;
    (C = 0.036421 * area);
    RETURN (C);
END;

cpx area "metal2" "substrate"
    /func = "area_metal2_substrate"
;

!* CAPACITANCE INTRINSIC FRINGE poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_poly1_substrate"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 0;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0))  THEN
        (C = length * 0.0353199 * (1 - exp(-0.788591 * (distance + 0.0494530))) * (0.12646 * poly1_thickness + 0.79726));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1))  THEN
        (C = length * 0.035649 * (1 - exp(-0.617744 * (distance + -0.0235609))));
    
    IF  (distance LEQ 0.0)  THEN
        (C = length * 0.2167 * pow(width , 0.11563) * (0.1976 * poly1_thickness + 0.32596));
    
    RETURN (C);
END;

cpx fringe "poly1" "substrate"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_poly1_substrate"
;

!* CAPACITANCE NEARBODY poly1 WITH SHIELD poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-3.54362 - 2.13463 * (distance)) + 0.03452 / pow(distance , 1.13436)) * 1.17696 * pow((width1 + width2) *0.5 , 0.24175));
     RETURN (C);
END;

cpx lateral "poly1"
    /inside_layers = "poly1"
    /max_distance = 3
    /max_width = 3    /func = "lateral_poly1"
;

!* CAPACITANCE INTRINSIC FRINGE metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal1_substrate"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 0;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0))  THEN
        (C = length * 0.130634 * (1 - exp(-0.73973 * (distance + 0.135325))) * pow(width , 0.0335045 * distance + -0.0162616) * (0.106419 * metal1_thickness + 0.293763));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1))  THEN
        (C = length * 0.0374588 * (1 - exp(-0.632991 * (distance + 0.0713056))));
    
    IF  (distance LEQ 0.0)  THEN
        (C = length * 0.134145 * pow(width , 0.0950326) * (0.6562 * metal1_thickness + 0.204692));
    
    RETURN (C);
END;

cpx fringe "metal1" "substrate"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal1_substrate"
;

!* CAPACITANCE NEARBODY metal1 WITH SHIELD metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-1.10391 - 1.71929 * distance) + 0.149301 / pow(distance , 0.929234)) * 4.2941 * pow((width1 + width2) *0.5 , 0.101713) * (0.0591971 * (metal1_thickness + metal1_thickness) *0.5 + 0.00754242));
    RETURN (C);
END;

cpx lateral "metal1"
    /inside_layers = "metal1"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal1"
;

!* CAPACITANCE INTRINSIC FRINGE metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal2_substrate"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 0;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0))  THEN
        (C = length * 0.139345 * (1 - exp(-0.4654231 * (distance + 0.234526))) * pow(width , 0.0249715 * distance + -0.0126161) * (0.02072 * metal2_thickness + 0.321291));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1))  THEN
        (C = length * 0.0304499 * (1 - exp(-0.620603 * (distance + 0.101996))));
    
    IF  (distance LEQ 0.0)  THEN
        (C = length * 0.146923 * pow(width , 0.09523288) * (0.190051 * metal2_thickness + 0.198839));
    
    RETURN (C);
END;

cpx fringe "metal2" "substrate"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal2_substrate"
;

!* CAPACITANCE NEARBODY metal2 WITH SHIELD metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-0.19751 - 0.611995 * distance) + 0.4617615 / pow(distance , 0.95917)) * 3.69216 * pow((width1 + width2) *0.5 , 0.11064) * (0.0143932 * (metal2_thickness + metal2_thickness) *0.5 + 0.00306023));
    RETURN (C);
END;

cpx lateral "metal2"
    /inside_layers = "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal2"
;

!* CAPACITANCE CROSSOVER PLATE poly1 metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "area_poly1_metal1"
PARAMETER area
DO BEGIN
    C = 0.0;
    (C = 0.171654 * area);
    RETURN (C);
END;

cpx area "poly1" "metal1"
    /func = "area_poly1_metal1"
;

!* CAPACITANCE CROSSOVER PLATE poly1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "area_poly1_metal2"
PARAMETER area
DO BEGIN
    C = 0.0;
    (C = 0.0379239 * area);
    RETURN (C);
END;

cpx area "poly1" "metal2"
    /func = "area_poly1_metal2"
;

!* CAPACITANCE CROSSOVER PLATE metal1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "area_metal1_metal2"
PARAMETER area
DO BEGIN
    C = 0.0;
    (C = 0.09565045 * area);
    RETURN (C);
END;

cpx area "metal1" "metal2"
    /func = "area_metal1_metal2"
;


!* CAPACITANCE NEARBODY poly1 INSIDE OF metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1__metal1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-1.03762 - 4.20062 * distance) + 0.00176965 / pow(distance , 2.21765)) * 3.9762 * pow((width1 + width2) *0.5 , 0.0359554) * (0.139511 * (poly1_thickness + poly1_thickness) *0.5 + 0.0441436));
    RETURN (C);
END;

cpx lateral "poly1"
    /outside_layers = "metal1"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_poly1__metal1"
;

!* CAPACITANCE CROSSOVER FRINGE poly1 metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_poly1_metal1"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0960231 * (1 - exp(-2.71336 * (distance + -0.00971136))) * pow(width , 0.0235288 * distance + 0.00120236) * (1.9324 * poly1_thickness + 0.170334));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0342152 * (1 - exp(-2.98836 * (distance + -0.0145488))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.141396 * pow(width , 0.0211454) * (0.9646 * poly1_thickness + 0.163001));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (-0.0419423 * distance + 0.141244) * (0.4697556 - exp(-(-0.0160641 * distance + 1.2885) * (enclose + 1.28836 * distance + 0.245883) - (1.51374 * distance + -3.88901) * (enclose + -0.4696305 * distance + 0.0165162) * (enclose + -0.4696305 * distance + 0.0165162))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.0960231 * (1 - exp(-2.71336 * (distance + -0.00971136))) * pow(width , 0.0235288 * distance + 0.00120236) * (1.9324 * poly1_thickness + 0.170334));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0609652 * (0.4697556 - exp(-1.21088 * (enclose + 1.36376) - -2.41723 * (enclose + -0.3883933) * (enclose + -0.3883933))));
        
    RETURN (C);
END;

cpx fringe "poly1" "metal1"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_poly1_metal1"
;

!* CAPACITANCE INTRINSIC FRINGE poly1 INSIDE OF metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_poly1_substrate__metal1"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 0;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0))  THEN
        (C = length * 0.16345 * (1 - exp(-2.34231 * (distance + -0.0139797))) * pow(width , 0.0465635 * distance + -0.0263716) * (0.09590511 * poly1_thickness + 0.237244));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1))  THEN
        (C = length * 0.0230523 * (1 - exp(-2.6193 * (distance + -0.060216))));
    
    IF  (distance LEQ 0.0)  THEN
        (C = length * 0.13349 * pow(width , 0.0142369) * (0.110323 * poly1_thickness + 0.131611));
    
    RETURN (C);
END;

cpx fringe "poly1" "substrate"
    /outside_layers = "metal1"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_poly1_substrate__metal1"
;

!* CAPACITANCE NEARBODY poly1 INSIDE OF metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1__metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-0.656913 - 2.7136 * distance) + 0.0245321 / pow(distance , 1.71794)) * 3.91451 * pow((width1 + width2) *0.5 , 0.0456031) * (0.09545013 * (poly1_thickness + poly1_thickness) *0.5 + 0.023546));
    RETURN (C);
END;

cpx lateral "poly1"
    /outside_layers = "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_poly1__metal2"
;

!* CAPACITANCE CROSSOVER FRINGE poly1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_poly1_metal2"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.11885 * (1 - exp(-0.162646 * (distance + 0.0613762))) * pow(width , 0.200606 * distance + -0.135994) * (0.926231 * poly1_thickness + 0.4623411));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0551115 * (1 - exp(-0.243023 * (distance + 0.136362))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.102333 * pow(width , 0.0344236) * (0.306129 * poly1_thickness + 0.10173));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (0.00244212 * distance + 0.0424191) * (0.913314 - exp(-(3.30617 * distance + 0.945469) * (enclose + 0.394156 * distance + 0.62464) - (-0.293952 * distance + -0.344352) * (enclose + 1.19597 * distance + 0.645423) * (enclose + 1.19597 * distance + 0.645423))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.11885 * (1 - exp(-0.162646 * (distance + 0.0613762))) * pow(width , 0.200606 * distance + -0.135994) * (0.926231 * poly1_thickness + 0.4623411));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0162441 * (0.913314 - exp(-3.69723 * (enclose + 0.659175) - -0.4691356 * (enclose + 1.65061) * (enclose + 1.65061))));
        
    RETURN (C);
END;

cpx fringe "poly1" "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_poly1_metal2"
;

!* CAPACITANCE INTRINSIC FRINGE poly1 INSIDE OF metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_poly1_substrate__metal2"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 0;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0))  THEN
        (C = length * 0.0450792 * (1 - exp(-0.325613 * (distance + 0.0395288))) * pow(width , 0.131063 * distance + -0.10588) * (0.0956316 * poly1_thickness + 0.754441));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1))  THEN
        (C = length * 0.0335421 * (1 - exp(-1.63743 * (distance + -0.00171696))));
    
    IF  (distance LEQ 0.0)  THEN
        (C = length * 0.136919 * pow(width , 0.0264713) * (0.131602 * poly1_thickness + 0.19932));
    
    RETURN (C);
END;

cpx fringe "poly1" "substrate"
    /outside_layers = "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_poly1_substrate__metal2"
;


!* CAPACITANCE NEARBODY metal1 INSIDE OF metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1__metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-1.00051 - 2.61631 * distance) + 0.0123231 / pow(distance , 1.37306)) * 3.90564 * pow((width1 + width2) *0.5 , 0.0506323) * (0.136463 * (metal1_thickness + metal1_thickness) *0.5 + 0.0120011));
    RETURN (C);
END;

cpx lateral "metal1"
    /outside_layers = "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal1__metal2"
;

!* CAPACITANCE CROSSOVER FRINGE metal1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal1_metal2"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.111356 * (1 - exp(-1.56464 * (distance + 0.00429943))) * pow(width , 0.0316924 * distance + -0.0333171) * (0.199555 * metal1_thickness + 0.294116));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0291696 * (1 - exp(-1.65441 * (distance + -0.0139712))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.141562 * pow(width , 0.0132309) * (0.241626 * metal1_thickness + 0.130439));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (0.00144554 * distance + 0.135441) * (0.350263 - exp(-(-0.354961 * distance + 3.7372) * (enclose + 0.112065 * distance + 0.39037) - (1.59321 * distance + -2.96921) * (enclose + -0.362611 * distance + 0.3632365) * (enclose + -0.362611 * distance + 0.3632365))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.111356 * (1 - exp(-1.56464 * (distance + 0.00429943))) * pow(width , 0.0316924 * distance + -0.0333171) * (0.199555 * metal1_thickness + 0.294116));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0450965 * (0.350263 - exp(-3.03024 * (enclose + 0.4633063) - 0.20323 * (enclose + -0.169237) * (enclose + -0.169237))));
        
    RETURN (C);
END;

cpx fringe "metal1" "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal1_metal2"
;

!* CAPACITANCE INTRINSIC FRINGE metal1 INSIDE OF metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal1_substrate__metal2"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 0;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0))  THEN
        (C = length * 0.106065 * (1 - exp(-1.24536 * (distance + 0.00758811))) * pow(width , 0.0463711 * distance + -0.0507969) * (0.19921 * metal1_thickness + 0.143261));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1))  THEN
        (C = length * 0.0163796 * (1 - exp(-1.63161 * (distance + -0.0200033))));
    
    IF  (distance LEQ 0.0)  THEN
        (C = length * 0.111102 * pow(width , 0.0249492) * (0.260495 * metal1_thickness + 0.197337));
    
    RETURN (C);
END;

cpx fringe "metal1" "substrate"
    /outside_layers = "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal1_substrate__metal2"
;


!* CAPACITANCE NEARBODY metal1 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1__poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-1.3062 - 2.63033 * distance) + 0.0556321 / pow(distance , 1.07245)) * 4.35235 * pow((width1 + width2) *0.5 , 0.0979511) * (0.106313 * (metal1_thickness + metal1_thickness) *0.5 + 0.00605931));
    RETURN (C);
END;

cpx lateral "metal1"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal1__poly1"
;

!* CAPACITANCE CROSSOVER FRINGE metal1 poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal1_poly1"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.164976 * (1 - exp(-1.69647 * (distance + 0.0379051))) * pow(width , 0.00327612 * distance + 0.0176262) * (0.245621 * metal1_thickness + 0.237163));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0239646 * (1 - exp(-1.93430 * (distance + 0.0196565))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.188441 * pow(width , 0.0611623) * (0.3656236 * metal1_thickness + 0.410745));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (0.0153932 * distance + 0.09524139) * (0.759332 - exp(-(-0.342355 * distance + 0.4231) * (enclose + -3.41419 * distance + -0.951299) - (0.363146 * distance + 0.0329321) * (enclose + -1.03924 * distance + 3.76324) * (enclose + -1.03924 * distance + 3.76324))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.164976 * (1 - exp(-1.69647 * (distance + 0.0379051))) * pow(width , 0.00327612 * distance + 0.0176262) * (0.245621 * metal1_thickness + 0.237163));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0588133 * (0.759332 - exp(-0.20002 * (enclose + -7.34563) - 0.745416 * (enclose + 1.88596) * (enclose + 1.88596))));
        
    RETURN (C);
END;

cpx fringe "metal1" "poly1"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal1_poly1"
;

!* CAPACITANCE NEARBODY metal2 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2__poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-0.913615 - 1.13325 * distance) + 0.214654 / pow(distance , 0.932202)) * 3.96165 * pow((width1 + width2) *0.5 , 0.165392) * (0.0341232 * (metal2_thickness + metal2_thickness) *0.5 + 0.00713265));
    RETURN (C);
END;

cpx lateral "metal2"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal2__poly1"
;

!* CAPACITANCE CROSSOVER FRINGE metal2 poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal2_poly1"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.190611 * (1 - exp(-0.76326 * (distance + 0.143212))) * pow(width , 0.017062 * distance + 0.00556316) * (0.039465 * metal2_thickness + 0.33326));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0311392 * (1 - exp(-0.61932 * (distance + 0.0326169))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.132388 * pow(width , 0.0932702) * (0.115541 * metal2_thickness + 0.20886));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (0.0145699 * distance + 0.0492696) * (0.4633592 - exp(-(0.0594293 * distance + 0.737374) * (enclose + -0.303954 * distance + 0.62909) - (0.144349 * distance + -0.0414194) * (enclose + -0.3616432 * distance + 2.46374) * (enclose + -0.3616432 * distance + 2.46374))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.190611 * (1 - exp(-0.76326 * (distance + 0.143212))) * pow(width , 0.017062 * distance + 0.00556316) * (0.039465 * metal2_thickness + 0.33326));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0359907 * (0.4633592 - exp(-0.656203 * (enclose + 0.261119) - 0.413396 * (enclose + 1.32296) * (enclose + 1.32296))));
        
    RETURN (C);
END;

cpx fringe "metal2" "poly1"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal2_poly1"
;

!* CAPACITANCE NEARBODY metal2 INSIDE OF metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2__metal1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-1.31616 - 1.63144 * distance) + 0.104532 / pow(distance , 1.0545)) * 4.21172 * pow((width1 + width2) *0.5 , 0.09517465) * (0.0555629 * (metal2_thickness + metal2_thickness) *0.5 + 0.00322905));
    RETURN (C);
END;

cpx lateral "metal2"
    /outside_layers = "metal1"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal2__metal1"
;

!* CAPACITANCE CROSSOVER FRINGE metal2 metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal2_metal1"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.103436 * (1 - exp(-1.39349 * (distance + 0.0329314))) * pow(width , 0.00633765 * distance + 0.0206341) * (0.0941711 * metal2_thickness + 0.372105));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0365511 * (1 - exp(-1.39493 * (distance + 0.0343211))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.171643 * pow(width , 0.0886399) * (0.136019 * metal2_thickness + 0.413241));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (0.00885236 * distance + 0.16169) * (0.4650735 - exp(-(-0.4695941 * distance + 3.56352) * (enclose + 0.11288 * distance + 0.263336) - (1.56326 * distance + -2.92641) * (enclose + -0.319161 * distance + 0.3616094) * (enclose + -0.319161 * distance + 0.3616094))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.103436 * (1 - exp(-1.39349 * (distance + 0.0329314))) * pow(width , 0.00633765 * distance + 0.0206341) * (0.0941711 * metal2_thickness + 0.372105));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0236565 * (0.4650735 - exp(-2.37597 * (enclose + 0.3691796) - 0.203923 * (enclose + -0.410088) * (enclose + -0.410088))));
        
    RETURN (C);
END;

cpx fringe "metal2" "metal1"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal2_metal1"
;


!* CAPACITANCE NEARBODY metal1 INSIDE OF poly1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1__poly1_metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 3;
    C = 0.0;
    (C = length * (exp(-0.9469 - 4.23956 * distance) + 0.00370026 / pow(distance , 1.74201)) * 3.72393 * pow((width1 + width2) *0.5 , 0.0124131) * (0.239471 * (metal1_thickness + metal1_thickness) *0.5 + 0.00606032));
    RETURN (C);
END;

cpx lateral "metal1"
    /outside_layers = "poly1","metal2"
    /max_distance = 3
    /max_width = 3
    /func = "lateral_metal1__poly1_metal2"
;

!* CAPACITANCE CROSSOVER FRINGE metal1 metal2 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal1_metal2__poly1"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.090932 * (1 - exp(-2.5545 * (distance + -0.0239754))) * pow(width , 0.019205 * distance + -0.0152424) * (0.292973 * metal1_thickness + 0.60491));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.041009 * (1 - exp(-2.63455 * (distance + -0.0441392))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.120430 * pow(width , 0.00545616) * (0.295171 * metal1_thickness + 0.112163));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (-0.0211611 * distance + 0.196551) * (0.4693232 - exp(-(0.0618861 * distance + 0.4326388) * (enclose + 2.56564 * distance + 0.707071) - (0.631530 * distance + -2.4236) * (enclose + -0.626005 * distance + -0.0931015) * (enclose + -0.626005 * distance + -0.0931015))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.090932 * (1 - exp(-2.5545 * (distance + -0.0239754))) * pow(width , 0.019205 * distance + -0.0152424) * (0.292973 * metal1_thickness + 0.60491));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.0299885 * (0.4693232 - exp(-0.630102 * (enclose + 5.63321) - -1.13955 * (enclose + -1.32911) * (enclose + -1.32911))));
        
    RETURN (C);
END;

cpx fringe "metal1" "metal2"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal1_metal2__poly1"
;

!* CAPACITANCE CROSSOVER FRINGE metal1 poly1 INSIDE OF metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "fringe_metal1_poly1__metal2"
PARAMETER length
PARAMETER distance
PARAMETER enclose
PARAMETER same_net
PARAMETER width
DO BEGIN
    max_distance = 3;
    max_width = 3;
    max_enclose = 3;
    C = 0.0;
    IF  ((distance GTR 0.0) AND (same_net EQL 0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.115542 * (1 - exp(-2.76946 * (distance + -0.0162923))) * pow(width , 0.0136545 * distance + -0.00931611) * (0.349606 * metal1_thickness + 0.21394));
    
    IF  ((distance GTR 0.0) AND (same_net EQL 1) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.0335099 * (1 - exp(-3.00971 * (distance + -0.0242615))));
    
    IF  ((distance LEQ 0.0) AND (enclose GEQ max_enclose))  THEN
        (C = length * 0.146911 * pow(width , 0.0052356) * (0.363964 * metal1_thickness + 0.12413));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose LSS distance))  THEN
        (C = length * 0.46 * (-0.0137149 * distance + 1.63456) * (0.0394501 - exp(-(0.4630412 * distance + 0.3623163) * (enclose + -7.76956 * distance + 1.63322) - (0.0201542 * distance + 0.102394) * (enclose + 4.34161 * distance + 4.53946) * (enclose + 4.34161 * distance + 4.53946))));
    
    IF  ((distance GTR 0.0) AND (enclose LSS max_enclose) AND (enclose GEQ distance))  THEN
        (C = length * 0.115542 * (1 - exp(-2.76946 * (distance + -0.0162923))) * pow(width , 0.0136545 * distance + -0.00931611) * (0.349606 * metal1_thickness + 0.21394));
    
    IF  ((distance LEQ 0.0) AND (enclose LSS max_enclose))  THEN
        (C = length * 0.603565 * (0.0394501 - exp(-1.59961 * (enclose + -13.7005) - 0.146102 * (enclose + 13.4137) * (enclose + 13.4137)) + 0.00434562));
        
    RETURN (C);
END;

cpx fringe "metal1" "poly1"
    /outside_layers = "metal2"
    /max_distance = 3
    /max_width = 3
    /func = "fringe_metal1_poly1__metal2"
;



!* CAPACITANCE NEARBODY poly1 metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1_metal1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.0246112 * exp(-2.09129 * distance) + 0.024883 * exp(-0.913269 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.0246112 * exp(-2.09129 * distance) + 0.024883 * exp(-0.913269 * distance)));
    
    RETURN (C);
END;

cpx lateral "poly1" "metal1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_poly1_metal1"
;

!* CAPACITANCE NEARBODY metal1 poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1_poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.0246112 * exp(-2.09129 * distance) + 0.024883 * exp(-0.913269 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.0246112 * exp(-2.09129 * distance) + 0.024883 * exp(-0.913269 * distance)));
    
    RETURN (C);
END;

cpx lateral "metal1" "poly1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal1_poly1"
;

!* CAPACITANCE NEARBODY poly1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1_metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.0094441 * exp(-0.4632236 * distance) + 0.0094391 * exp(-0.4884132 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.0094441 * exp(-0.4632236 * distance) + 0.0094391 * exp(-0.4884132 * distance)));
    
    RETURN (C);
END;

cpx lateral "poly1" "metal2"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_poly1_metal2"
;

!* CAPACITANCE NEARBODY metal2 poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2_poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.0094441 * exp(-0.4632236 * distance) + 0.0094391 * exp(-0.4884132 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.0094441 * exp(-0.4632236 * distance) + 0.0094391 * exp(-0.4884132 * distance)));
    
    RETURN (C);
END;

cpx lateral "metal2" "poly1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal2_poly1"
;


!* CAPACITANCE NEARBODY metal1 metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1_metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.00392388 * exp(-0.135015 * distance) + 0.0361453 * exp(-1.0542 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.00392388 * exp(-0.135015 * distance) + 0.0361453 * exp(-1.0542 * distance)));
    
    RETURN (C);
END;

cpx lateral "metal1" "metal2"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal1_metal2"
;

!* CAPACITANCE NEARBODY metal2 metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2_metal1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.00392388 * exp(-0.135015 * distance) + 0.0361453 * exp(-1.0542 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.00392388 * exp(-0.135015 * distance) + 0.0361453 * exp(-1.0542 * distance)));
    
    RETURN (C);
END;

cpx lateral "metal2" "metal1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal2_metal1"
;


!* CAPACITANCE NEARBODY poly1 metal1 INSIDE OF metal1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1_metal1__metal1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.00326302 * exp(-0.88233 * distance)) / pow(distance , 0.4631961) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.00326302 * exp(-0.88233 * distance)) / pow(distance , 0.4631961));
    
    RETURN (C);
END;

cpx lateral "poly1" "metal1"
    /outside_layers = "metal1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_poly1_metal1__metal1"
;

!* CAPACITANCE NEARBODY metal1 poly1 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1_poly1__poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.00326302 * exp(-0.88233 * distance)) / pow(distance , 0.4631961) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.00326302 * exp(-0.556233 * distance)) / pow(distance , 0.4631961));
    
    RETURN (C);
END;

cpx lateral "metal1" "poly1"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal1_poly1__poly1"
;

!* CAPACITANCE NEARBODY poly1 metal2 INSIDE OF metal2 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_poly1_metal2__metal2"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.00717161 * exp(-0.765616 * distance)) / pow(distance , 0.023197) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.00717161 * exp(-0.765616 * distance)) / pow(distance , 0.023197));
    
    RETURN (C);
END;

cpx lateral "poly1" "metal2"
    /outside_layers = "metal2"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_poly1_metal2__metal2"
;

!* CAPACITANCE NEARBODY metal2 poly1 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2_poly1__poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.00717161 * exp(-0.765616 * distance)) / pow(distance , 0.023197) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.00717161 * exp(-0.765616 * distance)) / pow(distance , 0.023197));
    
    RETURN (C);
END;

cpx lateral "metal2" "poly1"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal2_poly1__poly1"
;


!* CAPACITANCE NEARBODY metal1 metal2 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal1_metal2__poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.0178859 * exp(-2.23636 * distance) + 0.00230941 * exp(-0.332626 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.0178859 * exp(-2.23636 * distance) + 0.00230941 * exp(-0.332626 * distance)));
    
    RETURN (C);
END;

cpx lateral "metal1" "metal2"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal1_metal2__poly1"
;

!* CAPACITANCE NEARBODY metal2 metal1 INSIDE OF poly1 MASK
!*******************************************************************************
DEFINE PROCEDURE "lateral_metal2_metal1__poly1"
PARAMETER length
PARAMETER length_shield
PARAMETER distance
PARAMETER width1
PARAMETER width2
PARAMETER distance2
DO BEGIN
    max_distance = 3;
    max_width = 0;
    C = 0.0;
    IF  (distance2 GTR 0.0)  THEN
        (C = length * (0.0178859 * exp(-2.23636 * distance) + 0.00230941 * exp(-0.332626 * distance)) * (1 - exp((-m514k1_field * distance2) / (distance + m514k2_field))));
    
    IF  (distance2 LEQ 0.0)  THEN
        (C = length * (0.0178859 * exp(-2.23636 * distance) + 0.00230941 * exp(-0.332626 * distance)));
    
    RETURN (C);
END;

cpx lateral "metal2" "metal1"
    /outside_layers = "poly1"
    /max_distance = 3
    /max_width = 0
    /func = "lateral_metal2_metal1__poly1"
;

silvaco_para_r.lisa


rpx define_parasitic Wire
     /layer = DEEP_N_WELL
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 10000.0
;

rpx define_parasitic Wire
     /layer = connect_metal1
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 0.05
;

rpx define_parasitic Wire
     /layer = METAL2
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 0.05
;

rpx define_parasitic Wire
     /layer = METAL3
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 0.05
;

rpx define_parasitic Wire
     /layer = METAL4
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 0.05
;

rpx define_parasitic Wire
     /layer = METAL5
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 0.05
;

rpx define_parasitic Wire
     /layer = METAL6
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 0.01
;

rpx define_parasitic Wire
     /layer = POLY2
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 100.0
;

rpx define_parasitic Contact
     /layer = VIA
     /top = connect_metal1
     /bottom = METAL2
     /pres_area_resistivity_value = 0.05
;

rpx define_parasitic Contact
     /layer = VIA2
     /top = METAL2
     /bottom = METAL3
     /pres_area_resistivity_value = 0.05
;

rpx define_parasitic Contact
     /layer = VIA3
     /top = METAL3
     /bottom = METAL4
     /pres_area_resistivity_value = 0.05
;

rpx define_parasitic Contact
     /layer = VIA4
     /top = METAL4
     /bottom = METAL5
     /pres_area_resistivity_value = 0.05
;

rpx define_parasitic Contact
     /layer = VIA5
     /top = METAL6
     /bottom = METAL5
     /pres_area_resistivity_value = 0.04
;

rpx define_parasitic Wire
     /layer = connect_nwell
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 10000.0
;

rpx define_parasitic Wire
     /layer = connect_poly
     /max_length = 0.0
     /contact_oversize = 0.0
     /contact_cluster = 0.0
     /pres_sheet_resistivity_value = 50.0
;

rpx define_parasitic Contact
     /layer = poly2cap_con
     /top = POLY2
     /bottom = connect_metal1
     /pres_area_resistivity_value = 0.05
;

rpx define_parasitic Contact
     /layer = poly_con
     /top = connect_metal1
     /bottom = connect_poly
     /pres_area_resistivity_value = 0.05
;

Related Articles