Skip to content

Commit 01b4063

Browse files
authored
Merge pull request #8772 from The-OpenROAD-Project-staging/secure-fix-escape-hier-delim
dbSta: Fixed `dbNetwork::name(const Instance*)` to consider the escaped slash `a\/b`
2 parents 24e722b + e1ea409 commit 01b4063

15 files changed

+8899
-276
lines changed

src/cts/test/gated_clock4.vok

Lines changed: 270 additions & 270 deletions
Large diffs are not rendered by default.

src/dbSta/src/SpefWriter.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ std::string escapeSpecial(const std::string& name)
4646
result.replace(pos, 1, "\\$");
4747
pos += 2;
4848
}
49-
pos = 0;
50-
while ((pos = result.find('/', pos)) != std::string::npos) {
51-
result.replace(pos, 1, "\\/");
52-
pos += 2;
53-
}
5449
return result;
5550
}
5651

src/dbSta/src/dbNetwork.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,18 @@ const char* dbNetwork::name(const Instance* instance) const
824824
}
825825

826826
if (hierarchy_) {
827-
size_t last_idx = name.find_last_of('/');
827+
size_t last_idx = std::string::npos;
828+
size_t pos = name.length();
829+
while ((pos = name.rfind('/', pos)) != std::string::npos) {
830+
if (pos > 0 && name[pos - 1] == '\\') {
831+
// This is an escaped slash, so we should ignore it and continue
832+
// searching.
833+
pos--;
834+
} else {
835+
last_idx = pos;
836+
break;
837+
}
838+
}
828839
if (last_idx != std::string::npos) {
829840
name = name.substr(last_idx + 1);
830841
}

src/dbSta/test/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ COMPULSORY_TESTS = [
1212
"check_axioms",
1313
"clock_pin",
1414
"constant1",
15+
#"escape_slash", # different result compared to CMake
16+
#"escape_slash_hier", # different result compared to CMake
1517
"find_clks1",
1618
"find_clks2",
1719
"get_ports1",

src/dbSta/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ or_integration_tests(
55
check_axioms
66
clock_pin
77
constant1
8+
escape_slash
9+
escape_slash_hier
810
find_clks1
911
find_clks2
1012
get_ports1

src/dbSta/test/escape_slash.ok

Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO IFP-0001] Added 714 rows of 5263 site FreePDK45_38x28_10R_NP_162NW_34O.
3+
Found 0 macro blocks.
4+
Using 2 tracks default min distance between IO pins.
5+
[INFO PPL-0001] Number of available slots 12380
6+
[INFO PPL-0002] Number of I/O 1
7+
[INFO PPL-0003] Number of I/O w/sink 1
8+
[INFO PPL-0004] Number of I/O w/o sink 0
9+
[INFO PPL-0005] Slots per section 200
10+
[INFO PPL-0008] Successfully assigned pins to sections.
11+
[INFO PPL-0012] I/O nets HPWL: 500.17 um.
12+
[INFO GPL-0005] Execute conjugate gradient initial placement.
13+
[INFO GPL-0002] DBU: 2000
14+
[INFO GPL-0003] SiteSize: ( 0.190 1.400 ) um
15+
[INFO GPL-0004] CoreBBox: ( 0.000 0.000 ) ( 999.970 999.600 ) um
16+
[INFO GPL-0032] Initializing region: Top-level
17+
[INFO GPL-0006] Number of instances: 283
18+
[INFO GPL-0007] Movable instances: 283
19+
[INFO GPL-0008] Fixed instances: 0
20+
[INFO GPL-0009] Dummy instances: 0
21+
[INFO GPL-0010] Number of nets: 6
22+
[INFO GPL-0011] Number of pins: 289
23+
[INFO GPL-0012] Die BBox: ( 0.000 0.000 ) ( 1000.000 1000.000 ) um
24+
[INFO GPL-0013] Core BBox: ( 0.000 0.000 ) ( 999.970 999.600 ) um
25+
[INFO GPL-0016] Core area: 999570.012 um^2
26+
[INFO GPL-0014] Region name: top-level.
27+
[INFO GPL-0015] Region area: 999570.012 um^2
28+
[INFO GPL-0017] Fixed instances area: 0.000 um^2
29+
[INFO GPL-0018] Movable instances area: 1274.406 um^2
30+
[INFO GPL-0019] Utilization: 0.127 %
31+
[INFO GPL-0020] Standard cells area: 1274.406 um^2
32+
[INFO GPL-0021] Large instances area: 0.000 um^2
33+
[InitialPlace] Iter: 1 conjugate gradient residual: 0.00186203 HPWL: 3046720
34+
[InitialPlace] Iter: 2 conjugate gradient residual: 0.00000010 HPWL: 125934
35+
[InitialPlace] Iter: 3 conjugate gradient residual: 0.00000010 HPWL: 61497
36+
[InitialPlace] Iter: 4 conjugate gradient residual: 0.00000008 HPWL: 61494
37+
[InitialPlace] Iter: 5 conjugate gradient residual: 0.00000009 HPWL: 61497
38+
Placement Analysis
39+
---------------------------------
40+
total displacement 6730.7 u
41+
average displacement 23.8 u
42+
max displacement 35.5 u
43+
original HPWL 0.8 u
44+
legalized HPWL 454.9 u
45+
delta HPWL 56871 %
46+
47+
[INFO CTS-0050] Root buffer is CLKBUF_X3.
48+
[INFO CTS-0051] Sink buffer is CLKBUF_X3.
49+
[INFO CTS-0052] The following clock buffers will be used for CTS:
50+
CLKBUF_X3
51+
[INFO CTS-0049] Characterization buffer is CLKBUF_X3.
52+
[INFO CTS-0007] Net "clk" found for clock "core".
53+
[INFO CTS-0010] Clock net "clk" has 4 sinks.
54+
[INFO CTS-0010] Clock net "hi_gclk2" has 36 sinks.
55+
[INFO CTS-0010] Clock net "hi_gclk5" has 134 sinks.
56+
[INFO CTS-0011] Clock net "gclk4" for macros has 1 sinks.
57+
[INFO CTS-0011] Clock net "gclk4_regs" for registers has 36 sinks.
58+
[INFO CTS-0010] Clock net "gclk3" has 36 sinks.
59+
[INFO CTS-0010] Clock net "gclk1" has 36 sinks.
60+
[INFO CTS-0008] TritonCTS found 7 clock nets.
61+
[INFO CTS-0097] Characterization used 1 buffer(s) types.
62+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
63+
[INFO CTS-0027] Generating H-Tree topology for net clk.
64+
[INFO CTS-0028] Total number of sinks: 4.
65+
[INFO CTS-0090] Sinks will be clustered based on buffer max cap.
66+
[INFO CTS-0030] Number of static layers: 1.
67+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
68+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
69+
[INFO CTS-0023] Original sink region: [(946595, 1947820), (983835, 1983380)].
70+
[INFO CTS-0024] Normalized sink region: [(67.6139, 139.13), (70.2739, 141.67)].
71+
[INFO CTS-0025] Width: 2.6600.
72+
[INFO CTS-0026] Height: 2.5400.
73+
Level 1
74+
Direction: Horizontal
75+
Sinks per sub-region: 2
76+
Sub-region size: 1.3300 X 2.5400
77+
[INFO CTS-0034] Segment length (rounded): 1.
78+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
79+
[INFO CTS-0035] Number of sinks covered: 4.
80+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
81+
[INFO CTS-0027] Generating H-Tree topology for net hi_gclk2.
82+
[INFO CTS-0028] Total number of sinks: 36.
83+
[INFO CTS-0090] Sinks will be clustered based on buffer max cap.
84+
[INFO CTS-0030] Number of static layers: 1.
85+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
86+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
87+
[INFO CTS-0023] Original sink region: [(938410, 1933230), (1061150, 1997970)].
88+
[INFO CTS-0024] Normalized sink region: [(67.0293, 138.088), (75.7964, 142.712)].
89+
[INFO CTS-0025] Width: 8.7671.
90+
[INFO CTS-0026] Height: 4.6243.
91+
Level 1
92+
Direction: Horizontal
93+
Sinks per sub-region: 18
94+
Sub-region size: 4.3836 X 4.6243
95+
[INFO CTS-0034] Segment length (rounded): 2.
96+
Level 2
97+
Direction: Vertical
98+
Sinks per sub-region: 9
99+
Sub-region size: 4.3836 X 2.3121
100+
[INFO CTS-0034] Segment length (rounded): 1.
101+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
102+
[INFO CTS-0035] Number of sinks covered: 36.
103+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
104+
[INFO CTS-0027] Generating H-Tree topology for net hi_gclk5.
105+
[INFO CTS-0028] Total number of sinks: 134.
106+
[INFO CTS-0090] Sinks will be clustered based on buffer max cap.
107+
[INFO CTS-0030] Number of static layers: 1.
108+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
109+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
110+
[INFO CTS-0023] Original sink region: [(951330, 1947570), (1048230, 1997970)].
111+
[INFO CTS-0024] Normalized sink region: [(67.9521, 139.112), (74.8736, 142.712)].
112+
[INFO CTS-0025] Width: 6.9214.
113+
[INFO CTS-0026] Height: 3.6000.
114+
Level 1
115+
Direction: Horizontal
116+
Sinks per sub-region: 67
117+
Sub-region size: 3.4607 X 3.6000
118+
[INFO CTS-0034] Segment length (rounded): 1.
119+
Level 2
120+
Direction: Vertical
121+
Sinks per sub-region: 34
122+
Sub-region size: 3.4607 X 1.8000
123+
[INFO CTS-0034] Segment length (rounded): 1.
124+
Level 3
125+
Direction: Horizontal
126+
Sinks per sub-region: 17
127+
Sub-region size: 1.7304 X 1.8000
128+
[INFO CTS-0034] Segment length (rounded): 1.
129+
Level 4
130+
Direction: Vertical
131+
Sinks per sub-region: 9
132+
Sub-region size: 1.7304 X 0.9000
133+
[INFO CTS-0034] Segment length (rounded): 1.
134+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
135+
[INFO CTS-0035] Number of sinks covered: 134.
136+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
137+
[INFO CTS-0027] Generating H-Tree topology for net gclk4.
138+
[INFO CTS-0028] Total number of sinks: 1.
139+
[INFO CTS-0029] Macro sinks will be clustered in groups of up to 4 and with maximum cluster diameter of 50.0 um.
140+
[INFO CTS-0030] Number of static layers: 1.
141+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
142+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
143+
[INFO CTS-0023] Original sink region: [(964455, 1966580), (964455, 1966580)].
144+
[INFO CTS-0024] Normalized sink region: [(68.8896, 140.47), (68.8896, 140.47)].
145+
[INFO CTS-0025] Width: 0.0000.
146+
[INFO CTS-0026] Height: 0.0000.
147+
Level 1
148+
Direction: Vertical
149+
Sinks per sub-region: 1
150+
Sub-region size: 0.0000 X 0.0000
151+
[INFO CTS-0034] Segment length (rounded): 1.
152+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
153+
[INFO CTS-0035] Number of sinks covered: 1.
154+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
155+
[INFO CTS-0027] Generating H-Tree topology for net gclk4_regs.
156+
[INFO CTS-0028] Total number of sinks: 36.
157+
[INFO CTS-0090] Sinks will be clustered based on buffer max cap.
158+
[INFO CTS-0030] Number of static layers: 1.
159+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
160+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
161+
[INFO CTS-0023] Original sink region: [(931950, 1930770), (1067610, 1997970)].
162+
[INFO CTS-0024] Normalized sink region: [(66.5679, 137.912), (76.2579, 142.712)].
163+
[INFO CTS-0025] Width: 9.6900.
164+
[INFO CTS-0026] Height: 4.8000.
165+
Level 1
166+
Direction: Horizontal
167+
Sinks per sub-region: 18
168+
Sub-region size: 4.8450 X 4.8000
169+
[INFO CTS-0034] Segment length (rounded): 2.
170+
Level 2
171+
Direction: Vertical
172+
Sinks per sub-region: 9
173+
Sub-region size: 4.8450 X 2.4000
174+
[INFO CTS-0034] Segment length (rounded): 1.
175+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
176+
[INFO CTS-0035] Number of sinks covered: 36.
177+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
178+
[INFO CTS-0027] Generating H-Tree topology for net gclk3.
179+
[INFO CTS-0028] Total number of sinks: 36.
180+
[INFO CTS-0090] Sinks will be clustered based on buffer max cap.
181+
[INFO CTS-0030] Number of static layers: 1.
182+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
183+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
184+
[INFO CTS-0023] Original sink region: [(983630, 1975570), (1022390, 1997970)].
185+
[INFO CTS-0024] Normalized sink region: [(70.2593, 141.112), (73.0279, 142.712)].
186+
[INFO CTS-0025] Width: 2.7686.
187+
[INFO CTS-0026] Height: 1.6000.
188+
Level 1
189+
Direction: Horizontal
190+
Sinks per sub-region: 18
191+
Sub-region size: 1.3843 X 1.6000
192+
[INFO CTS-0034] Segment length (rounded): 1.
193+
Level 2
194+
Direction: Vertical
195+
Sinks per sub-region: 9
196+
Sub-region size: 1.3843 X 0.8000
197+
[INFO CTS-0034] Segment length (rounded): 1.
198+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
199+
[INFO CTS-0035] Number of sinks covered: 36.
200+
[INFO CTS-0201] 0 blockages from hard placement blockages and placed macros will be used.
201+
[INFO CTS-0027] Generating H-Tree topology for net gclk1.
202+
[INFO CTS-0028] Total number of sinks: 36.
203+
[INFO CTS-0090] Sinks will be clustered based on buffer max cap.
204+
[INFO CTS-0030] Number of static layers: 1.
205+
[INFO CTS-0020] Wire segment unit: 14000 dbu (7 um).
206+
[INFO CTS-0021] Distance between buffers: 7 units (100 um).
207+
[INFO CTS-0023] Original sink region: [(944870, 1938830), (1054690, 1997970)].
208+
[INFO CTS-0024] Normalized sink region: [(67.4907, 138.488), (75.335, 142.712)].
209+
[INFO CTS-0025] Width: 7.8443.
210+
[INFO CTS-0026] Height: 4.2243.
211+
Level 1
212+
Direction: Horizontal
213+
Sinks per sub-region: 18
214+
Sub-region size: 3.9221 X 4.2243
215+
[INFO CTS-0034] Segment length (rounded): 2.
216+
Level 2
217+
Direction: Vertical
218+
Sinks per sub-region: 9
219+
Sub-region size: 3.9221 X 2.1121
220+
[INFO CTS-0034] Segment length (rounded): 1.
221+
[INFO CTS-0032] Stop criterion found. Max number of sinks is 15.
222+
[INFO CTS-0035] Number of sinks covered: 36.
223+
[INFO CTS-0018] Created 3 clock buffers.
224+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
225+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
226+
[INFO CTS-0015] Created 3 clock nets.
227+
[INFO CTS-0016] Fanout distribution for the current clock = 2:2..
228+
[INFO CTS-0017] Max level of the clock tree: 1.
229+
[INFO CTS-0018] Created 5 clock buffers.
230+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
231+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
232+
[INFO CTS-0015] Created 5 clock nets.
233+
[INFO CTS-0016] Fanout distribution for the current clock = 7:1, 9:2, 11:1..
234+
[INFO CTS-0017] Max level of the clock tree: 2.
235+
[INFO CTS-0018] Created 17 clock buffers.
236+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
237+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
238+
[INFO CTS-0015] Created 17 clock nets.
239+
[INFO CTS-0016] Fanout distribution for the current clock = 5:1, 6:3, 7:3, 8:3, 9:1, 10:1, 11:2, 12:1, 13:1..
240+
[INFO CTS-0017] Max level of the clock tree: 4.
241+
[INFO CTS-0018] Created 2 clock buffers.
242+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
243+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
244+
[INFO CTS-0015] Created 2 clock nets.
245+
[INFO CTS-0016] Fanout distribution for the current clock = 1:1..
246+
[INFO CTS-0017] Max level of the clock tree: 1.
247+
[INFO CTS-0018] Created 5 clock buffers.
248+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
249+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
250+
[INFO CTS-0015] Created 5 clock nets.
251+
[INFO CTS-0016] Fanout distribution for the current clock = 8:2, 9:1, 11:1..
252+
[INFO CTS-0017] Max level of the clock tree: 2.
253+
[INFO CTS-0018] Created 5 clock buffers.
254+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
255+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
256+
[INFO CTS-0015] Created 5 clock nets.
257+
[INFO CTS-0016] Fanout distribution for the current clock = 6:1, 9:2, 12:1..
258+
[INFO CTS-0017] Max level of the clock tree: 2.
259+
[INFO CTS-0018] Created 5 clock buffers.
260+
[INFO CTS-0012] Minimum number of buffers in the clock path: 2.
261+
[INFO CTS-0013] Maximum number of buffers in the clock path: 2.
262+
[INFO CTS-0015] Created 5 clock nets.
263+
[INFO CTS-0016] Fanout distribution for the current clock = 8:2, 10:2..
264+
[INFO CTS-0017] Max level of the clock tree: 2.
265+
[INFO CTS-0098] Clock net "clk"
266+
[INFO CTS-0099] Sinks 4
267+
[INFO CTS-0100] Leaf buffers 0
268+
[INFO CTS-0101] Average sink wire length 51.45 um
269+
[INFO CTS-0102] Path depth 2 - 2
270+
[INFO CTS-0207] Leaf load cells 26
271+
[INFO CTS-0098] Clock net "hi_gclk2"
272+
[INFO CTS-0099] Sinks 39
273+
[INFO CTS-0100] Leaf buffers 0
274+
[INFO CTS-0101] Average sink wire length 50.99 um
275+
[INFO CTS-0102] Path depth 2 - 2
276+
[INFO CTS-0207] Leaf load cells 26
277+
[INFO CTS-0098] Clock net "hi_gclk5"
278+
[INFO CTS-0099] Sinks 149
279+
[INFO CTS-0100] Leaf buffers 0
280+
[INFO CTS-0101] Average sink wire length 45.09 um
281+
[INFO CTS-0102] Path depth 2 - 2
282+
[INFO CTS-0207] Leaf load cells 26
283+
[INFO CTS-0124] Clock net "gclk4"
284+
[INFO CTS-0125] Sinks 1
285+
[INFO CTS-0098] Clock net "gclk4_regs"
286+
[INFO CTS-0099] Sinks 39
287+
[INFO CTS-0100] Leaf buffers 0
288+
[INFO CTS-0101] Average sink wire length 30.63 um
289+
[INFO CTS-0102] Path depth 2 - 2
290+
[INFO CTS-0207] Leaf load cells 26
291+
[INFO CTS-0098] Clock net "gclk3"
292+
[INFO CTS-0099] Sinks 39
293+
[INFO CTS-0100] Leaf buffers 0
294+
[INFO CTS-0101] Average sink wire length 40.27 um
295+
[INFO CTS-0102] Path depth 2 - 2
296+
[INFO CTS-0207] Leaf load cells 26
297+
[INFO CTS-0098] Clock net "gclk1"
298+
[INFO CTS-0099] Sinks 38
299+
[INFO CTS-0100] Leaf buffers 0
300+
[INFO CTS-0101] Average sink wire length 44.58 um
301+
[INFO CTS-0102] Path depth 2 - 2
302+
[INFO CTS-0207] Leaf load cells 26
303+
[INFO CTS-0033] Balancing latency for clock core
304+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_0_core is inserted at (964406 1977451)
305+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_1_core is inserted at (982218 1971523)
306+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_2_core is inserted at (951995 1970476)
307+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_3_core is inserted at (952524 1974128)
308+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_4_core is inserted at (968965 1966825)
309+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_5_core is inserted at (972465 1966825)
310+
[DEBUG CTS-insertion delay] new delay buffer delaybuf_6_core is inserted at (975965 1966825)
311+
[INFO CTS-0036] inserted 7 delay buffers
312+
[INFO CTS-0037] Total number of delay buffers: 7
313+
No differences found.
314+
No differences found.

0 commit comments

Comments
 (0)