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

34 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-31 20:14 +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;$0.16;$1.23;;9.3 

67R2;$0.16;BOT;;0.0 

68R3;$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;$1.16;A;;426.667 

84R2;$1.16;B;;413.867 

85R3;$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;$0.17;$1.18;;152.0 

110R2;$0.17;poly;;0.0 

111R3;$1.18;$2.18;;0.0 

112R4;$1.18;li1;;0.0 

113R5;$10.40;$11.27;;0.38 

114R6;$10.40;$9.40;;0.0 

115R7;$11.27;met5;;0.0 

116R8;$2.18;$3.25;;9.3 

117R9;$3.25;$4.25;;0.0 

118R10;$3.25;met1;;0.0 

119R11;$4.25;$5.26;;4.5 

120R12;$5.26;$6.26;;0.0 

121R13;$5.26;met2;;0.0 

122R14;$6.26;$7.43;;3.41 

123R15;$7.43;$8.43;;0.0 

124R16;$7.43;met3;;0.0 

125R17;$8.43;$9.40;;3.41 

126R18;$9.40;met4;;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;$0.13;$1.18;;419.333 

140R2;$0.13;D;;0.0 

141R3;$0.13;S;;0.0 

142R4;$0.17;$1.18;;172.267 

143R5;$1.18;D;;47.059 

144R6;$1.18;G;;2.133 

145R7;$1.18;S;;68.894""" 

146 ) 

147