Skip to content

Commit e9203bd

Browse files
committed
Merge branch 'master' into mpl-notch-penalty
2 parents cb781e9 + 2792550 commit e9203bd

19 files changed

+67
-77
lines changed

src/gui/src/layoutViewer.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,19 +634,23 @@ std::pair<LayoutViewer::Edge, bool> LayoutViewer::searchNearestEdge(
634634

635635
const bool routing_visible = options_->areRoutingSegmentsVisible();
636636
const bool vias_visible = options_->areRoutingViasVisible();
637-
if (routing_visible || vias_visible) {
637+
const bool io_pins_visible = options_->areIOPinsVisible();
638+
if (routing_visible || vias_visible || io_pins_visible) {
638639
auto box_shapes = search_.searchBoxShapes(block_,
639640
layer,
640641
search_line.xMin(),
641642
search_line.yMin(),
642643
search_line.xMax(),
643644
search_line.yMax(),
644645
shape_limit);
645-
for (const auto& [box, is_via, net] : box_shapes) {
646-
if (!routing_visible && !is_via) {
646+
for (const auto& [box, type, net] : box_shapes) {
647+
if (!routing_visible && type == Search::WIRE) {
647648
continue;
648649
}
649-
if (!vias_visible && is_via) {
650+
if (!vias_visible && type == Search::VIA) {
651+
continue;
652+
}
653+
if (!io_pins_visible && type == Search::BTERM) {
650654
continue;
651655
}
652656
if (isNetVisible(net)) {
@@ -855,7 +859,8 @@ void LayoutViewer::selectAt(odb::Rect region, std::vector<Selected>& selections)
855859

856860
const bool routing_visible = options_->areRoutingSegmentsVisible();
857861
const bool vias_visible = options_->areRoutingViasVisible();
858-
if (routing_visible || vias_visible) {
862+
const bool io_pins_visible = options_->areIOPinsVisible();
863+
if (routing_visible || vias_visible || io_pins_visible) {
859864
auto box_shapes = search_.searchBoxShapes(block_,
860865
layer,
861866
region.xMin(),
@@ -864,11 +869,14 @@ void LayoutViewer::selectAt(odb::Rect region, std::vector<Selected>& selections)
864869
region.yMax(),
865870
shape_limit);
866871

867-
for (auto& [box, is_via, net] : box_shapes) {
868-
if (!routing_visible && !is_via) {
872+
for (auto& [box, type, net] : box_shapes) {
873+
if (!routing_visible && type == Search::WIRE) {
874+
continue;
875+
}
876+
if (!vias_visible && type == Search::VIA) {
869877
continue;
870878
}
871-
if (!vias_visible && is_via) {
879+
if (!io_pins_visible && type == Search::BTERM) {
872880
continue;
873881
}
874882
if (isNetVisible(net) && options_->isNetSelectable(net)) {

src/gui/src/search.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void Search::updateShapes(odb::dbBlock* block)
272272
continue;
273273
}
274274
odb::dbTechLayer* layer = box->getTechLayer();
275-
net_shapes[layer].emplace_back(box->getBox(), false, term->getNet());
275+
net_shapes[layer].emplace_back(box->getBox(), BTERM, term->getNet());
276276
}
277277
}
278278
}
@@ -406,14 +406,14 @@ void Search::addVia(
406406
for (odb::dbBox* box : via->getBoxes()) {
407407
odb::Rect bbox = box->getBox();
408408
bbox.moveDelta(x, y);
409-
tree_shapes[box->getTechLayer()].emplace_back(bbox, true, net);
409+
tree_shapes[box->getTechLayer()].emplace_back(bbox, VIA, net);
410410
}
411411
} else {
412412
odb::dbVia* via = shape->getVia();
413413
for (odb::dbBox* box : via->getBoxes()) {
414414
odb::Rect bbox = box->getBox();
415415
bbox.moveDelta(x, y);
416-
tree_shapes[box->getTechLayer()].emplace_back(bbox, true, net);
416+
tree_shapes[box->getTechLayer()].emplace_back(bbox, VIA, net);
417417
}
418418
}
419419
}
@@ -462,7 +462,7 @@ void Search::addNet(
462462
if (s.isVia()) {
463463
addVia(net, &s, itr._prev_x, itr._prev_y, tree_shapes);
464464
} else {
465-
tree_shapes[s.getTechLayer()].emplace_back(s.getBox(), false, net);
465+
tree_shapes[s.getTechLayer()].emplace_back(s.getBox(), WIRE, net);
466466
}
467467
}
468468
}

src/gui/src/search.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@ class Search : public QObject, public odb::dbBlockCallBackObj
3939
class PolygonIntersectPredicate;
4040

4141
public:
42+
enum RouteBoxType
43+
{
44+
WIRE,
45+
VIA,
46+
BTERM
47+
};
48+
4249
template <typename T>
4350
using LayerMap = std::map<odb::dbTechLayer*, T>;
4451

4552
template <typename T>
4653
using RectValue = std::pair<odb::Rect, T>;
4754
template <typename T>
48-
using RouteBoxValue = std::tuple<odb::Rect, bool, T>;
55+
using RouteBoxValue = std::tuple<odb::Rect, RouteBoxType, T>;
4956
template <typename T>
5057
using SNetValue = std::tuple<odb::dbSBox*, odb::Polygon, T>;
5158
template <typename T>

src/mpl/src/SACoreHardMacro.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ SACoreHardMacro::SACoreHardMacro(PhysicalHierarchy* tree,
2929
float neg_swap_prob,
3030
float double_swap_prob,
3131
float exchange_prob,
32-
float flip_prob,
3332
// Fast SA hyperparameter
3433
float init_prob,
3534
int max_num_step,
@@ -54,7 +53,6 @@ SACoreHardMacro::SACoreHardMacro(PhysicalHierarchy* tree,
5453
logger,
5554
block)
5655
{
57-
flip_prob_ = flip_prob;
5856
}
5957

6058
void SACoreHardMacro::run()
@@ -104,13 +102,6 @@ void SACoreHardMacro::calPenalty()
104102
}
105103
}
106104

107-
void SACoreHardMacro::flipAllMacros()
108-
{
109-
for (auto& macro_id : pos_seq_) {
110-
macros_[macro_id].flip(false);
111-
}
112-
}
113-
114105
void SACoreHardMacro::perturb()
115106
{
116107
if (macros_.empty()) {
@@ -122,7 +113,7 @@ void SACoreHardMacro::perturb()
122113
const float action_prob_1 = pos_swap_prob_;
123114
const float action_prob_2 = action_prob_1 + neg_swap_prob_;
124115
const float action_prob_3 = action_prob_2 + double_swap_prob_;
125-
const float action_prob_4 = action_prob_3 + exchange_prob_;
116+
126117
if (op <= action_prob_1) {
127118
action_id_ = 1;
128119
singleSeqSwap(true); // Swap two macros in pos_seq_
@@ -133,12 +124,9 @@ void SACoreHardMacro::perturb()
133124
action_id_ = 3;
134125
doubleSeqSwap(); // Swap two macros in pos_seq_ and
135126
// other two macros in neg_seq_
136-
} else if (op <= action_prob_4) {
127+
} else {
137128
action_id_ = 4;
138129
exchangeMacros(); // exchange two macros in the sequence pair
139-
} else {
140-
action_id_ = 5;
141-
flipAllMacros();
142130
}
143131

144132
// update the macro locations based on Sequence Pair

src/mpl/src/SACoreHardMacro.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class SACoreHardMacro : public SimulatedAnnealingCore<HardMacro>
3030
float neg_swap_prob,
3131
float double_swap_prob,
3232
float exchange_prob,
33-
float flip_prob,
3433
// Fast SA hyperparameter
3534
float init_prob,
3635
int max_num_step,
@@ -57,10 +56,6 @@ class SACoreHardMacro : public SimulatedAnnealingCore<HardMacro>
5756
void perturb() override;
5857
void saveState() override;
5958
void restoreState() override;
60-
// actions used
61-
void flipAllMacros();
62-
63-
float flip_prob_ = 0.0;
6459
};
6560

6661
} // namespace mpl

src/mpl/src/hier_rtlmp.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ void HierRTLMP::resetSAParameters()
299299
neg_swap_prob_ = 0.2;
300300
double_swap_prob_ = 0.2;
301301
exchange_swap_prob_ = 0.2;
302-
flip_prob_ = 0.2;
303302
resize_prob_ = 0.0;
304303

305304
placement_core_weights_.fence = 0.0;
@@ -723,7 +722,6 @@ void HierRTLMP::calculateMacroTilings(Cluster* cluster)
723722
neg_swap_prob_ / action_sum,
724723
double_swap_prob_ / action_sum,
725724
exchange_swap_prob_ / action_sum,
726-
0.0, // no flip
727725
init_prob_,
728726
max_num_step_,
729727
num_perturb_per_step,
@@ -778,7 +776,6 @@ void HierRTLMP::calculateMacroTilings(Cluster* cluster)
778776
neg_swap_prob_ / action_sum,
779777
double_swap_prob_ / action_sum,
780778
exchange_swap_prob_ / action_sum,
781-
0.0,
782779
init_prob_,
783780
max_num_step_,
784781
num_perturb_per_step,
@@ -2452,14 +2449,12 @@ void HierRTLMP::placeMacros(Cluster* cluster)
24522449

24532450
// set the action probabilities (summation to 1.0)
24542451
const float action_sum = pos_swap_prob_ * 10 + neg_swap_prob_ * 10
2455-
+ double_swap_prob_ + exchange_swap_prob
2456-
+ flip_prob_;
2452+
+ double_swap_prob_ + exchange_swap_prob;
24572453

24582454
float pos_swap_prob = pos_swap_prob_ * 10 / action_sum;
24592455
float neg_swap_prob = neg_swap_prob_ * 10 / action_sum;
24602456
float double_swap_prob = double_swap_prob_ / action_sum;
24612457
exchange_swap_prob = exchange_swap_prob / action_sum;
2462-
float flip_prob = flip_prob_ / action_sum;
24632458

24642459
const int number_of_sequence_pair_macros
24652460
= static_cast<int>(hard_macros.size());
@@ -2477,11 +2472,10 @@ void HierRTLMP::placeMacros(Cluster* cluster)
24772472
pos_swap_prob = 0.0f;
24782473
neg_swap_prob = 0.0f;
24792474
double_swap_prob = 0.0f;
2480-
exchange_swap_prob = 0.95;
2481-
flip_prob = 0.05;
2475+
exchange_swap_prob = 1.0f;
24822476

24832477
// Large arrays need more steps to properly converge.
2484-
if (num_perturb_per_step > number_of_sequence_pair_macros) {
2478+
if (number_of_sequence_pair_macros > num_perturb_per_step) {
24852479
num_perturb_per_step *= 2;
24862480
}
24872481
}
@@ -2516,7 +2510,6 @@ void HierRTLMP::placeMacros(Cluster* cluster)
25162510
neg_swap_prob,
25172511
double_swap_prob,
25182512
exchange_swap_prob,
2519-
flip_prob,
25202513
init_prob_,
25212514
max_num_step_,
25222515
num_perturb_per_step,

src/mpl/src/hier_rtlmp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ class HierRTLMP
296296
float neg_swap_prob_ = 0.2;
297297
float double_swap_prob_ = 0.2;
298298
float exchange_swap_prob_ = 0.2;
299-
float flip_prob_ = 0.4;
300299
float resize_prob_ = 0.4;
301300

302301
// since we convert from the database unit to the micrometer

src/mpl/test/boundary_push2.defok

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
183183
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
184184
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
185185
COMPONENTS 54 ;
186-
- MACRO_1 HM_100x100_1x1 + FIXED ( 600 20770 ) FS ;
187-
- MACRO_2 HM_100x100_1x1 + FIXED ( 239440 221810 ) FS ;
188-
- MACRO_3 HM_100x100_1x1 + FIXED ( 600 221810 ) FS ;
189-
- MACRO_4 HM_100x100_1x1 + FIXED ( 239440 20770 ) FS ;
186+
- MACRO_1 HM_100x100_1x1 + FIXED ( 600 20770 ) S ;
187+
- MACRO_2 HM_100x100_1x1 + FIXED ( 239440 221810 ) S ;
188+
- MACRO_3 HM_100x100_1x1 + FIXED ( 600 221810 ) S ;
189+
- MACRO_4 HM_100x100_1x1 + FIXED ( 239440 20770 ) S ;
190190
- _001_ DFF_X1 + PLACED ( 216791 219800 ) N ;
191191
- _002_ DFF_X1 + PLACED ( 216791 219800 ) N ;
192192
- _003_ DFF_X1 + PLACED ( 216791 219800 ) N ;

src/mpl/test/boundary_push3.defok

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
183183
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
184184
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
185185
COMPONENTS 54 ;
186-
- MACRO_1 HM_100x100_1x1 + FIXED ( 19420 610 ) FS ;
187-
- MACRO_2 HM_100x100_1x1 + FIXED ( 220620 241970 ) FS ;
188-
- MACRO_3 HM_100x100_1x1 + FIXED ( 220620 610 ) FS ;
189-
- MACRO_4 HM_100x100_1x1 + FIXED ( 19420 241970 ) FS ;
186+
- MACRO_1 HM_100x100_1x1 + FIXED ( 19420 610 ) S ;
187+
- MACRO_2 HM_100x100_1x1 + FIXED ( 220620 241970 ) S ;
188+
- MACRO_3 HM_100x100_1x1 + FIXED ( 220620 610 ) S ;
189+
- MACRO_4 HM_100x100_1x1 + FIXED ( 19420 241970 ) S ;
190190
- _001_ DFF_X1 + PLACED ( 216791 219800 ) N ;
191191
- _002_ DFF_X1 + PLACED ( 216791 219800 ) N ;
192192
- _003_ DFF_X1 + PLACED ( 216791 219800 ) N ;

src/mpl/test/guides1.defok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
114114
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
115115
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
116116
COMPONENTS 401 ;
117-
- MACRO_1 HM_100x100_1x1 + FIXED ( 91830 8010 ) FS ;
117+
- MACRO_1 HM_100x100_1x1 + FIXED ( 91830 8010 ) S ;
118118
- _001_ DFF_X1 + PLACED ( 38682 123200 ) N ;
119119
- _002_ DFF_X1 + PLACED ( 38682 123200 ) N ;
120120
- _003_ DFF_X1 + PLACED ( 38682 123200 ) N ;

0 commit comments

Comments
 (0)