updating devices connections for IC
diff --git a/IC/klayout/lvs/rule_decks/bjt_connection.lvs b/IC/klayout/lvs/rule_decks/bjt_connection.lvs
new file mode 100644
index 0000000..5e21220
--- /dev/null
+++ b/IC/klayout/lvs/rule_decks/bjt_connection.lvs
@@ -0,0 +1,68 @@
+################################################################################################
+# Copyright 2022 GlobalFoundries PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################################
+
+#================================
+# ------ BJT CONNECTIONS --------
+#================================
+logger.info('Starting LVS BJT CONNECTIONS')
+
+# ==============
+# ---- vnpn ----
+# ==============
+
+# npn_02p00x02p00 nodes connections
+connect(npn_02p00x02p00_e, contact)
+connect(npn_02p00x02p00_b, contact)
+connect(npn_02p00x02p00_c, contact)
+
+# npn_05p00x05p00 nodes connections
+connect(npn_05p00x05p00_e, contact)
+connect(npn_05p00x05p00_b, contact)
+connect(npn_05p00x05p00_c, contact)
+
+# ==============
+# ---- vpnp ----
+# ==============
+
+# pnp_10p00x10p00 nodes connections
+connect(pnp_10p00x10p00_e, contact)
+connect(pnp_10p00x10p00_b, contact)
+connect(pnp_10p00x10p00_c, contact)
+
+# pnp_05p00x05p00 nodes connections
+connect(pnp_05p00x05p00_e, contact)
+connect(pnp_05p00x05p00_b, contact)
+connect(pnp_05p00x05p00_c, contact)
+
+# pnp_05p00x00p42 nodes connections
+connect(pnp_05p00x00p42_e, contact)
+connect(pnp_05p00x00p42_b, contact)
+connect(pnp_05p00x00p42_c, contact)
+
+# pnp_1p2x2p5 nodes connections
+connect(pnp_1p2x2p5_e, contact)
+connect(pnp_1p2x2p5_b, contact)
+connect(pnp_1p2x2p5_c, contact)
+
+# pnp_00p46x1p2 nodes connections
+connect(pnp_00p46x1p2_e, contact)
+connect(pnp_00p46x1p2_b, contact)
+connect(pnp_00p46x1p2_c, contact)
+
+# pnp_00p46x00p46 nodes connections
+connect(pnp_00p46x00p46_e, contact)
+connect(pnp_00p46x00p46_b, contact)
+connect(pnp_00p46x00p46_c, contact)
\ No newline at end of file
diff --git a/IC/klayout/lvs/rule_decks/devices_connections.lvs b/IC/klayout/lvs/rule_decks/devices_connections.lvs
index 7848e93..dcbd9e9 100644
--- a/IC/klayout/lvs/rule_decks/devices_connections.lvs
+++ b/IC/klayout/lvs/rule_decks/devices_connections.lvs
@@ -90,131 +90,29 @@
#================================
# ------ BJT CONNECTIONS --------
#================================
-logger.info('Starting LVS BJT CONNECTIONS')
-# ==============
-# ---- vnpn ----
-# ==============
-
-# npn_02p00x02p00 nodes connections
-connect(npn_02p00x02p00_e, contact)
-connect(npn_02p00x02p00_b, contact)
-connect(npn_02p00x02p00_c, contact)
-
-# npn_05p00x05p00 nodes connections
-connect(npn_05p00x05p00_e, contact)
-connect(npn_05p00x05p00_b, contact)
-connect(npn_05p00x05p00_c, contact)
-
-# ==============
-# ---- vpnp ----
-# ==============
-
-# pnp_10p00x10p00 nodes connections
-connect(pnp_10p00x10p00_e, contact)
-connect(pnp_10p00x10p00_b, contact)
-connect(pnp_10p00x10p00_c, contact)
-
-# pnp_05p00x05p00 nodes connections
-connect(pnp_05p00x05p00_e, contact)
-connect(pnp_05p00x05p00_b, contact)
-connect(pnp_05p00x05p00_c, contact)
-
-# pnp_05p00x00p42 nodes connections
-connect(pnp_05p00x00p42_e, contact)
-connect(pnp_05p00x00p42_b, contact)
-connect(pnp_05p00x00p42_c, contact)
-
-# pnp_1p2x2p5 nodes connections
-connect(pnp_1p2x2p5_e, contact)
-connect(pnp_1p2x2p5_b, contact)
-connect(pnp_1p2x2p5_c, contact)
-
-# pnp_00p46x1p2 nodes connections
-connect(pnp_00p46x1p2_e, contact)
-connect(pnp_00p46x1p2_b, contact)
-connect(pnp_00p46x1p2_c, contact)
-
-# pnp_00p46x00p46 nodes connections
-connect(pnp_00p46x00p46_e, contact)
-connect(pnp_00p46x00p46_b, contact)
-connect(pnp_00p46x00p46_c, contact)
-
+# %include bjt_connection.lvs
#================================
# ----- DIODE CONNECTIONS -------
#================================
-logger.info('Starting LVS DIODE CONNECTIONS')
-
-# diode_np_1p8
-connect(diode_np_1p8_terminal_n, contact)
-connect(diode_np_1p8_terminal_p, contact)
-
-# diode_pn_1p8
-connect(diode_pn_1p8_terminal_n, contact)
-connect(diode_pn_1p8_terminal_p, contact)
-
-# diode_np_3p3
-connect(diode_np_3p3_terminal_n, contact)
-connect(diode_np_3p3_terminal_p, contact)
-
-# diode_pn_3p3
-connect(diode_pn_3p3_terminal_n, contact)
-connect(diode_pn_3p3_terminal_p, contact)
-
-# diode_nwp
-connect(diode_nwp_terminal_n, contact)
-connect(diode_nwp_terminal_p, contact)
-
-# diode_np_1p8_nat
-connect(diode_np_1p8_nat_terminal_n, contact)
-connect(diode_np_1p8_nat_terminal_p, contact)
-
-# diode_np_3p3_nat
-connect(diode_np_3p3_nat_terminal_n, contact)
-connect(diode_np_3p3_nat_terminal_p, contact)
-
-# diode_dnwpw
-connect(diode_dnwps_terminal_p, contact)
-
-# diode_dnwps
-connect(diode_dnwps_terminal_p, contact)
-
+# %include diode_connection.lvs
#==================================
# ------ MIMCAP CONNECTIONS -------
#==================================
-logger.info('Starting LVS MIMCAP CONNECTIONS')
-
-case MIM_OPTION
-when 'A'
- connect(metal2, mim_virtual)
- connect(fuse_cap, via2)
-
-when 'B'
- connect(topmin1_metal, mimtm_virtual)
- connect(fuse_cap, top_via)
- connect(topmin1_metal, mimtm_stack1_virtual)
- connect(topmin2_metal, mimtm_stack2_virtual)
- connect(fuse2_cap, topmin1_via)
-end
+# %include mimcap_connection.lvs
#========================================
# ------ PN Varactors CONNECTIONS -------
#========================================
-# pnvar_1p8 varactor nodes connections
-connect(pnvar_1p8_terminal_n, contact)
-connect(pnvar_1p8_terminal_p, contact)
-
+# %include pn_varactor_connection.lvs
#================================
# ---- RESISTOR DERIVATIONS -----
#================================
-logger.info('Starting LVS RESISTOR CONNECTIONS')
-
-connect(nplus_cont, contact)
-connect(pplus_cont, contact)
\ No newline at end of file
+# %include res_connection.lvs
\ No newline at end of file
diff --git a/IC/klayout/lvs/rule_decks/diode_connection.lvs b/IC/klayout/lvs/rule_decks/diode_connection.lvs
new file mode 100644
index 0000000..2bd1560
--- /dev/null
+++ b/IC/klayout/lvs/rule_decks/diode_connection.lvs
@@ -0,0 +1,55 @@
+################################################################################################
+# Copyright 2022 GlobalFoundries PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################################
+
+#================================
+# ----- DIODE CONNECTIONS -------
+#================================
+
+logger.info('Starting LVS DIODE CONNECTIONS')
+
+# diode_np_1p8
+connect(diode_np_1p8_terminal_n, contact)
+connect(diode_np_1p8_terminal_p, contact)
+
+# diode_pn_1p8
+connect(diode_pn_1p8_terminal_n, contact)
+connect(diode_pn_1p8_terminal_p, contact)
+
+# diode_np_3p3
+connect(diode_np_3p3_terminal_n, contact)
+connect(diode_np_3p3_terminal_p, contact)
+
+# diode_pn_3p3
+connect(diode_pn_3p3_terminal_n, contact)
+connect(diode_pn_3p3_terminal_p, contact)
+
+# diode_nwp
+connect(diode_nwp_terminal_n, contact)
+connect(diode_nwp_terminal_p, contact)
+
+# diode_np_1p8_nat
+connect(diode_np_1p8_nat_terminal_n, contact)
+connect(diode_np_1p8_nat_terminal_p, contact)
+
+# diode_np_3p3_nat
+connect(diode_np_3p3_nat_terminal_n, contact)
+connect(diode_np_3p3_nat_terminal_p, contact)
+
+# diode_dnwpw
+connect(diode_dnwps_terminal_p, contact)
+
+# diode_dnwps
+connect(diode_dnwps_terminal_p, contact)
\ No newline at end of file
diff --git a/IC/klayout/lvs/rule_decks/general_derivations.lvs b/IC/klayout/lvs/rule_decks/general_derivations.lvs
index 3ab99e9..aaac125 100644
--- a/IC/klayout/lvs/rule_decks/general_derivations.lvs
+++ b/IC/klayout/lvs/rule_decks/general_derivations.lvs
@@ -39,3 +39,16 @@
psd_dw = pcomp.and(dnwell).interacting(pgate).not(pgate).not(res_mk)
nwell_con = nwell.not(res_mk)
poly2_con = poly2.not(res_mk).not(plfuse)
+
+
+# derivations of metal layers
+metal2_ncap = metal2.not(lvs_cap)
+
+if METAL_LEVEL != '2LM'
+ metal3_ncap = metal3.not(lvs_cap)
+
+ if METAL_LEVEL != '3LM'
+ metal4_ncap = metal4.not(lvs_cap)
+ metal5_ncap = metal5.not(lvs_cap) if METAL_LEVEL != '4LM'
+ end
+end
\ No newline at end of file
diff --git a/IC/klayout/lvs/rule_decks/mimcap_connection.lvs b/IC/klayout/lvs/rule_decks/mimcap_connection.lvs
new file mode 100644
index 0000000..c2e6646
--- /dev/null
+++ b/IC/klayout/lvs/rule_decks/mimcap_connection.lvs
@@ -0,0 +1,34 @@
+################################################################################################
+# Copyright 2022 GlobalFoundries PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################################
+
+#==================================
+# ------ MIMCAP CONNECTIONS -------
+#==================================
+
+logger.info('Starting LVS MIMCAP CONNECTIONS')
+
+case MIM_OPTION
+when 'A'
+ connect(metal2, mim_virtual)
+ connect(fuse_cap, via2)
+
+when 'B'
+ connect(topmin1_metal, mimtm_virtual)
+ connect(fuse_cap, top_via)
+ connect(topmin1_metal, mimtm_stack1_virtual)
+ connect(topmin2_metal, mimtm_stack2_virtual)
+ connect(fuse2_cap, topmin1_via)
+end
\ No newline at end of file
diff --git a/IC/klayout/lvs/rule_decks/mimcap_derivations.lvs b/IC/klayout/lvs/rule_decks/mimcap_derivations.lvs
index 2fa2226..de22dc7 100644
--- a/IC/klayout/lvs/rule_decks/mimcap_derivations.lvs
+++ b/IC/klayout/lvs/rule_decks/mimcap_derivations.lvs
@@ -23,7 +23,6 @@
# mim option A
# stacked mim cannot exist in 2LM
mim_virtual = fusetop.sized(1.06.um).and(metal2.interacting(fusetop)).not(fusetop2)
-metal2_ncap = metal2.not(mim_virtual)
fuse_cap = fusetop.interacting(lvs_cap)
fuse2_cap = fusetop2.interacting(lvs_cap)
@@ -32,12 +31,3 @@
mimtm_stack1_virtual = fusetop.sized(1.06.um).and(topmin1_metal.interacting(fusetop))
mimtm_stack2_virtual = fusetop2.sized(1.06.um).and(topmin2_metal.interacting(fusetop2))
-if METAL_LEVEL != '2LM'
- metal3_ncap = metal3.not(mimtm_virtual).not(mimtm_stack2_virtual).not(mimtm_stack1_virtual)
-
- if METAL_LEVEL != '3LM'
- metal4_ncap = metal4.not(mimtm_virtual).not(mimtm_stack2_virtual).not(mimtm_stack1_virtual)
- metal5_ncap = metal5.not(mimtm_virtual).not(mimtm_stack2_virtual).not(mimtm_stack1_virtual) if METAL_LEVEL != '4LM'
- end
-
-end
diff --git a/IC/klayout/lvs/rule_decks/pn_varactor_connection.lvs b/IC/klayout/lvs/rule_decks/pn_varactor_connection.lvs
new file mode 100644
index 0000000..8f4c111
--- /dev/null
+++ b/IC/klayout/lvs/rule_decks/pn_varactor_connection.lvs
@@ -0,0 +1,23 @@
+################################################################################################
+# Copyright 2022 GlobalFoundries PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################################
+
+#========================================
+# ------ PN Varactors CONNECTIONS -------
+#========================================
+
+# pnvar_1p8 varactor nodes connections
+connect(pnvar_1p8_terminal_n, contact)
+connect(pnvar_1p8_terminal_p, contact)
\ No newline at end of file
diff --git a/IC/klayout/lvs/rule_decks/res_connection.lvs b/IC/klayout/lvs/rule_decks/res_connection.lvs
new file mode 100644
index 0000000..813bd1b
--- /dev/null
+++ b/IC/klayout/lvs/rule_decks/res_connection.lvs
@@ -0,0 +1,24 @@
+################################################################################################
+# Copyright 2022 GlobalFoundries PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################################
+
+#================================
+# ---- RESISTOR DERIVATIONS -----
+#================================
+
+logger.info('Starting LVS RESISTOR CONNECTIONS')
+
+connect(nplus_cont, contact)
+connect(pplus_cont, contact)
\ No newline at end of file