Skip to content

Commit 907de20

Browse files
committed
mpl: renaming and minor cleanup for fixed macros support
Signed-off-by: Arthur Koucher <[email protected]>
1 parent b97ddde commit 907de20

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

src/mpl/src/SimulatedAnnealingCore.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ void SimulatedAnnealingCore<T>::initSequencePair()
100100
return;
101101
}
102102

103-
const int sequence_pair_size
104-
= macros_to_place_ != 0 ? macros_to_place_ : macros_.size();
103+
const int sequence_pair_size = number_of_sequence_pair_macros_ != 0
104+
? number_of_sequence_pair_macros_
105+
: macros_.size();
105106

106107
int macro_id = 0;
107108

src/mpl/src/SimulatedAnnealingCore.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class SimulatedAnnealingCore
5959

6060
virtual ~SimulatedAnnealingCore() = default;
6161

62-
void setNumberOfMacrosToPlace(int macros_to_place)
62+
void setNumberOfSequencePairMacros(int number_of_sequence_pair_macros)
6363
{
64-
macros_to_place_ = macros_to_place;
64+
number_of_sequence_pair_macros_ = number_of_sequence_pair_macros;
6565
};
6666
void setNets(const std::vector<BundledNet>& nets);
6767
void setFences(const std::map<int, Rect>& fences);
@@ -145,8 +145,7 @@ class SimulatedAnnealingCore
145145
BoundaryRegionList available_regions_for_unconstrained_pins_;
146146
ClusterToBoundaryRegionMap io_cluster_to_constraint_;
147147

148-
// Number of macros that will actually be part of the sequence pair
149-
int macros_to_place_ = 0;
148+
int number_of_sequence_pair_macros_ = 0;
150149

151150
std::vector<BundledNet> nets_;
152151
std::map<int, Rect> fences_; // Macro Id -> Fence

src/mpl/src/clusterEngine.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,7 @@ void ClusteringEngine::setFloorplanShape()
171171

172172
void ClusteringEngine::searchForFixedInstsInsideFloorplanShape()
173173
{
174-
odb::Rect floorplan_shape(
175-
block_->micronsToDbu(tree_->floorplan_shape.xMin()),
176-
block_->micronsToDbu(tree_->floorplan_shape.yMin()),
177-
block_->micronsToDbu(tree_->floorplan_shape.xMax()),
178-
block_->micronsToDbu(tree_->floorplan_shape.yMax()));
174+
odb::Rect floorplan_shape = micronsToDbu(block_, tree_->floorplan_shape);
179175

180176
for (odb::dbInst* inst : block_->getInsts()) {
181177
if (inst->isFixed()
@@ -2105,7 +2101,7 @@ void ClusteringEngine::getHardMacros(odb::dbModule* module,
21052101
}
21062102

21072103
void ClusteringEngine::createOneClusterForEachMacro(
2108-
Cluster* parent,
2104+
Cluster* mixed_leaf_parent,
21092105
const std::vector<HardMacro*>& hard_macros,
21102106
std::vector<Cluster*>& macro_clusters)
21112107
{
@@ -2116,7 +2112,7 @@ void ClusteringEngine::createOneClusterForEachMacro(
21162112
single_macro_cluster->addLeafMacro(hard_macro->getInst());
21172113
macro_clusters.push_back(single_macro_cluster.get());
21182114

2119-
incorporateNewCluster(std::move(single_macro_cluster), parent);
2115+
incorporateNewCluster(std::move(single_macro_cluster), mixed_leaf_parent);
21202116
}
21212117
}
21222118

src/mpl/src/clusterEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class ClusteringEngine
219219
void mapMacroInCluster2HardMacro(Cluster* cluster);
220220
void getHardMacros(odb::dbModule* module,
221221
std::vector<HardMacro*>& hard_macros);
222-
void createOneClusterForEachMacro(Cluster* parent,
222+
void createOneClusterForEachMacro(Cluster* mixed_leaf_parent,
223223
const std::vector<HardMacro*>& hard_macros,
224224
std::vector<Cluster*>& macro_clusters);
225225
void classifyMacrosBySize(const std::vector<HardMacro*>& hard_macros,

src/mpl/src/hier_rtlmp.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,13 +1394,14 @@ void HierRTLMP::placeChildren(Cluster* parent)
13941394
io_clusters.push_back(cluster.get());
13951395
continue;
13961396
}
1397-
// for other clusters
1397+
13981398
soft_macro_id_map[cluster->getName()] = macros.size();
13991399
auto soft_macro = std::make_unique<SoftMacro>(cluster.get());
1400-
clustering_engine_->updateInstancesAssociation(
1401-
cluster.get()); // we need this step to calculate nets
1400+
// Needed for computing the nets.
1401+
clustering_engine_->updateInstancesAssociation(cluster.get());
14021402
macros.push_back(*soft_macro);
14031403
cluster->setSoftMacro(std::move(soft_macro));
1404+
14041405
// merge fences and guides for hard macros within cluster
14051406
if (cluster->getClusterType() == StdCellCluster) {
14061407
continue;
@@ -1440,7 +1441,7 @@ void HierRTLMP::placeChildren(Cluster* parent)
14401441
graphics_->setFences(fences);
14411442
}
14421443

1443-
const int num_of_macros_to_place = static_cast<int>(macros.size());
1444+
const int number_of_sequence_pair_macros = static_cast<int>(macros.size());
14441445

14451446
for (Cluster* io_cluster : io_clusters) {
14461447
soft_macro_id_map[io_cluster->getName()] = macros.size();
@@ -1630,7 +1631,7 @@ void HierRTLMP::placeChildren(Cluster* parent)
16301631
graphics_.get(),
16311632
logger_,
16321633
block_);
1633-
sa->setNumberOfMacrosToPlace(num_of_macros_to_place);
1634+
sa->setNumberOfSequencePairMacros(number_of_sequence_pair_macros);
16341635
sa->setCentralizationAttemptOn(true);
16351636
sa->setFences(fences);
16361637
sa->setGuides(guides);
@@ -1842,7 +1843,7 @@ void HierRTLMP::placeChildrenUsingMinimumTargetUtil(Cluster* parent)
18421843
graphics_->setFences(fences);
18431844
}
18441845

1845-
const int macros_to_place = static_cast<int>(macros.size());
1846+
const int number_of_sequence_pair_macros = static_cast<int>(macros.size());
18461847

18471848
for (Cluster* io_cluster : io_clusters) {
18481849
soft_macro_id_map[io_cluster->getName()] = macros.size();
@@ -2018,7 +2019,7 @@ void HierRTLMP::placeChildrenUsingMinimumTargetUtil(Cluster* parent)
20182019
graphics_.get(),
20192020
logger_,
20202021
block_);
2021-
sa->setNumberOfMacrosToPlace(macros_to_place);
2022+
sa->setNumberOfSequencePairMacros(number_of_sequence_pair_macros);
20222023
sa->setCentralizationAttemptOn(true);
20232024
sa->setFences(fences);
20242025
sa->setGuides(guides);
@@ -2479,15 +2480,18 @@ void HierRTLMP::placeMacros(Cluster* cluster)
24792480
exchange_swap_prob = exchange_swap_prob / action_sum;
24802481
float flip_prob = flip_prob_ / action_sum;
24812482

2482-
const int macros_to_place = static_cast<int>(hard_macros.size());
2483+
const int number_of_sequence_pair_macros
2484+
= static_cast<int>(hard_macros.size());
24832485

2484-
int num_perturb_per_step = (macros_to_place > num_perturb_per_step_ / 10)
2485-
? macros_to_place
2486-
: num_perturb_per_step_ / 10;
2486+
int num_perturb_per_step
2487+
= (number_of_sequence_pair_macros > num_perturb_per_step_ / 10)
2488+
? number_of_sequence_pair_macros
2489+
: num_perturb_per_step_ / 10;
24872490

24882491
SequencePair initial_seq_pair;
24892492
if (cluster->isArrayOfInterconnectedMacros()) {
2490-
setArrayTilingSequencePair(cluster, macros_to_place, initial_seq_pair);
2493+
setArrayTilingSequencePair(
2494+
cluster, number_of_sequence_pair_macros, initial_seq_pair);
24912495

24922496
pos_swap_prob = 0.0f;
24932497
neg_swap_prob = 0.0f;
@@ -2496,7 +2500,7 @@ void HierRTLMP::placeMacros(Cluster* cluster)
24962500
flip_prob = 0.05;
24972501

24982502
// Large arrays need more steps to properly converge.
2499-
if (num_perturb_per_step > macros_to_place) {
2503+
if (num_perturb_per_step > number_of_sequence_pair_macros) {
25002504
num_perturb_per_step *= 2;
25012505
}
25022506
}
@@ -2539,7 +2543,7 @@ void HierRTLMP::placeMacros(Cluster* cluster)
25392543
graphics_.get(),
25402544
logger_,
25412545
block_);
2542-
sa->setNumberOfMacrosToPlace(macros_to_place);
2546+
sa->setNumberOfSequencePairMacros(number_of_sequence_pair_macros);
25432547
sa->setNets(nets);
25442548
sa->setFences(fences);
25452549
sa->setGuides(guides);

0 commit comments

Comments
 (0)