Skip to content

Commit d205112

Browse files
committed
rsz: Use effective slack in setup repair paths
Initialize the repair target collector before standalone repair_setup_pin uses endpoint effective slack. Keep TNS phase endpoint filtering and progress checks on effective slack so latch time-borrow endpoints collected with hidden setup debt are not skipped by raw STA slack rechecks. Add Tcl coverage for borrowed latch endpoints in repair_setup_pin and TNS repair flows. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
1 parent 2862baa commit d205112

8 files changed

Lines changed: 140 additions & 2 deletions

src/rsz/src/policy/SetupLegacyBase.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ bool SetupLegacyBase::repairSetupPin(const sta::Pin* end_pin)
8888
}
8989

9090
initializeSetupServices();
91+
target_collector_->init(config_.setup_slack_margin);
9192
setup_context_.max_repairs_per_pass = 1;
9293

9394
sta::Vertex* end_vertex = graph_->pinLoadVertex(end_pin);

src/rsz/src/policy/SetupTnsPolicy.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ void SetupTnsPolicy::repairSetupTns(const float setup_slack_margin,
129129
}
130130

131131
const sta::Pin* endpoint_pin = endpoint->pin();
132-
sta::Slack endpoint_slack = sta_->slack(endpoint, max_);
132+
sta::Slack endpoint_slack
133+
= target_collector_->getCurrentEndpointOriginalSlack();
133134
if (sta::fuzzyGreaterEqual(endpoint_slack, setup_slack_margin)) {
134135
continue;
135136
}
@@ -189,7 +190,7 @@ void SetupTnsPolicy::repairSetupTns(const float setup_slack_margin,
189190
estimate_parasitics_->updateParasitics();
190191
sta_->findRequireds();
191192

192-
endpoint_slack = sta_->slack(endpoint, max_);
193+
endpoint_slack = target_collector_->getEndpointEffectiveSlack(endpoint);
193194
sta::Slack global_wns = 0.0;
194195
sta::Vertex* global_wns_vertex = nullptr;
195196
sta_->worstSlack(max_, global_wns, global_wns_vertex);

src/rsz/test/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ TESTS = [
252252
"global_sizing_presize",
253253
"inferred_clock_gator_time_borrow",
254254
"inferred_clock_gator_time_borrow_covered",
255+
"inferred_clock_gator_time_borrow_repair_pin",
256+
"inferred_clock_gator_time_borrow_tns",
255257
]
256258

257259
# From CMakeLists.txt or_integration_tests(PASSFAIL_TESTS

src/rsz/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ or_integration_tests(
240240
global_sizing_presize
241241
inferred_clock_gator_time_borrow
242242
inferred_clock_gator_time_borrow_covered
243+
inferred_clock_gator_time_borrow_repair_pin
244+
inferred_clock_gator_time_borrow_tns
243245
PASSFAIL_TESTS
244246
repair_setup_legacy_mt
245247
repair_setup_mt1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: inferred_clock_gator_time_borrow
3+
[INFO ODB-0130] Created 2 pins.
4+
[INFO ODB-0131] Created 10 components and 52 component-terminals.
5+
[INFO ODB-0133] Created 7 nets and 22 connections.
6+
[WARNING STA-0450] virtual clock vclk can not be propagated.
7+
BEFORE_BORROW 0.4545
8+
[INFO RSZ-0100] Repair move sequence: UnbufferMove SizeDownFanoutMove SizeUpMove SwapPinsMove BufferMove CloneMove SplitLoadMove
9+
AFTER_BORROW 0.4540
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
source "helpers.tcl"
2+
3+
set test_name inferred_clock_gator_time_borrow_repair_pin
4+
5+
source Nangate45/Nangate45.vars
6+
read_liberty Nangate45/Nangate45_typ.lib
7+
read_lef Nangate45/Nangate45.lef
8+
read_def inferred_clock_gator_time_borrow.def
9+
10+
create_clock -name clk -period 1.0 clk
11+
create_clock -name vclk -period 1.0
12+
set_input_delay -clock vclk 0.98 [get_ports en_in]
13+
14+
source Nangate45/Nangate45.rc
15+
source $layer_rc_file
16+
set_wire_rc -signal -layer $wire_rc_layer
17+
set_wire_rc -clock -layer $wire_rc_layer_clk
18+
19+
set_propagated_clock [all_clocks]
20+
estimate_parasitics -placement
21+
22+
proc extract_borrow { report_text } {
23+
if { ![regexp {actual time borrow[ ]+([0-9.]+)} $report_text -> borrow] } {
24+
puts "Missing actual time borrow in report_checks output."
25+
}
26+
return $borrow
27+
}
28+
29+
proc borrow_report { test_name label } {
30+
set report_file [make_result_file "${test_name}_${label}.rpt"]
31+
report_checks -path_delay max -to enable_latch/D \
32+
-group_path_count 1 -format full_clock_expanded -digits 4 > $report_file
33+
set stream [open $report_file r]
34+
set report_text [read $stream]
35+
close $stream
36+
return $report_text
37+
}
38+
39+
set before_report [borrow_report $test_name "before"]
40+
set before_borrow [extract_borrow $before_report]
41+
puts [format "BEFORE_BORROW %.4f" $before_borrow]
42+
43+
rsz::repair_setup_pin [get_pin enable_latch/D]
44+
45+
set after_report [borrow_report $test_name "after"]
46+
set after_borrow [extract_borrow $after_report]
47+
puts [format "AFTER_BORROW %.4f" $after_borrow]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: inferred_clock_gator_time_borrow
3+
[INFO ODB-0130] Created 2 pins.
4+
[INFO ODB-0131] Created 10 components and 52 component-terminals.
5+
[INFO ODB-0133] Created 7 nets and 22 connections.
6+
[WARNING STA-0450] virtual clock vclk can not be propagated.
7+
BEFORE_BORROW 0.4545
8+
[INFO RSZ-0100] Repair move sequence: UnbufferMove SizeUpMove BufferMove SplitLoadMove
9+
[INFO RSZ-0094] Found 7 endpoints with setup violations.
10+
[INFO RSZ-0099] Repairing 7 out of 7 (100.00%) violating endpoints...
11+
[INFO RSZ-0221] Using custom phase sequence: TNS
12+
Iter | Removed | Resized | Inserted | Cloned | Pin | Area | WNS | StTNS | EnTNS | Viol | Worst
13+
| Buffers | Gates | Buffers | Gates | Swaps | | | | | Endpts | St/EnPt
14+
------------------------------------------------------------------------------------------------------------------------------
15+
0* | 0 | 0 | 0 | 0 | 0 | +0.0% | -0.076 | -0.1 | -0.3 | 7 | enable_latch/D
16+
6* | 0 | 2 | 1 | 0 | 0 | +7.3% | -0.082 | -0.1 | -0.3 | 7 | enable_latch/D
17+
final | 0 | 2 | 1 | 0 | 0 | +7.3% | -0.082 | -0.1 | -0.3 | 7 | enable_latch/D
18+
------------------------------------------------------------------------------------------------------------------------------
19+
[INFO RSZ-0040] Inserted 1 buffers.
20+
[INFO RSZ-0051] Resized 2 instances: 2 up, 0 up match, 0 down, 0 VT
21+
[WARNING RSZ-0062] Unable to repair all setup violations.
22+
AFTER_BORROW 0.4492
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
source "helpers.tcl"
2+
3+
set test_name inferred_clock_gator_time_borrow_tns
4+
5+
source Nangate45/Nangate45.vars
6+
read_liberty Nangate45/Nangate45_typ.lib
7+
read_lef Nangate45/Nangate45.lef
8+
read_def inferred_clock_gator_time_borrow.def
9+
10+
create_clock -name clk -period 1.0 clk
11+
create_clock -name vclk -period 1.0
12+
set_input_delay -clock vclk 0.98 [get_ports en_in]
13+
14+
source Nangate45/Nangate45.rc
15+
source $layer_rc_file
16+
set_wire_rc -signal -layer $wire_rc_layer
17+
set_wire_rc -clock -layer $wire_rc_layer_clk
18+
19+
set_propagated_clock [all_clocks]
20+
estimate_parasitics -placement
21+
22+
proc extract_borrow { report_text } {
23+
if { ![regexp {actual time borrow[ ]+([0-9.]+)} $report_text -> borrow] } {
24+
puts "Missing actual time borrow in report_checks output."
25+
}
26+
return $borrow
27+
}
28+
29+
proc borrow_report { test_name label } {
30+
set report_file [make_result_file "${test_name}_${label}.rpt"]
31+
report_checks -path_delay max -to enable_latch/D \
32+
-group_path_count 1 -format full_clock_expanded -digits 4 > $report_file
33+
set stream [open $report_file r]
34+
set report_text [read $stream]
35+
close $stream
36+
return $report_text
37+
}
38+
39+
set before_report [borrow_report $test_name "before"]
40+
set before_borrow [extract_borrow $before_report]
41+
puts [format "BEFORE_BORROW %.4f" $before_borrow]
42+
43+
repair_timing -setup -phases "TNS" -skip_last_gasp -skip_pin_swap \
44+
-skip_gate_cloning -max_passes 20
45+
46+
set after_report [borrow_report $test_name "after"]
47+
set after_borrow [extract_borrow $after_report]
48+
puts [format "AFTER_BORROW %.4f" $after_borrow]
49+
50+
if { !($after_borrow < $before_borrow - 0.001) } {
51+
puts [format \
52+
"repair_timing did not reduce latch borrow: before %.4f after %.4f" \
53+
$before_borrow $after_borrow]
54+
}

0 commit comments

Comments
 (0)