Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsz: use adequate buffers for each operation #5752

Merged
merged 13 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rsz/include/rsz/Resizer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ class Resizer : public dbStaState
int inserted_buffer_count_ = 0;
int cloned_gate_count_ = 0;
int removed_buffer_count_ = 0;
bool exclude_clock_buffers_ = true;
bool buffer_moved_into_core_ = false;
// Slack map variables.
// This is the minimum length of wire that is worth while to split and
Expand Down
43 changes: 43 additions & 0 deletions src/rsz/src/Resizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "sta/Liberty.hh"
#include "sta/Network.hh"
#include "sta/Parasitics.hh"
#include "sta/PatternMatch.hh"
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved
#include "sta/PortDirection.hh"
#include "sta/Sdc.hh"
#include "sta/Search.hh"
Expand Down Expand Up @@ -501,14 +502,34 @@ void Resizer::findBuffers()
{
if (buffer_cells_.empty()) {
LibertyLibraryIterator* lib_iter = network_->libertyLibraryIterator();
std::unique_ptr<sta::PatternMatch> clkbuf_pattern;

if (exclude_clock_buffers_) {
clkbuf_pattern
= std::make_unique<sta::PatternMatch>(".*CLKBUF.*",
/* is_regexp */ true,
/* nocase */ true,
/* Tcl_interp* */ nullptr);
}
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved

while (lib_iter->hasNext()) {
LibertyLibrary* lib = lib_iter->next();

for (LibertyCell* buffer : *lib->buffers()) {
if (exclude_clock_buffers_) {
// is_clock_cell is a custom lib attribute that may not exist,
// so we also use the name pattern to help
if (buffer->isClockCell() || clkbuf_pattern->match(buffer->name())) {
continue;
}
}

if (!dontUse(buffer) && isLinkCell(buffer)) {
buffer_cells_.emplace_back(buffer);
}
}
}

delete lib_iter;

if (buffer_cells_.empty()) {
Expand All @@ -519,6 +540,7 @@ void Resizer::findBuffers()
return bufferDriveResistance(buffer1)
> bufferDriveResistance(buffer2);
});

buffer_lowest_drive_ = buffer_cells_[0];
}
}
Expand Down Expand Up @@ -2811,6 +2833,14 @@ void Resizer::repairHold(
int max_passes,
bool verbose)
{
buffer_cells_.clear();

// Some technologies such as nangate45 don't have delay cells. Hence,
// until we have a better approach, it's better to consider clock buffers
// for hold violation repairing as these buffers' delay may be slighty
// higher and we'll need fewer insertions.
exclude_clock_buffers_ = false;

resizePreamble();
if (parasitics_src_ == ParasiticsSrc::global_routing) {
opendp_->initMacrosAndGrid();
Expand All @@ -2821,6 +2851,10 @@ void Resizer::repairHold(
max_buffer_percent,
max_passes,
verbose);

// Reset buffer selection strategy for the subsequent RSZ operation.
exclude_clock_buffers_ = true;
buffer_cells_.clear();
}

void Resizer::repairHold(const Pin* end_pin,
Expand All @@ -2830,13 +2864,22 @@ void Resizer::repairHold(const Pin* end_pin,
float max_buffer_percent,
int max_passes)
{
buffer_cells_.clear();

// See comments on previous method.
exclude_clock_buffers_ = false;

resizePreamble();
repair_hold_->repairHold(end_pin,
setup_margin,
hold_margin,
allow_setup_violations,
max_buffer_percent,
max_passes);

// Ditto.
exclude_clock_buffers_ = true;
buffer_cells_.clear();
}

int Resizer::holdBufferCount() const
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/buffer_ports4.ok
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pin Limit Slew Slack
------------------------------------------------------------
input1/Z 0.20 1.15 -0.95 (VIOLATED)

[INFO RSZ-0058] Using max wire length 828um.
[INFO RSZ-0058] Using max wire length 833um.
[INFO RSZ-0039] Resized 1 instances.
max slew

Expand Down
546 changes: 272 additions & 274 deletions src/rsz/test/buffer_varying_lengths.defok

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/rsz/test/buffer_varying_lengths.ok
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
[INFO RSZ-0058] Using max wire length 822um.
[INFO RSZ-0058] Using max wire length 827um.
[INFO RSZ-0037] Found 118 long wires.
[INFO RSZ-0038] Inserted 162 buffers in 118 nets.
[INFO RSZ-0039] Resized 183 instances.
[INFO RSZ-0038] Inserted 161 buffers in 118 nets.
[INFO RSZ-0039] Resized 184 instances.
worst slack -0.266
tns -28.587
tns -28.551
[INFO RSZ-0094] Found 200 endpoints with setup violations.
[INFO RSZ-0099] Repairing 200 out of 200 (100.00%) violating endpoints...
[INFO RSZ-0041] Resized 895 instances.
[INFO RSZ-0041] Resized 844 instances.
[WARNING RSZ-0062] Unable to repair all setup violations.
[INFO RSZ-0033] No hold violations found.
worst slack -0.266
tns -27.381
tns -27.434
No differences found.
12 changes: 6 additions & 6 deletions src/rsz/test/gcd_resize.ok
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
worst slack 1.34
[INFO RSZ-0028] Inserted 18 output buffers.
[INFO RSZ-0058] Using max wire length 693um.
[INFO RSZ-0039] Resized 50 instances.
[INFO RSZ-0039] Resized 58 instances.
[INFO RSZ-0098] No setup violations found
[INFO RSZ-0046] Found 35 endpoints with hold violations.
[INFO RSZ-0032] Inserted 99 hold buffers.
[INFO RSZ-0032] Inserted 105 hold buffers.
worst slack 0.20
worst slack 1.24
worst slack 1.25
max slew

Pin Limit Slew Slack
------------------------------------------------------------
_443_/ZN 0.20 0.06 0.14 (MET)
_443_/ZN 0.20 0.04 0.15 (MET)

max fanout

Expand All @@ -29,7 +29,7 @@ max capacitance

Pin Limit Cap Slack
------------------------------------------------------------
_443_/ZN 10.47 3.86 6.62 (MET)
_448_/ZN 10.47 1.92 8.55 (MET)

Driver length delay
_759_/Z manhtn 83.9 steiner 83.9 0.00
Expand All @@ -43,4 +43,4 @@ _461_/Z manhtn 63.8 steiner 84.8 0.00
req_msg[18] manhtn 61.4 steiner 61.4 0.00
_847_/Z manhtn 60.3 steiner 60.3 0.00
_851_/Z manhtn 58.3 steiner 58.3 0.00
Design area 756 u^2 12% utilization.
Design area 772 u^2 12% utilization.
2 changes: 1 addition & 1 deletion src/rsz/test/repair_cap3.ok
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[INFO ODB-0133] Created 2 nets and 105 connections.
Found 105 slew violations
Found 1 cap violations
[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
[INFO RSZ-0034] Found 1 slew violations.
[INFO RSZ-0036] Found 1 capacitance violations.
[INFO RSZ-0038] Inserted 2 buffers in 1 nets.
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_design2.ok
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
[INFO ODB-0131] Created 3 components and 14 component-terminals.
[INFO ODB-0132] Created 2 special nets and 0 connections.
[INFO ODB-0133] Created 4 nets and 6 connections.
[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
[INFO RSZ-0039] Resized 3 instances.
2 changes: 1 addition & 1 deletion src/rsz/test/repair_design3.ok
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
[INFO ODB-0131] Created 1001 components and 5004 component-terminals.
[INFO ODB-0132] Created 2 special nets and 0 connections.
[INFO ODB-0133] Created 2 nets and 1001 connections.
[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
[INFO RSZ-0039] Resized 1000 instances.
2 changes: 1 addition & 1 deletion src/rsz/test/repair_design3_verbose.ok
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[INFO ODB-0131] Created 1001 components and 5004 component-terminals.
[INFO ODB-0132] Created 2 special nets and 0 connections.
[INFO ODB-0133] Created 2 nets and 1001 connections.
[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
Iteration | Resized | Buffers | Nets repaired | Remaining
---------------------------------------------------------
0 | 0 | 0 | 0 | 1002
Expand Down
4 changes: 2 additions & 2 deletions src/rsz/test/repair_design4.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Pin Limit Fanout Slack
---------------------------------------------------------
drvr/Q 10 35 -25 (VIOLATED)

[INFO RSZ-0058] Using max wire length 527um.
[INFO RSZ-0058] Using max wire length 527um.
[INFO RSZ-0058] Using max wire length 530um.
[INFO RSZ-0058] Using max wire length 530um.
[INFO RSZ-0035] Found 1 fanout violations.
[INFO RSZ-0038] Inserted 4 buffers in 1 nets.
[INFO RSZ-0039] Resized 4 instances.
Expand Down
4 changes: 2 additions & 2 deletions src/rsz/test/repair_design5.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[INFO ODB-0131] Created 36 components and 216 component-terminals.
[INFO ODB-0132] Created 2 special nets and 72 connections.
[INFO ODB-0133] Created 2 nets and 72 connections.
[INFO RSZ-0058] Using max wire length 527um.
[INFO RSZ-0058] Using max wire length 530um.
[INFO RSZ-0035] Found 1 fanout violations.
[INFO RSZ-0038] Inserted 4 buffers in 1 nets.
[INFO RSZ-0039] Resized 3 instances.
Expand All @@ -18,7 +18,7 @@ Instance drvr
Output pins:
Q output net0
QN output (unconnected)
[INFO RSZ-0058] Using max wire length 527um.
[INFO RSZ-0058] Using max wire length 530um.
[INFO RSZ-0039] Resized 1 instances.
Instance drvr
Cell: DFF_X2
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_fanout1.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pin Limit Fanout Slack
---------------------------------------------------------
drvr/Q 10 35 -25 (VIOLATED)

[INFO RSZ-0058] Using max wire length 527um.
[INFO RSZ-0058] Using max wire length 530um.
[INFO RSZ-0035] Found 1 fanout violations.
[INFO RSZ-0038] Inserted 4 buffers in 1 nets.
[INFO RSZ-0039] Resized 4 instances.
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_fanout5.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pin Limit Fanout Slack
---------------------------------------------------------
in1 10 35 -25 (VIOLATED)

[INFO RSZ-0058] Using max wire length 527um.
[INFO RSZ-0058] Using max wire length 530um.
[INFO RSZ-0035] Found 1 fanout violations.
[INFO RSZ-0038] Inserted 4 buffers in 1 nets.
[INFO RSZ-0039] Resized 3 instances.
Expand Down
4 changes: 2 additions & 2 deletions src/rsz/test/repair_fanout6.ok
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[INFO RSZ-0035] Found 1 fanout violations.
[INFO RSZ-0038] Inserted 508 buffers in 1 nets.
[INFO RSZ-0039] Resized 509 instances.
worst slack -8.65
worst slack -8.67
max fanout

Pin Limit Fanout Slack
Expand All @@ -17,6 +17,6 @@ fanout1/X 20 20 0 (MET)
[INFO RSZ-0094] Found 6400 endpoints with setup violations.
[INFO RSZ-0099] Repairing 1 out of 6400 (0.00%) violating endpoints...
[INFO RSZ-0045] Inserted 17 buffers, 1 to split loads.
[INFO RSZ-0041] Resized 150 instances.
[INFO RSZ-0041] Resized 162 instances.
[WARNING RSZ-0062] Unable to repair all setup violations.
worst slack -3.10
2 changes: 1 addition & 1 deletion src/rsz/test/repair_setup2.ok
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ worst slack -0.28
---------------------------------------------------------------------------------------------------
0 | 0 | 0 | 0 | 0 | 0 | -0.117 | -0.2 | 2 | y2
5 | 0 | 0 | 0 | 0 | 2 | -0.117 | -0.2 | 2 | y2
7 | 0 | 0 | 0 | 0 | 3 | -0.117 | -0.2 | 2 | y2
8 | 0 | 0 | 0 | 0 | 3 | -0.117 | -0.2 | 2 | y2
final | 0 | 0 | 0 | 0 | 3 | -0.117 | -0.2 | 2 | y2
---------------------------------------------------------------------------------------------------
[INFO RSZ-0043] Swapped pins on 3 instances.
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_setup4.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tns -6.294
[INFO RSZ-0099] Repairing 6 out of 6 (100.00%) violating endpoints...
[INFO RSZ-0059] Removed 4 buffers.
[INFO RSZ-0040] Inserted 2 buffers.
[INFO RSZ-0041] Resized 3 instances.
[INFO RSZ-0041] Resized 2 instances.
[WARNING RSZ-0062] Unable to repair all setup violations.
Repair timing output passed/skipped equivalence test
worst slack -0.44
Expand Down
31 changes: 15 additions & 16 deletions src/rsz/test/repair_setup4_verbose.ok
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ worst slack -1.954
| Buffers | Gates | Buffers | Gates | Swaps | | | Endpts | Endpt
---------------------------------------------------------------------------------------------------
0 | 0 | 0 | 0 | 0 | 0 | -1.954 | -6.3 | 6 | r2/D
9 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
10 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
10 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
11 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
12 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
13 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
14 | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
15* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
16* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
17* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
18* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
19* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
20* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
20* | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
final | 4 | 3 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
8 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
9 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
10 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
10 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
11 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
12 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
13 | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
14* | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
15* | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
16* | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
17* | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
18* | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
19* | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
final | 4 | 2 | 3 | 0 | 0 | -0.439 | -2.2 | 6 | r7/D
---------------------------------------------------------------------------------------------------
[INFO RSZ-0059] Removed 4 buffers.
[INFO RSZ-0040] Inserted 2 buffers.
[INFO RSZ-0041] Resized 3 instances.
[INFO RSZ-0041] Resized 2 instances.
[WARNING RSZ-0062] Unable to repair all setup violations.
Repair timing output passed/skipped equivalence test
worst slack -0.439
4 changes: 2 additions & 2 deletions src/rsz/test/repair_setup7.ok
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ worst slack -1.95
[INFO RSZ-0094] Found 6 endpoints with setup violations.
[INFO RSZ-0099] Repairing 6 out of 6 (100.00%) violating endpoints...
[INFO RSZ-0040] Inserted 3 buffers.
[INFO RSZ-0041] Resized 44 instances.
[INFO RSZ-0041] Resized 41 instances.
[WARNING RSZ-0062] Unable to repair all setup violations.
Repair timing output passed/skipped equivalence test
worst slack -0.65
worst slack -0.63
2 changes: 1 addition & 1 deletion src/rsz/test/repair_setup_undo.ok
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tns -6.294
[INFO RSZ-0099] Repairing 6 out of 6 (100.00%) violating endpoints...
[INFO RSZ-0059] Removed 4 buffers.
[INFO RSZ-0040] Inserted 2 buffers.
[INFO RSZ-0041] Resized 3 instances.
[INFO RSZ-0041] Resized 2 instances.
[WARNING RSZ-0062] Unable to repair all setup violations.
post repair_timing QoR
worst slack -0.44
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_slew13.ok
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Pin Limit Slew Slack
------------------------------------------------------------
b1/A 0.03 0.07 -0.04 (VIOLATED)

[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
[INFO RSZ-0034] Found 1 slew violations.
[INFO RSZ-0039] Resized 1 instances.
max slew
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_slew14.ok
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pin Limit Slew Slack
------------------------------------------------------------
u2/A 1.50 1.81 -0.31 (VIOLATED)

[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
[INFO RSZ-0034] Found 1 slew violations.
[INFO RSZ-0036] Found 1 capacitance violations.
[INFO RSZ-0038] Inserted 2 buffers in 1 nets.
Expand Down
2 changes: 1 addition & 1 deletion src/rsz/test/repair_slew6.ok
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ r7/D 1.50 3.33 -1.83 (VIOLATED)
r8/D 1.50 3.33 -1.83 (VIOLATED)
r9/D 1.50 3.33 -1.83 (VIOLATED)

[INFO RSZ-0058] Using max wire length 2393um.
[INFO RSZ-0058] Using max wire length 2406um.
[INFO RSZ-0039] Resized 1 instances.
10 changes: 5 additions & 5 deletions src/rsz/test/repair_slew7.ok
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Pin Limit Cap Slack
------------------------------------------------------------
u1/ZN 10.47 15.05 -4.58 (VIOLATED)

[INFO RSZ-0058] Using max wire length 1229um.
[INFO RSZ-0039] Resized 3 instances.
[INFO RSZ-0058] Using max wire length 1247um.
[INFO RSZ-0039] Resized 1 instances.
Startpoint: u1/A4 (internal pin)
Endpoint: out1 (output port)
Path Group: unconstrained
Expand All @@ -46,9 +46,9 @@ Corner: slow
-----------------------------------------------------------------------
0.00 0.00 0.00 v u1/A4 (NOR4_X4)
14.64 0.24 0.40 0.40 ^ u1/ZN (NOR4_X4)
1.44 0.06 0.14 0.54 v u2/ZN (NAND4_X1)
0.77 0.02 0.11 0.65 v x2/Z (CLKBUF_X1)
0.02 0.00 0.65 v out1 (out)
1.61 0.06 0.14 0.54 v u2/ZN (NAND4_X1)
0.77 0.01 0.11 0.65 v x2/Z (BUF_X1)
0.01 0.00 0.65 v out1 (out)
0.65 data arrival time
-----------------------------------------------------------------------
(Path is unconstrained)
Expand Down
Loading
Loading