Skip to content

Commit 015a8e0

Browse files
authored
Merge pull request #364 from The-OpenROAD-Project/resizer
Resizer
2 parents c6ce319 + ac3821f commit 015a8e0

File tree

12 files changed

+120
-48
lines changed

12 files changed

+120
-48
lines changed

src/OpenSTA

src/resizer/include/resizer/Resizer.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ protected:
274274
float slackGap(Vertex *vertex);
275275
void repairHoldViolations(VertexSet &ends,
276276
LibertyCell *buffer_cell);
277-
void repairHoldPass(VertexSet &ends,
278-
LibertyCell *buffer_cell);
277+
int repairHoldPass(VertexSet &ends,
278+
LibertyCell *buffer_cell);
279279
void sortFaninsByWeight(VertexWeightMap &weight_map,
280280
// Return value.
281281
VertexSeq &fanins);

src/resizer/src/Resizer.cc

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,37 +1031,39 @@ Point
10311031
Resizer::tieLocation(Pin *load,
10321032
int separation)
10331033
{
1034-
dbInst *db_inst = db_network_->staToDb(network_->instance(load));
1035-
dbBox *bbox = db_inst->getBBox();
10361034
Point load_loc = db_network_->location(load);
10371035
int load_x = load_loc.getX();
10381036
int load_y = load_loc.getY();
1039-
int left_dist = abs(load_x - bbox->xMin());
1040-
int right_dist = abs(load_x - bbox->xMax());
1041-
int bot_dist = abs(load_y - bbox->yMin());
1042-
int top_dist = abs(load_y - bbox->yMax());
10431037
int tie_x = load_x;
10441038
int tie_y = load_y;
1045-
if (left_dist < right_dist
1046-
&& left_dist < bot_dist
1047-
&& left_dist < top_dist)
1048-
// left
1049-
tie_x -= separation;
1050-
if (right_dist < left_dist
1051-
&& right_dist < bot_dist
1052-
&& right_dist < top_dist)
1053-
// right
1054-
tie_x += separation;
1055-
if (bot_dist < left_dist
1056-
&& bot_dist < right_dist
1057-
&& bot_dist < top_dist)
1058-
// bot
1059-
tie_y -= separation;
1060-
if (top_dist < left_dist
1061-
&& top_dist < right_dist
1062-
&& top_dist < bot_dist)
1063-
// top
1064-
tie_y += separation;
1039+
if (!network_->isTopLevelPort(load)) {
1040+
dbInst *db_inst = db_network_->staToDb(network_->instance(load));
1041+
dbBox *bbox = db_inst->getBBox();
1042+
int left_dist = abs(load_x - bbox->xMin());
1043+
int right_dist = abs(load_x - bbox->xMax());
1044+
int bot_dist = abs(load_y - bbox->yMin());
1045+
int top_dist = abs(load_y - bbox->yMax());
1046+
if (left_dist < right_dist
1047+
&& left_dist < bot_dist
1048+
&& left_dist < top_dist)
1049+
// left
1050+
tie_x -= separation;
1051+
if (right_dist < left_dist
1052+
&& right_dist < bot_dist
1053+
&& right_dist < top_dist)
1054+
// right
1055+
tie_x += separation;
1056+
if (bot_dist < left_dist
1057+
&& bot_dist < right_dist
1058+
&& bot_dist < top_dist)
1059+
// bot
1060+
tie_y -= separation;
1061+
if (top_dist < left_dist
1062+
&& top_dist < right_dist
1063+
&& top_dist < bot_dist)
1064+
// top
1065+
tie_y += separation;
1066+
}
10651067
if (core_exists_)
10661068
return closestPtInRect(core_, tie_x, tie_y);
10671069
else
@@ -1114,22 +1116,23 @@ Resizer::repairHoldViolations(VertexSet &ends,
11141116
LibertyCell *buffer_cell)
11151117
{
11161118
inserted_buffer_count_ = 0;
1117-
Slack worst_slack, prev_slack;
1119+
Slack worst_slack;
11181120
Vertex *worst_vertex;
11191121
sta_->worstSlack(MinMax::min(), worst_slack, worst_vertex);
1120-
prev_slack = worst_slack * 2;
1122+
debugPrint1(debug_, "repair_hold", 1, "worst_slack=%s\n",
1123+
units_->timeUnit()->asString(worst_slack, 3));
1124+
int repair_count = 1;
11211125

11221126
int pass = 1;
11231127
while (worst_slack < 0.0
11241128
// Make sure we are making progress.
1125-
&& abs(worst_slack - prev_slack) > abs(prev_slack) * .001) {
1126-
debugPrint2(debug_, "repair_hold", 1, "pass %d worst_slack=%s\n",
1127-
pass,
1128-
units_->timeUnit()->asString(worst_slack, 3));
1129-
repairHoldPass(ends, buffer_cell);
1129+
&& repair_count > 0) {
1130+
debugPrint1(debug_, "repair_hold", 1, "pass %d\n", pass);
1131+
repair_count = repairHoldPass(ends, buffer_cell);
11301132
sta_->findRequireds();
1131-
prev_slack = worst_slack;
11321133
sta_->worstSlack(MinMax::min(), worst_slack, worst_vertex);
1134+
debugPrint1(debug_, "repair_hold", 1, "worst_slack=%s\n",
1135+
units_->timeUnit()->asString(worst_slack, 3));
11331136
pass++;
11341137
}
11351138
if (inserted_buffer_count_ > 0) {
@@ -1138,7 +1141,7 @@ Resizer::repairHoldViolations(VertexSet &ends,
11381141
}
11391142
}
11401143

1141-
void
1144+
int
11421145
Resizer::repairHoldPass(VertexSet &ends,
11431146
LibertyCell *buffer_cell)
11441147
{
@@ -1172,6 +1175,7 @@ Resizer::repairHoldPass(VertexSet &ends,
11721175
}
11731176
}
11741177
}
1178+
return repair_count;
11751179
}
11761180

11771181
void

src/resizer/test/regression_tests.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ record_tests {
2727
repair_tie3
2828
repair_tie4
2929
repair_tie5
30+
repair_tie6
3031
repair_wire1
3132
repair_wire2
3233
repair_wire3

src/resizer/test/repair_tie1.def

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
VERSION 5.8 ;
2+
NAMESCASESENSITIVE ON ;
3+
DIVIDERCHAR "/" ;
4+
BUSBITCHARS "[]" ;
5+
DESIGN top ;
6+
UNITS DISTANCE MICRONS 1000 ;
7+
8+
DIEAREA ( 0 0 ) ( 40000 40000 ) ;
9+
10+
COMPONENTS 6 ;
11+
- t1 LOGIC1_X1 ;
12+
- u0 BUF_X1 + PLACED ( 10000 10000 ) N ;
13+
- u1 BUF_X1 + PLACED ( 20000 10000 ) N ;
14+
- u2 BUF_X1 + PLACED ( 10000 20000 ) N ;
15+
- u3 BUF_X1 + PLACED ( 20000 20000 ) N ;
16+
- u4 BUF_X1 + PLACED ( 10000 30000 ) N ;
17+
END COMPONENTS
18+
NETS 1 ;
19+
- n1 ( t1 Z ) ( u0 A )
20+
( u1 A ) ( u2 A ) ( u3 A ) ( u4 A ) + USE SIGNAL ;
21+
END NETS
22+
END DESIGN

src/resizer/test/repair_tie1.ok

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Notice 0: Created 27 technology vias
44
Notice 0: Created 134 library cells
55
Notice 0: Finished LEF file: Nangate45/Nangate45.lef
66
Notice 0:
7-
Reading DEF file: ./results/tie_fanout1.def
7+
Reading DEF file: repair_tie1.def
88
Notice 0: Design: top
99
Notice 0: Created 6 components and 23 component-terminals.
1010
Notice 0: Created 1 nets and 6 connections.
11-
Notice 0: Finished DEF file: ./results/tie_fanout1.def
11+
Notice 0: Finished DEF file: repair_tie1.def
1212
Inserted 5 tie LOGIC1_X1 instances.
1313
t1_1 10.1 10.6
1414
t1_2 20.1 10.6

src/resizer/test/repair_tie1.tcl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# repair high fanout tie hi/low net
1+
# repair tie hi/low net
22
source "helpers.tcl"
33
source "resizer_helpers.tcl"
4-
source "tie_fanout.tcl"
54
read_liberty Nangate45/Nangate45_typ.lib
65
read_lef Nangate45/Nangate45.lef
7-
8-
set def_filename [file join $result_dir "tie_fanout1.def"]
9-
write_tie_hi_fanout_def $def_filename LOGIC1_X1/Z BUF_X1/A 5
10-
read_def $def_filename
6+
read_def repair_tie1.def
117

128
repair_tie_fanout LOGIC1_X1/Z
139
check_ties LOGIC1_X1

src/resizer/test/repair_tie6.def

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
VERSION 5.8 ;
2+
NAMESCASESENSITIVE ON ;
3+
DIVIDERCHAR "/" ;
4+
BUSBITCHARS "[]" ;
5+
DESIGN top ;
6+
UNITS DISTANCE MICRONS 1000 ;
7+
8+
DIEAREA ( 0 0 ) ( 40000 40000 ) ;
9+
10+
COMPONENTS 6 ;
11+
- t1 LOGIC1_X1 + PLACED ( 10000 20000 ) N ;
12+
- u0 BUF_X1 + PLACED ( 10000 10000 ) N ;
13+
END COMPONENTS
14+
15+
PINS 1 ;
16+
- tie1 + NET n1 + DIRECTION OUTPUT + USE SIGNAL + SPECIAL
17+
+ LAYER metal1 ( 100 0 ) ( 100 100 ) + FIXED ( 1000 1000 ) N ;
18+
END PINS
19+
20+
NETS 1 ;
21+
- n1 ( t1 Z ) ( u0 A ) ( PIN tie1 ) + USE SIGNAL ;
22+
END NETS
23+
END DESIGN

src/resizer/test/repair_tie6.ok

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Notice 0: Reading LEF file: Nangate45/Nangate45.lef
2+
Notice 0: Created 22 technology layers
3+
Notice 0: Created 27 technology vias
4+
Notice 0: Created 134 library cells
5+
Notice 0: Finished LEF file: Nangate45/Nangate45.lef
6+
Notice 0:
7+
Reading DEF file: repair_tie6.def
8+
Notice 0: Design: top
9+
Notice 0: Created 1 pins.
10+
Notice 0: Created 2 components and 7 component-terminals.
11+
Notice 0: Created 1 nets and 2 connections.
12+
Notice 0: Finished DEF file: repair_tie6.def
13+
Inserted 2 tie LOGIC1_X1 instances.
14+
t1_1 10.1 10.6
15+
t1_2 1.1 1.1

src/resizer/test/repair_tie6.tcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# repair_tie_fanout tie hi output port
2+
source "helpers.tcl"
3+
source "resizer_helpers.tcl"
4+
read_liberty Nangate45/Nangate45_typ.lib
5+
read_lef Nangate45/Nangate45.lef
6+
read_def repair_tie6.def
7+
8+
repair_tie_fanout LOGIC1_X1/Z
9+
check_ties LOGIC1_X1
10+
report_ties LOGIC1_X1
11+
check_in_core

0 commit comments

Comments
 (0)