Coverage for klayout_pex/klayout/rex_core.py: 12%
26 statements
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-08 18:54 +0000
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-08 18:54 +0000
1#
2# --------------------------------------------------------------------------------
3# SPDX-FileCopyrightText: 2024 Martin Jan Köhler and Harald Pretl
4# Johannes Kepler University, Institute for Integrated Circuits.
5#
6# This file is part of KPEX
7# (see https://github.com/martinjankoehler/klayout-pex).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21# SPDX-License-Identifier: GPL-3.0-or-later
22# --------------------------------------------------------------------------------
23#
25import klayout.pex as klp
27from klayout_pex_protobuf.kpex.klayout.r_extractor_tech_pb2 import RExtractorTech as pb_RExtractorTech
30def klayout_r_extractor_tech(pb_tech: pb_RExtractorTech) -> klp.RExtractorTech:
31 kly_tech = klp.RExtractorTech()
32 kly_tech.skip_simplify = pb_tech.skip_simplify
34 for pb_c in pb_tech.conductors:
35 kly_c = klp.RExtractorTechConductor()
36 kly_c.layer = pb_c.layer.id
37 match pb_c.algorithm:
38 case pb_RExtractorTech.Algorithm.ALGORITHM_SQUARE_COUNTING:
39 kly_c.algorithm = klp.Algorithm.SquareCounting
40 case pb_RExtractorTech.Algorithm.ALGORITHM_TESSELATION:
41 kly_c.algorithm = klp.Algorithm.Tesselation
42 kly_c.triangulation_min_b = pb_c.triangulation_min_b
43 kly_c.triangulation_max_area = pb_c.triangulation_max_area
44 kly_c.resistance = pb_c.resistance
45 kly_tech.add_conductor(kly_c)
47 for pb_v in pb_tech.vias:
48 kly_v = klp.RExtractorTechVia()
49 kly_v.cut_layer = pb_v.layer.id
50 kly_v.bottom_conductor = pb_v.bottom_conductor.id
51 kly_v.top_conductor = pb_v.top_conductor.id
52 kly_v.resistance = pb_v.resistance
53 kly_v.merge_distance = pb_v.merge_distance
54 kly_tech.add_via(kly_v)
56 return kly_tech