Coverage for tests/rcx25/rcx25_R_sky130A_test.py: 100%

34 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-09-17 19:08 +0000

1# 

2# -------------------------------------------------------------------------------- 

3# SPDX-FileCopyrightText: 2024-2025 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# 

24 

25import allure 

26import pytest 

27 

28from rcx25_test_helpers import * 

29 

30CSVPath = str 

31PNGPath = str 

32parent_suite = "kpex/2.5D Extraction Tests [PDK sky130A | mode R]" 

33tags = ("PEX", "2.5D", "MAGIC") 

34 

35 

36pex_whiteboxed = RCX25Extraction(pdk=PDKTestConfig(PDKName.SKY130A), pex_mode=PEXMode.R, blackbox=False) 

37pex_blackboxed = RCX25Extraction(pdk=PDKTestConfig(PDKName.SKY130A), pex_mode=PEXMode.R, blackbox=True) 

38 

39 

40@allure.parent_suite(parent_suite) 

41@allure.tag(*tags) 

42@pytest.mark.slow 

43def test_single_wire_li1(): 

44 # MAGIC GIVES (8.3 revision 540): 

45 #_______________________________ NOTE: with halo=8µm __________________________________ 

46 # R0 A B 840.534 

47 # R1 B A 840.534 # reported twice! 

48 pex_whiteboxed.assert_expected_matches_obtained( 

49 'test_patterns', 'r_single_wire_li1.gds.gz', 

50 expected_csv_content="""Device;Net1;Net2;Capacitance [fF];Resistance [Ω] 

51R1;A;B;;840.533""" 

52 ) 

53 

54 

55@allure.parent_suite(parent_suite) 

56@allure.tag(*tags) 

57@pytest.mark.slow 

58def test_contact_1x1_minsize_mcon(): 

59 # MAGIC GIVES (8.3 revision 540): 

60 #_______________________________ NOTE: with halo=8µm __________________________________ 

61 # R0 TOP BOT 15.763 (why not 9? Magic takes the bottom-left of each port) 

62 # but in the debug version we see 9.3 is calculated for the via 

63 pex_whiteboxed.assert_expected_matches_obtained( 

64 'test_patterns', 'r_contact_1x1_minsize_mcon.gds.gz', 

65 expected_csv_content="""Device;Net1;Net2;Capacitance [fF];Resistance [Ω] 

66R1;BOT;BOT,TOP.$0.16;;0.0 

67R2;BOT,TOP.$0.16;BOT,TOP.$1.23;;9.3 

68R3;BOT,TOP.$1.23;TOP;;0.0""" 

69 ) 

70 

71 

72@allure.parent_suite(parent_suite) 

73@allure.tag(*tags) 

74@pytest.mark.slow 

75def test_wire_voltage_divider_li1(): 

76 # MAGIC GIVES (8.3 revision 540): 

77 #_______________________________ NOTE: with halo=8µm __________________________________ 

78 # R0 A B 840.534 

79 # R1 B A 840.534 # reported twice! 

80 pex_whiteboxed.assert_expected_matches_obtained( 

81 'test_patterns', 'r_wire_voltage_divider_li1.gds.gz', 

82 expected_csv_content="""Device;Net1;Net2;Capacitance [fF];Resistance [Ω] 

83R1;A;A,B,C.$1.16;;426.667 

84R2;A,B,C.$1.16;B;;413.867 

85R3;A,B,C.$1.16;C;;72.533""" 

86 ) 

87 

88@allure.parent_suite(parent_suite) 

89@allure.tag(*tags) 

90@pytest.mark.slow 

91def test_via_stack_1x1_minsize_poly_to_met5(): 

92 # MAGIC GIVES (8.3 revision 540): 

93 #_______________________________ NOTE: with halo=8µm __________________________________ 

94 # R0 li1.n3 poly 175.37 # poly contact, should be 152Ω 

95 # R1 li1.n4 li1.n3 9.3005 # mcon via, should be 9.3Ω 

96 # R2 li1.n3 li1 6.4005 

97 # R3 li1.n4 li1.n2 4.5005 # via, should be 4.5Ω 

98 # R7 met1 li1.n4 0.063 

99 # R4 li1.n1 li1.n0 3.4105 # via2, should be 3.41Ω 

100 # R8 li1.n2 met2 0.0545541 

101 # R6 li1.n0 met5 0.3834 # via4, should be 0.38Ω 

102 # R9 li1.n1 met3 0.0232879 

103 # R10 li1.n0 met4 0.00687288 

104 # R5 li1.n2 li1.n1 3.4105 # via3, should be 3.41Ω 

105 # (and some redundant listings of the same) 

106 pex_whiteboxed.assert_expected_matches_obtained( 

107 'test_patterns', 'r_via_stack_1x1_minsize_poly_to_met5.gds.gz', 

108 expected_csv_content="""Device;Net1;Net2;Capacitance [fF];Resistance [Ω] 

109R1;li1;li1,met1,met2,met3,met4,met5,poly.$1.18;;0.0 

110R2;li1,met1,met2,met3,met4,met5,poly.$0.17;li1,met1,met2,met3,met4,met5,poly.$1.18;;152.0 

111R3;li1,met1,met2,met3,met4,met5,poly.$0.17;poly;;0.0 

112R4;li1,met1,met2,met3,met4,met5,poly.$1.18;li1,met1,met2,met3,met4,met5,poly.$2.18;;0.0 

113R5;li1,met1,met2,met3,met4,met5,poly.$10.41;li1,met1,met2,met3,met4,met5,poly.$11.35;;3.41 

114R6;li1,met1,met2,met3,met4,met5,poly.$10.41;li1,met1,met2,met3,met4,met5,poly.$7.41;;0.0 

115R7;li1,met1,met2,met3,met4,met5,poly.$11.35;li1,met1,met2,met3,met4,met5,poly.$8.35;;0.0 

116R8;li1,met1,met2,met3,met4,met5,poly.$2.18;li1,met1,met2,met3,met4,met5,poly.$3.25;;9.3 

117R9;li1,met1,met2,met3,met4,met5,poly.$3.25;li1,met1,met2,met3,met4,met5,poly.$4.25;;0.0 

118R10;li1,met1,met2,met3,met4,met5,poly.$3.25;met1;;0.0 

119R11;li1,met1,met2,met3,met4,met5,poly.$4.25;li1,met1,met2,met3,met4,met5,poly.$5.26;;4.5 

120R12;li1,met1,met2,met3,met4,met5,poly.$5.26;li1,met1,met2,met3,met4,met5,poly.$6.26;;0.0 

121R13;li1,met1,met2,met3,met4,met5,poly.$5.26;met2;;0.0 

122R14;li1,met1,met2,met3,met4,met5,poly.$6.26;li1,met1,met2,met3,met4,met5,poly.$7.41;;3.41 

123R15;li1,met1,met2,met3,met4,met5,poly.$7.41;met3;;0.0 

124R16;li1,met1,met2,met3,met4,met5,poly.$8.35;li1,met1,met2,met3,met4,met5,poly.$9.27;;0.38 

125R17;li1,met1,met2,met3,met4,met5,poly.$8.35;met4;;0.0 

126R18;li1,met1,met2,met3,met4,met5,poly.$9.27;met5;;0.0""" 

127 ) 

128 

129 

130@allure.parent_suite(parent_suite) 

131@allure.tag(*tags) 

132@pytest.mark.slow 

133def test_nfet_li1_redux(): 

134 # MAGIC GIVES (8.3 revision 540): 

135 #_______________________________ NOTE: with halo=8µm __________________________________ 

136 pex_whiteboxed.assert_expected_matches_obtained( 

137 'test_patterns', 'nfet_li1_redux.gds.gz', 

138 expected_csv_content="""Device;Net1;Net2;Capacitance [fF];Resistance [Ω] 

139R1;$2.$0.12;$2.$1.17;;209.667 

140R2;$2.$0.12;$2.P0.12;;0.0 

141R3;$3.$0.12;$3.$1.17;;209.667 

142R4;$3.$0.12;$3.P0.12;;0.0 

143R5;G;G.$1.17;;2.418 

144R6;G.$0.16;G.$1.17;;152.0 

145R7;G.$0.16;G.P0.16;;316.321""" 

146 ) 

147