Skip to content

Commit b8b93f4

Browse files
authored
Merge pull request #2692 from The-OpenROAD-Project-staging/rsz-hold-area
rsz: select hold buffer by delay/area rather than just max delay
2 parents f8ec7c5 + a48c652 commit b8b93f4

File tree

8 files changed

+61
-29
lines changed

8 files changed

+61
-29
lines changed

src/rsz/src/RepairHold.cc

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,53 @@ RepairHold::repairHold(Pin *end_pin,
169169
resizer_->incrementalParasiticsEnd();
170170
}
171171

172-
// Find the buffer with the most delay in the fastest corner.
172+
// Find a good hold buffer using delay/area as the metric.
173173
LibertyCell *
174174
RepairHold::findHoldBuffer()
175175
{
176-
LibertyCell *max_buffer = nullptr;
177-
float max_delay = 0.0;
176+
// Build a vector of buffers sorted by the metric
177+
struct MetricBuffer {
178+
float metric;
179+
LibertyCell* cell;
180+
};
181+
std::vector<MetricBuffer> buffers;
178182
for (LibertyCell *buffer : resizer_->buffer_cells_) {
179-
float buffer_min_delay = bufferHoldDelay(buffer);
180-
if (max_buffer == nullptr
181-
|| buffer_min_delay > max_delay) {
182-
max_buffer = buffer;
183-
max_delay = buffer_min_delay;
183+
const float buffer_area = buffer->area();
184+
if (buffer_area != 0.0) {
185+
float buffer_cost = bufferHoldDelay(buffer) / buffer_area;
186+
buffers.push_back({buffer_cost, buffer});
184187
}
185188
}
186-
return max_buffer;
189+
190+
std::sort(buffers.begin(),
191+
buffers.end(),
192+
[this](const MetricBuffer& lhs, const MetricBuffer& rhs) {
193+
return lhs.metric < rhs.metric;
194+
});
195+
196+
if (buffers.empty()) {
197+
return nullptr;
198+
}
199+
200+
// Select the highest metric
201+
MetricBuffer& best_buffer = *buffers.rbegin();
202+
const MetricBuffer& highest_metric = best_buffer;
203+
204+
// See if there is a smaller choice with nearly as good a metric.
205+
const float margin = 0.95;
206+
for (auto itr = buffers.rbegin() + 1; itr != buffers.rend(); itr++) {
207+
if (itr->metric >= margin * highest_metric.metric) {
208+
// buffer within margin, so check if area is smaller
209+
const float best_buffer_area = best_buffer.cell->area();
210+
const float buffer_area = itr->cell->area();
211+
212+
if (buffer_area < best_buffer_area) {
213+
best_buffer = *itr;
214+
}
215+
}
216+
}
217+
218+
return best_buffer.cell;
187219
}
188220

189221
float

src/rsz/test/gcd_resize.ok

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ worst slack 1.34
1414
[INFO RSZ-0058] Using max wire length 720um.
1515
[INFO RSZ-0039] Resized 50 instances.
1616
[INFO RSZ-0046] Found 35 endpoints with hold violations.
17-
[INFO RSZ-0032] Inserted 98 hold buffers.
17+
[INFO RSZ-0032] Inserted 99 hold buffers.
1818
worst slack 0.20
19-
worst slack 1.23
19+
worst slack 1.24
2020
max slew
2121

2222
Pin Limit Slew Slack
@@ -47,4 +47,4 @@ _847_/Z manhtn 60.3 steiner 60.3 0.00
4747
_851_/Z manhtn 58.3 steiner 58.3 0.00
4848
_771_/Z manhtn 58.1 steiner 58.1 0.00
4949
_725_/Z manhtn 56.1 steiner 56.1 0.00
50-
Design area 836 u^2 13% utilization.
50+
Design area 784 u^2 12% utilization.

src/rsz/test/repair_hold12.ok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
(clk ^) r -0.04:INF f -0.04:INF
1111
[INFO RSZ-0046] Found 2 endpoints with hold violations.
1212
[INFO RSZ-0032] Inserted 4 hold buffers.
13-
(clk ^) r 0.01:INF f 0.00:INF
13+
(clk ^) r 0.02:INF f 0.01:INF

src/rsz/test/repair_hold2.ok

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ Path Type: min
9090

9191
[INFO RSZ-0046] Found 4 endpoints with hold violations.
9292
[INFO RSZ-0032] Inserted 10 hold buffers.
93-
worst slack 0.00
93+
worst slack 0.01
9494
worst slack 1.88
9595
Net in2
96-
Pin capacitance: 1.25-1.42
96+
Pin capacitance: 0.70-0.78
9797
Wire capacitance: 5.22
98-
Total capacitance: 6.47-6.64
98+
Total capacitance: 5.92-6.00
9999
Number of drivers: 1
100100
Number of loads: 1
101101
Number of pins: 2
@@ -104,18 +104,18 @@ Driver pins
104104
in2 input port (20, 0)
105105

106106
Load pins
107-
hold10/A input (CLKBUF_X3) 1.25-1.42 (40, 41)
107+
hold10/A input (CLKBUF_X1) 0.70-0.78 (40, 41)
108108

109109
Net out
110110
Pin capacitance: 0.00
111-
Wire capacitance: 6.96
112-
Total capacitance: 6.96
111+
Wire capacitance: 6.95
112+
Total capacitance: 6.95
113113
Number of drivers: 1
114114
Number of loads: 1
115115
Number of pins: 2
116116

117117
Driver pins
118-
hold2/Z output (CLKBUF_X3) (41, 41)
118+
hold2/Z output (CLKBUF_X1) (41, 41)
119119

120120
Load pins
121121
out output port (0, 0)

src/rsz/test/repair_hold3.ok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ worst slack 1.95
1212
[INFO RSZ-0046] Found 2 endpoints with hold violations.
1313
[INFO RSZ-0032] Inserted 2 hold buffers.
1414
worst slack 0.01
15-
worst slack 1.92
15+
worst slack 1.93

src/rsz/test/repair_hold7.ok

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ worst slack 0.15
1313
worst slack 1.34
1414
[INFO RSZ-0046] Found 35 endpoints with hold violations.
1515
[WARNING RSZ-0064] Unable to repair all hold checks within margin.
16-
[INFO RSZ-0032] Inserted 163 hold buffers.
16+
[INFO RSZ-0032] Inserted 411 hold buffers.
1717
[ERROR RSZ-0050] Max utilization reached.
1818
RSZ-0050
19-
Design area 887 u^2 14% utilization.
20-
worst slack 0.22
21-
worst slack 1.22
19+
Design area 998 u^2 16% utilization.
20+
worst slack 0.37
21+
worst slack 1.03

src/rsz/test/repair_hold8.ok

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
worst slack -0.09
1111
worst slack 1.84
1212
[INFO RSZ-0046] Found 4 endpoints with hold violations.
13-
[INFO RSZ-0032] Inserted 37 hold buffers.
14-
worst slack 0.20
15-
worst slack 1.66
13+
[INFO RSZ-0032] Inserted 38 hold buffers.
14+
worst slack 0.21
15+
worst slack 1.64

src/rsz/test/repair_hold9.ok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Design area 670 u^2 10% utilization.
1414
[INFO RSZ-0032] Inserted 163 hold buffers.
1515
[ERROR RSZ-0060] Max buffer count reached.
1616
RSZ-0060
17-
Design area 887 u^2 14% utilization.
17+
Design area 800 u^2 13% utilization.

0 commit comments

Comments
 (0)